Skip to content

feat(lint): fix multiple rare eslint errors #2598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Dec 12, 2022
15 changes: 0 additions & 15 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,6 @@ module.exports = {
'unicorn/prefer-regexp-test': 'off',
'unicorn/prefer-switch': 'off',
'unicorn/prefer-ternary': 'off',

// TODO rare errors
'arrow-body-style': 'off',
'block-scoped-var': 'off',
'import/no-extraneous-dependencies': 'off',
'import/order': 'off',
'new-cap': 'off',
'newline-per-chained-call': 'off',
'no-extra-boolean-cast': 'off',
'no-redeclare': 'off',
'no-unneeded-ternary': 'off',
'no-useless-return': 'off',
'operator-assignment': 'off',
'unicorn/no-console-spaces': 'off',
yoda: 'off',
},
reportUnusedDisableDirectives: true,
globals: {
Expand Down
2 changes: 1 addition & 1 deletion examples/responsive.html
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ <h3 class="ui center aligned header">Responsive Steps</h3>
<script type="text/javascript">
$(document).ready(function() {

var
let
$headers = $('body > h3'),
$header = $headers.first(),
ignoreScroll = false,
Expand Down
4 changes: 2 additions & 2 deletions scripts/nightly-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const path = require('path');
const childProcess = require('child_process');

// npm
const fetch = require('node-fetch');
const semver = require('semver');
const fetch = require('node-fetch'); // eslint-disable-line import/no-extraneous-dependencies
const semver = require('semver'); // eslint-disable-line import/no-extraneous-dependencies
const actions = require('@actions/core');

// pkg
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/behaviors/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,7 @@

// is not empty or blank string
empty: function (value) {
return !(value === undefined || '' === value || Array.isArray(value) && value.length === 0);
return !(value === undefined || value === '' || Array.isArray(value) && value.length === 0);
},

// checkbox checked
Expand Down
14 changes: 8 additions & 6 deletions src/definitions/modules/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@
if (isDay && settings.showWeekNumbers) {
tempMode += ' andweek';
}
var table = $('<table/>').addClass(className.table).addClass(tempMode).addClass(numberText[columns] + ' column').appendTo(container);
var table = $('<table/>').addClass(className.table).addClass(tempMode).addClass(numberText[columns] + ' column')
.appendTo(container);
if (isInverted) {
table.addClass(className.inverted);
}
Expand Down Expand Up @@ -1646,7 +1647,8 @@
if (!text) {
return null;
}
text = String(text).trim().replace(/([.:\/\-])\s+/g, '$1').replace(/\s+([.:\/-])/g, '$1').replace(/\s+/g, ' ');
text = String(text).trim().replace(/([.:\/\-])\s+/g, '$1').replace(/\s+([.:\/-])/g, '$1')
.replace(/\s+/g, ' ');
if (text.length === 0) {
return null;
}
Expand Down Expand Up @@ -1766,7 +1768,7 @@
if (isNaN(j)) {
continue;
}
if (1 <= j && j <= 12) {
if (j >= 1 && j <= 12) {
month = j;
numbers.splice(k, 1);

Expand All @@ -1781,7 +1783,7 @@
if (isNaN(j)) {
continue;
}
if (1 <= j && j <= 31) {
if (j >= 1 && j <= 31) {
day = j;
numbers.splice(i, 1);

Expand Down Expand Up @@ -1815,7 +1817,7 @@
if (isNaN(j)) {
continue;
}
if (0 <= j && j <= 23) {
if (j >= 0 && j <= 23) {
hour = j;
numbers.splice(i, 1);

Expand All @@ -1831,7 +1833,7 @@
if (isNaN(j)) {
continue;
}
if (0 <= j && j <= 59) {
if (j >= 0 && j <= 59) {
minute = j;
numbers.splice(i, 1);

Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/dimmer.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@
.addClass(settings.className.loader)
.addClass(settings.loaderVariation)
;
if (!!settings.loaderText) {
if (settings.loaderText) {
l.text(settings.loaderText);
l.addClass('text');
}
Expand Down
4 changes: 1 addition & 3 deletions src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -3304,9 +3304,7 @@
: (values == value)
;

return (hasValue)
? true
: false;
return !!(hasValue);
},
valueIgnoringCase: function (value) {
var
Expand Down
4 changes: 1 addition & 3 deletions src/definitions/modules/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,7 @@
if (settings.inline || settings.popup) {
return (module.has.popup());
} else {
return ($popup.closest($context).length >= 1)
? true
: false;
return ($popup.closest($context).length >= 1);
}
},

Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
var precision = 1;
var ratio = min / total;
while (precisionPower < 10) {
ratio = ratio * precision;
ratio *= precision;
if (ratio > 1) {
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
queryArguments = [].slice.call(arguments, 1),
returnedValue
;
$(this).each(function () {
$allModules.each(function () {
var
settings = ($.isPlainObject(parameters))
? $.extend(true, {}, $.fn.search.settings, parameters)
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
}
if (settings.displayTime > 0) {
var progressingClass = className.progressing + ' ' + (settings.pauseOnHover ? className.pausable : '');
if (!!settings.showProgress) {
if (settings.showProgress) {
$progress = $('<div/>', {
class: className.progress + ' ' + (settings.classProgress || settings.class),
'data-percent': '',
Expand Down
4 changes: 2 additions & 2 deletions tasks/admin/distributions/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ module.exports = function (callback) {

// get files for meteor
gatherFiles = function (dir) {
var
dir = dir || path.resolve('.'),
dir = dir || path.resolve('.');
let
list = fs.readdirSync(dir),
omitted = [
'.git',
Expand Down
4 changes: 2 additions & 2 deletions tasks/config/admin/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let
fs = require('fs'),
path = require('path'),
githubAPI = require('@octokit/rest'),
GithubAPI = require('@octokit/rest'),

// stores oauth info for GitHub API
oAuthConfig = path.join(__dirname, 'oauth.js'),
Expand All @@ -22,7 +22,7 @@ if (!oAuth) {
console.error('Must add oauth token for GitHub in tasks/config/admin/oauth.js');
}

github = new githubAPI({
github = new GithubAPI({
version: '3.0.0',
debug: true,
protocol: 'https',
Expand Down
4 changes: 1 addition & 3 deletions tasks/config/project/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let
module.exports = {

getPath: function (file, directory) {
var
let
configPath,
walk = function (directory) {
let
Expand All @@ -26,8 +26,6 @@ module.exports = {
if (fs.existsSync(currentPath)) {
// found file
configPath = path.normalize(directory);

return;
} else {
// reached file system root, let's stop
if (nextDirectory == directory) {
Expand Down
9 changes: 4 additions & 5 deletions tasks/config/project/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
let
fs = require('fs'),
path = require('path'),
requireDotFile = require('require-dot-file'),
defaults = require('../defaults'),
release = require('./release'),

requireDotFile = require('require-dot-file')
release = require('./release')
;

/*******************************
Expand Down Expand Up @@ -93,7 +92,7 @@ module.exports = {

// checks if files are in a PM directory
getPackageManager: function (directory) {
var
let
// returns last matching result (avoid sub-module detection)
walk = function (directory) {
let
Expand Down Expand Up @@ -133,7 +132,7 @@ module.exports = {

// checks if files is PMed submodule
isSubModule: function (directory) {
var
let
moduleFolders = 0,
walk = function (directory) {
let
Expand Down
6 changes: 2 additions & 4 deletions tasks/config/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ let overrideBrowserslist = hasBrowserslistConfig ? undefined : [
];

// Node 12 does not support ??, so a little polyfill
let nullish = (value, fallback) => {
return value !== undefined && value !== null ? value : fallback;
};
let nullish = (value, fallback) => (value !== undefined && value !== null ? value : fallback);

module.exports = {

Expand Down Expand Up @@ -120,7 +118,7 @@ module.exports = {
if (error.line == 9) {
element = regExp.variable.exec(error.message)[1];
if (element) {
console.error('Missing theme.config value for ', element);
console.error('Missing theme.config value for', element);
}
console.error('Most likely new UI was added in an update. You will need to add missing elements from theme.config.example');
} else if (error.line == 84) {
Expand Down
4 changes: 2 additions & 2 deletions tasks/docs/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function parser(file, callback) {
}

try {
var
let
/** @type {string} */
text = String(file.contents.toString('utf8')),
lines = text.split('\n'),
Expand Down Expand Up @@ -117,7 +117,7 @@ function parser(file, callback) {
// console.log(meta);
}
} catch (error) {
console.log(error, filename);
console.log(error, file.path);
}

callback(null, file);
Expand Down
4 changes: 2 additions & 2 deletions tasks/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ module.exports = function (callback) {
return;
}
} else {
console.error('Cannot locate files to update at path: ', updatePaths.definition);
console.error('Cannot locate files to update at path:', updatePaths.definition);
console.log('Running installer');
}
}
Expand Down Expand Up @@ -342,7 +342,7 @@ module.exports = function (callback) {
;

// rewrite site variable in theme.less
console.info('Adjusting @siteFolder to: ', pathToSite + '/');
console.info('Adjusting @siteFolder to:', pathToSite + '/');

if (fs.existsSync(installPaths.themeConfig)) {
console.info('Modifying src/theme.config (LESS config)', installPaths.themeConfig);
Expand Down
4 changes: 0 additions & 4 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ module.exports = {
},
rules: {
'jest/no-disabled-tests': 'off',

// TODO rare errors
'jest/no-jasmine-globals': 'off',
'jest/no-test-prefixes': 'off',
},
globals: {
jQuery: false,
Expand Down
2 changes: 1 addition & 1 deletion test/modules/module.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function moduleTests(ui) {
name = $.fn[module].settings.name,

testValue = 'Test',
fixtures = jasmine.getFixtures(),
fixtures = jasmine.getFixtures(), // eslint-disable-line jest/no-jasmine-globals

originalSettings,
$modules,
Expand Down
2 changes: 1 addition & 1 deletion test/modules/popup.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
xdescribe('UI Popup', function () {
describe.skip('UI Popup', function () {
moduleTests({
module: 'popup',
element: 'i.icon',
Expand Down
2 changes: 1 addition & 1 deletion test/modules/search.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
xdescribe('UI Search', function () {
describe.skip('UI Search', function () {
moduleTests({
module: 'search',
element: '.ui.search',
Expand Down
2 changes: 1 addition & 1 deletion test/modules/tab.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
xdescribe('UI Tab', function () {
describe.skip('UI Tab', function () {
moduleTests({
module: 'tab',
element: '.ui.menu .item',
Expand Down
2 changes: 1 addition & 1 deletion test/modules/transition.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
xdescribe('UI Transition', function () {
describe.skip('UI Transition', function () {
moduleTests({
module: 'transition',
element: '.ui.image',
Expand Down