Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 0 additions & 95 deletions .eslintrc.json

This file was deleted.

9 changes: 4 additions & 5 deletions crates/mdbook-html/front-end/js/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ function playground_text(playground, hidden = true) {
const re = /extern\s+crate\s+([a-zA-Z_0-9]+)\s*;/g;
const snippet_crates = [];
let item;
// eslint-disable-next-line no-cond-assign
while (item = re.exec(txt)) {
snippet_crates.push(item[1]);
}
Expand Down Expand Up @@ -351,7 +350,7 @@ aria-label="Show hidden lines"></button>';
let theme = null;
try {
theme = localStorage.getItem('mdbook-theme');
} catch (e) {
} catch {
// ignore error.
}
return theme;
Expand Down Expand Up @@ -412,7 +411,7 @@ aria-label="Show hidden lines"></button>';
if (store) {
try {
localStorage.setItem('mdbook-theme', theme);
} catch (e) {
} catch {
// ignore error.
}
}
Expand Down Expand Up @@ -560,7 +559,7 @@ aria-label="Show hidden lines"></button>';
sidebar.setAttribute('aria-hidden', false);
try {
localStorage.setItem('mdbook-sidebar', 'visible');
} catch (e) {
} catch {
// Ignore error.
}
}
Expand All @@ -574,7 +573,7 @@ aria-label="Show hidden lines"></button>';
sidebar.setAttribute('aria-hidden', true);
try {
localStorage.setItem('mdbook-sidebar', 'hidden');
} catch (e) {
} catch {
// Ignore error.
}
}
Expand Down
72 changes: 72 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { defineConfig, globalIgnores } from "eslint/config";

export default defineConfig([
globalIgnores(["**/**min.js", "**/highlight.js", "**/playground_editor/*"]),
{
rules: {
indent: ["error", 4],
"linebreak-style": ["error", "unix"],
quotes: ["error", "single"],
semi: ["error", "always"],

"brace-style": ["error", "1tbs", {
allowSingleLine: false,
}],

curly: "error",
"no-trailing-spaces": "error",
"no-multi-spaces": "error",

"keyword-spacing": ["error", {
before: true,
after: true,
}],

"comma-spacing": ["error", {
before: false,
after: true,
}],

"arrow-spacing": ["error", {
before: true,
after: true,
}],

"key-spacing": ["error", {
beforeColon: false,
afterColon: true,
mode: "strict",
}],

"func-call-spacing": ["error", "never"],
"space-infix-ops": "error",
"space-before-function-paren": ["error", "never"],
"space-before-blocks": "error",

"no-console": ["error", {
allow: ["warn", "error"],
}],

"comma-dangle": ["error", "always-multiline"],
"comma-style": ["error", "last"],

"max-len": ["error", {
code: 100,
tabWidth: 2,
}],

"eol-last": ["error", "always"],
"no-extra-parens": "error",
"arrow-parens": ["error", "as-needed"],

"no-unused-vars": ["error", {
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
}],

"prefer-const": ["error"],
"no-var": "error",
eqeqeq: "error",
},
},
]);
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"dependencies": {
"browser-ui-test": "0.21.1",
"eslint": "^8.57.1"
"eslint": "^9.34.0"
},
"scripts": {
"lint": "eslint crates/mdbook-html/front-end/*js crates/mdbook-html/front-end/**/*js",
"lint": "eslint --no-warn-ignored crates/mdbook-html/front-end/*js crates/mdbook-html/front-end/**/*js",
"lint-fix": "eslint --fix crates/mdbook-html/front-end/*js crates/mdbook-html/front-end/**/*js"
}
}
Loading