Skip to content

Commit f195a66

Browse files
eslint upgrade ?
1 parent 38626ea commit f195a66

4 files changed

+75
-45
lines changed

.pre-commit-config.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ repos:
5757
hooks:
5858
- id: eslint
5959
additional_dependencies:
60-
60+
61+
6162
63+
- "@eslint/[email protected]"
64+
- "@eslint/[email protected]"
6265
args: ["--fix"]
6366
- repo: https://github.com/pre-commit/mirrors-mypy
6467
rev: v1.14.1

.eslintrc.json eslint.config.mjs

+39-35
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,44 @@
1-
{
2-
"env": {
3-
"browser": true,
4-
"commonjs": true,
5-
"es2021": true
1+
import globals from "globals";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import js from "@eslint/js";
5+
import { FlatCompat } from "@eslint/eslintrc";
6+
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
const compat = new FlatCompat({
10+
baseDirectory: __dirname,
11+
recommendedConfig: js.configs.recommended,
12+
allConfig: js.configs.all
13+
});
14+
15+
export default [...compat.extends("google"), {
16+
languageOptions: {
17+
globals: {
18+
...globals.browser,
19+
...globals.commonjs,
20+
},
21+
ecmaVersion: "latest",
22+
sourceType: "script",
623
},
7-
"extends": [
8-
"google"
9-
],
10-
"parserOptions": {
11-
"ecmaVersion": "latest"
12-
},
13-
"rules": {
24+
25+
rules: {
1426
"array-bracket-spacing": "error",
1527
"block-scoped-var": "error",
1628
"block-spacing": "error",
1729
"brace-style": "error",
18-
"camelcase": "off",
30+
camelcase: "off",
1931
"class-methods-use-this": "error",
2032
"consistent-return": "error",
2133
"default-case": "error",
2234
"default-case-last": "error",
2335
"default-param-last": "error",
2436
"grouped-accessor-pairs": "error",
25-
"indent": [ "error", 4 ],
26-
"linebreak-style": [ "error", "unix" ],
27-
"max-len": ["error", { "code": 120 }],
37+
indent: ["error", 4],
38+
"linebreak-style": ["error", "unix"],
39+
"max-len": ["error", {
40+
code: 120,
41+
}],
2842
"no-caller": "error",
2943
"no-console": "error",
3044
"no-empty-function": "error",
@@ -45,26 +59,16 @@
4559
"no-useless-backreference": "error",
4660
"no-useless-concat": "error",
4761
"no-var": "error",
48-
"object-curly-spacing": [
49-
"error",
50-
"always",
51-
{
52-
"arraysInObjects": true
53-
}
54-
],
62+
"object-curly-spacing": ["error", "always", {
63+
arraysInObjects: true,
64+
}],
5565
"prefer-const": "error",
5666
"prefer-promise-reject-errors": "error",
5767
"require-atomic-updates": "error",
5868
"require-await": "error",
59-
"require-jsdoc" : 0,
60-
"semi": [
61-
"error",
62-
"never"
63-
],
64-
"quotes": [
65-
"error",
66-
"single"
67-
],
68-
"yoda": "error"
69-
}
70-
}
69+
"require-jsdoc": 0,
70+
semi: ["error", "never"],
71+
quotes: ["error", "single"],
72+
yoda: "error",
73+
},
74+
}];

package-lock.json

+29-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
"all": "npm run lint && npm run unit && npm run build:css && npm run build:jsapp"
99
},
1010
"devDependencies": {
11+
"@eslint/eslintrc": "^3.2.0",
12+
"@eslint/js": "^9.19.0",
1113
"browserify": "^17.0.0",
1214
"chai": "^4.3.6",
1315
"eslint": "^9.19.0",
1416
"eslint-config-google": "^0.14.0",
17+
"globals": "^15.14.0",
1518
"mocha": "^10.0.0",
1619
"mock-local-storage": "^1.1.24",
1720
"nyc": "^15.1.0",

0 commit comments

Comments
 (0)