Skip to content

Commit be16d3d

Browse files
author
Erwin Dondorp
committed
upgraded to eslint 9
1 parent 4f1e482 commit be16d3d

File tree

11 files changed

+511
-400
lines changed

11 files changed

+511
-400
lines changed

eslint.config.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// eslint.config.js
2+
import js from "@eslint/js";
3+
import pluginCompat from "eslint-plugin-compat";
4+
5+
export default [
6+
{
7+
files: ["saltgui/static/scripts/**/*.js", "tests/**/*.js"],
8+
languageOptions: {
9+
ecmaVersion: "latest",
10+
sourceType: "module",
11+
},
12+
plugins: {
13+
compat: pluginCompat,
14+
},
15+
rules: {
16+
"array-element-newline": 0,
17+
"capitalized-comments": 0,
18+
"class-methods-use-this": 2,
19+
"complexity": 0,
20+
"dot-notation": 0,
21+
"function-call-argument-newline": 0,
22+
"function-paren-newline": 0,
23+
"guard-for-in": 0,
24+
"id-length": ["error", { "exceptions": ["i"] }],
25+
"indent": ["error", 2],
26+
"init-declarations": 0,
27+
"keyword-spacing": "warn",
28+
"max-classes-per-file": "off",
29+
"max-len": "off",
30+
"max-lines": "off",
31+
"max-lines-per-function": "off",
32+
"max-params": "off",
33+
"max-statements": "off",
34+
"multiline-comment-style": "off",
35+
"multiline-ternary": "off",
36+
"no-console": "error",
37+
"no-continue": "off",
38+
"no-invalid-this": "error",
39+
"no-loss-of-precision": "off",
40+
"no-magic-numbers": "off",
41+
"no-mixed-operators": "off",
42+
"no-param-reassign": "off",
43+
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
44+
"no-redeclare": "error",
45+
"no-ternary": "off",
46+
"no-undef-init": "error",
47+
"no-undefined": "off",
48+
"no-underscore-dangle": "off",
49+
"no-unused-vars": ["error", { "args": "all", "caughtErrors": "all", "vars": "all" }],
50+
"no-warning-comments": "off",
51+
"object-property-newline": "off",
52+
"object-shorthand": "off",
53+
"one-var": "off",
54+
"padded-blocks": "off",
55+
"prefer-destructuring": "off",
56+
"prefer-named-capture-group": "off",
57+
"prefer-template": "off",
58+
"require-unicode-regexp": "off",
59+
"space-before-function-paren": ["error", "always"],
60+
61+
"arrow-body-style": ["error", "as-needed"],
62+
"compat/compat": "error",
63+
"curly": ["error", "all"],
64+
"func-names": ["error", "always"],
65+
"line-comment-position": ["error", { "position": "above" }],
66+
"max-depth": ["error", 4],
67+
"no-bitwise": "error",
68+
"no-extra-parens": ["error"],
69+
"no-inline-comments": "error",
70+
"no-labels": "error",
71+
"no-lonely-if": "error",
72+
"no-self-assign": ["error", { "props": true }],
73+
"prefer-object-spread": "error",
74+
"sort-keys": ["error", "asc", { "caseSensitive": true, "natural": false }]
75+
}
76+
}
77+
];

package-lock.json

