Skip to content

Commit ce36b06

Browse files
chore: update eslint
1 parent 9057ed4 commit ce36b06

3 files changed

Lines changed: 203 additions & 120 deletions

File tree

eslint.config.mjs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import react from "eslint-plugin-react";
2+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
3+
import jest from "eslint-plugin-jest";
4+
import globals from "globals";
5+
import tsParser from "@typescript-eslint/parser";
6+
import path from "node:path";
7+
import { fileURLToPath } from "node:url";
8+
import js from "@eslint/js";
9+
import { FlatCompat } from "@eslint/eslintrc";
10+
11+
const __filename = fileURLToPath(import.meta.url);
12+
const __dirname = path.dirname(__filename);
13+
const compat = new FlatCompat({
14+
baseDirectory: __dirname,
15+
recommendedConfig: js.configs.recommended,
16+
allConfig: js.configs.all
17+
});
18+
19+
export default [...compat.extends(
20+
"eslint:recommended",
21+
"plugin:react/recommended",
22+
"plugin:@typescript-eslint/recommended",
23+
"plugin:prettier/recommended",
24+
"plugin:jest/recommended",
25+
).map(config => ({
26+
...config,
27+
})), {
28+
plugins: {
29+
react,
30+
"@typescript-eslint": typescriptEslint,
31+
jest,
32+
},
33+
34+
languageOptions: {
35+
globals: {
36+
...globals.browser,
37+
...globals.jest,
38+
unlayer: "readonly",
39+
},
40+
41+
parser: tsParser,
42+
ecmaVersion: 12,
43+
sourceType: "module",
44+
45+
parserOptions: {
46+
ecmaFeatures: {
47+
jsx: true,
48+
},
49+
},
50+
},
51+
52+
settings: {
53+
react: {
54+
version: "detect",
55+
},
56+
},
57+
58+
rules: {
59+
"prefer-const": "error",
60+
"no-use-before-define": "off",
61+
"@typescript-eslint/no-unused-vars": "error",
62+
"@typescript-eslint/no-explicit-any": "off",
63+
"@typescript-eslint/no-namespace": "off",
64+
"prettier/prettier": "off",
65+
"react/prop-types": "off",
66+
"jest/valid-title": "off",
67+
},
68+
}];

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"dotenv": "16.4.7",
2222
"dotenv-flow-webpack": "2.0.0",
2323
"eclint": "2.8.1",
24-
"eslint": "8.57.1",
24+
"eslint": "9.17.0",
2525
"eslint-config-prettier": "9.1.0",
2626
"eslint-plugin-jest": "28.9.0",
2727
"eslint-plugin-prettier": "5.2.1",
@@ -84,7 +84,7 @@
8484
"fix-format": "yarn prettier-fix && yarn eclint-fix",
8585
"eclint-fix": "eclint fix",
8686
"eclint-check": "eclint check",
87-
"eslint-check": "eslint --ext .ts --ext .tsx .",
87+
"eslint-check": "eslint . --ext .ts --ext .tsx",
8888
"prettier-fix": "prettier --write \"**/**\"",
8989
"prettier-check": "prettier --check \"**/**\""
9090
},

0 commit comments

Comments
 (0)