mirror of
https://github.com/rust-lang/mdBook.git
synced 2025-12-27 10:16:09 -05:00
Update eslint to 9.34.0
This requires a switch to the configuration file format described at https://eslint.org/docs/latest/use/configure/configuration-files. I used the automatic tool to generate the new file, with some simplifications around defaults. - Removed no-cond-assign override, it is no longer needed. - Fixed `catch (e)` where `e` is not used. This seems a little pedantic to me, but seems like a relatively easy fix to just remove it, and I believe the syntax without the variable has been supported for quite some time. Alternatively it could also be `_e`, or explicitly allowed. - Added `--no-warn-ignored` to the script since it was very noisy.
This commit is contained in:
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",
|
||||
},
|
||||
},
|
||||
]);
|
||||
Reference in New Issue
Block a user