Lines changed: 410 additions & 313 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
"@babel/core": "^7.28.4",
1111
"@babel/preset-env": "^7.28.3",
1212
"@babel/register": "^7.28.3",
13+
"@eslint/js": "^9.39.1",
1314
"babel-plugin-istanbul": "^7.0.1",
1415
"chai": "^6.2.0",
15-
"eslint": "^8.57.1",
16+
"eslint": "^9.39.1",
17+
"eslint-define-config": "^2.1.0",
1618
"eslint-plugin-compat": "^6.0.2",
1719
"mocha": "^11.7.4",
1820
"nightmare": "^3.0.2",
@@ -22,87 +24,6 @@
2224
"stylelint-csstree-validator": "^2.0.0",
2325
"stylelint-scss": "^5.3.2"
2426
},
25-
"eslintConfig": {
26-
"env": {
27-
"es6": true
28-
},
29-
"extends": [
30-
"eslint:all",
31-
"plugin:compat/recommended"
32-
],
33-
"parserOptions": {
34-
"ecmaVersion": 6,
35-
"sourceType": "module"
36-
},
37-
"rules": {
38-
"array-element-newline": 0,
39-
"capitalized-comments": 0,
40-
"class-methods-use-this": 2,
41-
"complexity": 0,
42-
"dot-notation": 0,
43-
"function-call-argument-newline": 0,
44-
"function-paren-newline": 0,
45-
"guard-for-in": 0,
46-
"id-length": [
47-
"error",
48-
{
49-
"exceptions": [
50-
"i"
51-
]
52-
}
53-
],
54-
"indent": [
55-
"error",
56-
2
57-
],
58-
"init-declarations": 0,
59-
"keyword-spacing": 1,
60-
"max-classes-per-file": 0,
61-
"max-len": 0,
62-
"max-lines": 0,
63-
"max-lines-per-function": 0,
64-
"max-params": 0,
65-
"max-statements": 0,
66-
"multiline-comment-style": 0,
67-
"multiline-ternary": 0,
68-
"no-console": 0,
69-
"no-continue": 0,
70-
"no-invalid-this": 2,
71-
"no-loss-of-precision": 0,
72-
"no-magic-numbers": 0,
73-
"no-mixed-operators": 0,
74-
"no-param-reassign": 0,
75-
"no-plusplus": [
76-
"error",
77-
{
78-
"allowForLoopAfterthoughts": true
79-
}
80-
],
81-
"no-redeclare": 2,
82-
"no-ternary": 0,
83-
"no-undef-init": 2,
84-
"no-undefined": 0,
85-
"no-underscore-dangle": 0,
86-
"no-unused-vars": [
87-
"error",
88-
{
89-
"args": "all",
90-
"caughtErrors": "all",
91-
"vars": "all"
92-
}
93-
],
94-
"no-warning-comments": 0,
95-
"object-property-newline": 0,
96-
"object-shorthand": 0,
97-
"one-var": 0,
98-
"padded-blocks": 0,
99-
"prefer-destructuring": 0,
100-
"prefer-named-capture-group": 0,
101-
"prefer-template": 0,
102-
"require-unicode-regexp": 0,
103-
"space-before-function-paren": ["error", "always"]
104-
}
105-
},
10627
"stylelint": {
10728
"extends": "stylelint-config-standard",
10829
"rules": {

saltgui/static/scripts/Api.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,7 @@ export class API {
402402

403403
let source;
404404
try {
405-
/* eslint-disable compat/compat */
406405
source = new EventSource(config.API_URL + "/events?token=" + tokenOnSetup);
407-
/* eslint-enable compat/compat */
408406
} catch (err) { // eslint-disable-line no-unused-vars
409407
Utils.error("Cannot read the Salt-EventBus with this browser version, browser upgrade recommended");
410408
return;

saltgui/static/scripts/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ window.addEventListener("load", () => new Router());
77
/* eslint-disable func-names */
88
// Make sure the errors are shown during regression testing
99
window.onerror = function (msg, url, lineNo, columnNo, error) {
10+
/* eslint-disable no-console */
1011
console.log("JS Error:" + msg + ",error:" + error + ",url:" + url + "@" + lineNo + ":" + columnNo);
12+
/* eslint-enable no-console */
1113
if (error && error.stack) {
14+
/* eslint-disable no-console */
1215
console.log("Stack:" + error.stack);
16+
/* eslint-enable no-console */
1317
}
1418
return false;
1519
};

saltgui/static/scripts/issues/NotConnected.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export class NotConnectedIssues extends Issues {
4444
NotConnectedIssues._handleNotConnected(pPanel, wheelKeyListAllData, wheelMinionsConnectedData);
4545
}, (error) => {
4646
Issues.readyCategory(pPanel, msg);
47+
/* eslint-disable no-console */
4748
console.error(error);
49+
/* eslint-enable no-console */
4850
});
4951

5052
return allPromise;

saltgui/static/scripts/panels/HighState.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,6 @@ export class HighStatePanel extends Panel {
399399
functionField.cmd = jobData.Function + argumentsText;
400400
minionTr.appendChild(functionField);
401401

402-
/* eslint-enable max-depth */
403-
404402
const startTimeTd = Utils.createTd();
405403
const startTimeSpan = Utils.createSpan("starttime");
406404
Output.dateTimeStr(jobData.StartTime, startTimeSpan);

saltgui/static/scripts/panels/Jobs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ export class JobsPanel extends Panel {
239239
if (typeof jobs === "string") {
240240
// typically when special returner is misconfigured
241241
// the warning may help solve that too
242+
/* eslint-disable no-console */
242243
console.warn(jobs);
244+
/* eslint-enable no-console */
243245
return [];
244246
}
245247
const keys = Object.keys(jobs);

saltgui/static/scripts/panels/Login.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ export class LoginPanel extends Panel {
127127
saltAuth = saltAuth.filter((item) => item !== "CLEAR");
128128
if (saltAuth.length === 0) {
129129
// no cheating
130-
console.warn("salt-auth-txt has no extries, except 'CLEAR', assuming 'pam'");
130+
/* eslint-disable no-console */
131+
console.warn("salt-auth-txt has no entries, except 'CLEAR', assuming 'pam'");
132+
/* eslint-enable no-console */
131133
saltAuth = ["pam"];
132134
}
133135
this.eauthField.innerHTML = "";
@@ -184,7 +186,9 @@ export class LoginPanel extends Panel {
184186
if (fields.length === 1) {
185187
saltAuth.push(fields[0]);
186188
} else {
189+
/* eslint-disable no-console */
187190
console.warn("lines in 'salt-auth.txt' must have 1 word, not " + fields.length + " like in: " + line);
191+
/* eslint-enable no-console */
188192
}
189193
}
190194
Utils.setStorageItem("local", "salt-auth-txt", JSON.stringify(saltAuth));

tests/functional/login.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ describe("Funtional tests", function () {
2626
};
2727

2828
if (process.env.NIGHTMARE_DEBUG === "1") {
29+
/* eslint-disable no-console */
2930
console.log("NIGHTMARE_DEBUG=1, setting additional options");
31+
/* eslint-enable no-console */
3032

3133
// show the browser and the debug window
3234
options.openDevTools = true;
@@ -36,6 +38,7 @@ describe("Funtional tests", function () {
3638

3739
browser = new Nightmare(options);
3840

41+
/* eslint-disable no-console */
3942
browser.on('console', (type, message) => {
4043
console.log(`[console][${type}] ` + JSON.stringify(message, null, 2));
4144
});
@@ -46,6 +49,7 @@ describe("Funtional tests", function () {
4649
console.error('stack:', stack);
4750
}
4851
});
52+
/* eslint-enable no-console */
4953

5054
return browser.
5155
goto(url).

0 commit comments

Comments
 (0)