Merge pull request #2817 from ehuss/update-eslint-9
Update eslint to 9.34.0
This commit is contained in:
commit
3cd055c508
4 changed files with 78 additions and 102 deletions
|
|
@ -1,95 +0,0 @@
|
||||||
{
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"node": true,
|
|
||||||
"es6": true
|
|
||||||
},
|
|
||||||
"extends": "eslint:recommended",
|
|
||||||
"globals": {
|
|
||||||
"module": "readonly",
|
|
||||||
"require": "readonly"
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 2021,
|
|
||||||
"requireConfigFile": false,
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"ignorePatterns": ["**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"
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
"tests/**/*.js"
|
|
||||||
],
|
|
||||||
"env": {
|
|
||||||
"jest": true,
|
|
||||||
"node": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -85,7 +85,6 @@ function playground_text(playground, hidden = true) {
|
||||||
const re = /extern\s+crate\s+([a-zA-Z_0-9]+)\s*;/g;
|
const re = /extern\s+crate\s+([a-zA-Z_0-9]+)\s*;/g;
|
||||||
const snippet_crates = [];
|
const snippet_crates = [];
|
||||||
let item;
|
let item;
|
||||||
// eslint-disable-next-line no-cond-assign
|
|
||||||
while (item = re.exec(txt)) {
|
while (item = re.exec(txt)) {
|
||||||
snippet_crates.push(item[1]);
|
snippet_crates.push(item[1]);
|
||||||
}
|
}
|
||||||
|
|
@ -351,7 +350,7 @@ aria-label="Show hidden lines"></button>';
|
||||||
let theme = null;
|
let theme = null;
|
||||||
try {
|
try {
|
||||||
theme = localStorage.getItem('mdbook-theme');
|
theme = localStorage.getItem('mdbook-theme');
|
||||||
} catch (e) {
|
} catch {
|
||||||
// ignore error.
|
// ignore error.
|
||||||
}
|
}
|
||||||
return theme;
|
return theme;
|
||||||
|
|
@ -412,7 +411,7 @@ aria-label="Show hidden lines"></button>';
|
||||||
if (store) {
|
if (store) {
|
||||||
try {
|
try {
|
||||||
localStorage.setItem('mdbook-theme', theme);
|
localStorage.setItem('mdbook-theme', theme);
|
||||||
} catch (e) {
|
} catch {
|
||||||
// ignore error.
|
// ignore error.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -560,7 +559,7 @@ aria-label="Show hidden lines"></button>';
|
||||||
sidebar.setAttribute('aria-hidden', false);
|
sidebar.setAttribute('aria-hidden', false);
|
||||||
try {
|
try {
|
||||||
localStorage.setItem('mdbook-sidebar', 'visible');
|
localStorage.setItem('mdbook-sidebar', 'visible');
|
||||||
} catch (e) {
|
} catch {
|
||||||
// Ignore error.
|
// Ignore error.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -574,7 +573,7 @@ aria-label="Show hidden lines"></button>';
|
||||||
sidebar.setAttribute('aria-hidden', true);
|
sidebar.setAttribute('aria-hidden', true);
|
||||||
try {
|
try {
|
||||||
localStorage.setItem('mdbook-sidebar', 'hidden');
|
localStorage.setItem('mdbook-sidebar', 'hidden');
|
||||||
} catch (e) {
|
} catch {
|
||||||
// Ignore error.
|
// Ignore error.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
72
eslint.config.mjs
Normal file
72
eslint.config.mjs
Normal file
|
|
@ -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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"browser-ui-test": "0.21.1",
|
"browser-ui-test": "0.21.1",
|
||||||
"eslint": "^8.57.1"
|
"eslint": "^9.34.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"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"
|
"lint-fix": "eslint --fix crates/mdbook-html/front-end/*js crates/mdbook-html/front-end/**/*js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue