Skip to content

Commit 3cd055c

Browse files
authored
Merge pull request #2817 from ehuss/update-eslint-9
Update eslint to 9.34.0
2 parents 3f45b02 + 189eea5 commit 3cd055c

File tree

4 files changed

+78
-102
lines changed

4 files changed

+78
-102
lines changed

.eslintrc.json

Lines changed: 0 additions & 95 deletions
This file was deleted.

crates/mdbook-html/front-end/js/book.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ function playground_text(playground, hidden = true) {
8585
const re = /extern\s+crate\s+([a-zA-Z_0-9]+)\s*;/g;
8686
const snippet_crates = [];
8787
let item;
88-
// eslint-disable-next-line no-cond-assign
8988
while (item = re.exec(txt)) {
9089
snippet_crates.push(item[1]);
9190
}
@@ -351,7 +350,7 @@ aria-label="Show hidden lines"></button>';
351350
let theme = null;
352351
try {
353352
theme = localStorage.getItem('mdbook-theme');
354-
} catch (e) {
353+
} catch {
355354
// ignore error.
356355
}
357356
return theme;
@@ -412,7 +411,7 @@ aria-label="Show hidden lines"></button>';
412411
if (store) {
413412
try {
414413
localStorage.setItem('mdbook-theme', theme);
415-
} catch (e) {
414+
} catch {
416415
// ignore error.
417416
}
418417
}
@@ -560,7 +559,7 @@ aria-label="Show hidden lines"></button>';
560559
sidebar.setAttribute('aria-hidden', false);
561560
try {
562561
localStorage.setItem('mdbook-sidebar', 'visible');
563-
} catch (e) {
562+
} catch {
564563
// Ignore error.
565564
}
566565
}
@@ -574,7 +573,7 @@ aria-label="Show hidden lines"></button>';
574573
sidebar.setAttribute('aria-hidden', true);
575574
try {
576575
localStorage.setItem('mdbook-sidebar', 'hidden');
577-
} catch (e) {
576+
} catch {
578577
// Ignore error.
579578
}
580579
}

eslint.config.mjs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { defineConfig, globalIgnores } from "eslint/config";
2+
3+
export default defineConfig([
4+
globalIgnores(["**/**min.js", "**/highlight.js", "**/playground_editor/*"]),
5+
{
6+
rules: {
7+
indent: ["error", 4],
8+
"linebreak-style": ["error", "unix"],
9+
quotes: ["error", "single"],
10+
semi: ["error", "always"],
11+
12+
"brace-style": ["error", "1tbs", {
13+
allowSingleLine: false,
14+
}],
15+
16+
curly: "error",
17+
"no-trailing-spaces": "error",
18+
"no-multi-spaces": "error",
19+
20+
"keyword-spacing": ["error", {
21+
before: true,
22+
after: true,
23+
}],
24+
25+
"comma-spacing": ["error", {
26+
before: false,
27+
after: true,
28+
}],
29+
30+
"arrow-spacing": ["error", {
31+
before: true,
32+
after: true,
33+
}],
34+
35+
"key-spacing": ["error", {
36+
beforeColon: false,
37+
afterColon: true,
38+
mode: "strict",
39+
}],
40+
41+
"func-call-spacing": ["error", "never"],
42+
"space-infix-ops": "error",
43+
"space-before-function-paren": ["error", "never"],
44+
"space-before-blocks": "error",
45+
46+
"no-console": ["error", {
47+
allow: ["warn", "error"],
48+
}],
49+
50+
"comma-dangle": ["error", "always-multiline"],
51+
"comma-style": ["error", "last"],
52+
53+
"max-len": ["error", {
54+
code: 100,
55+
tabWidth: 2,
56+
}],
57+
58+
"eol-last": ["error", "always"],
59+
"no-extra-parens": "error",
60+
"arrow-parens": ["error", "as-needed"],
61+
62+
"no-unused-vars": ["error", {
63+
argsIgnorePattern: "^_",
64+
varsIgnorePattern: "^_",
65+
}],
66+
67+
"prefer-const": ["error"],
68+
"no-var": "error",
69+
eqeqeq: "error",
70+
},
71+
},
72+
]);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"dependencies": {
33
"browser-ui-test": "0.21.1",
4-
"eslint": "^8.57.1"
4+
"eslint": "^9.34.0"
55
},
66
"scripts": {
7-
"lint": "eslint crates/mdbook-html/front-end/*js crates/mdbook-html/front-end/**/*js",
7+
"lint": "eslint --no-warn-ignored crates/mdbook-html/front-end/*js crates/mdbook-html/front-end/**/*js",
88
"lint-fix": "eslint --fix crates/mdbook-html/front-end/*js crates/mdbook-html/front-end/**/*js"
99
}
1010
}

0 commit comments

Comments
 (0)