Skip to content

Commit 6ab504b

Browse files
committed
Migrate ESLint to flat config (eslint.config.mjs)
Replace legacy .eslintrc.js and .eslintignore with ESLint flat config. - Use typescript-eslint v8 with projectService for type-aware linting - Add eslint-plugin-jest for test file rules - Remove unused Live Server extension recommendation - Removed the need for eslint-plugin-import and other legacy plugins
1 parent 7a64a9c commit 6ab504b

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

eslint.config.mjs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import eslint from "@eslint/js";
2+
import tseslint from "typescript-eslint";
3+
import eslintConfigPrettier from "eslint-config-prettier";
4+
import jest from "eslint-plugin-jest";
5+
6+
export default tseslint.config(
7+
{
8+
ignores: ["**/dist/", "**/node_modules/", "example/"]
9+
},
10+
eslint.configs.recommended,
11+
...tseslint.configs.recommendedTypeChecked,
12+
eslintConfigPrettier,
13+
{
14+
languageOptions: {
15+
parserOptions: {
16+
projectService: {
17+
allowDefaultProject: ["eslint.config.mjs"]
18+
},
19+
tsconfigRootDir: import.meta.dirname
20+
}
21+
},
22+
rules: {
23+
"@typescript-eslint/no-inferrable-types": "off",
24+
"@typescript-eslint/no-unsafe-assignment": "off",
25+
"@typescript-eslint/no-unsafe-call": "off",
26+
"@typescript-eslint/no-unsafe-member-access": "off",
27+
"@typescript-eslint/no-unsafe-return": "off",
28+
"@typescript-eslint/no-redundant-type-constituents": "off",
29+
"@typescript-eslint/no-duplicate-type-constituents": "off",
30+
"@typescript-eslint/restrict-plus-operands": "off"
31+
}
32+
},
33+
{
34+
files: ["**/test/**/*.ts"],
35+
...jest.configs["flat/recommended"],
36+
rules: {
37+
...jest.configs["flat/recommended"].rules,
38+
"jest/valid-title": "off",
39+
"jest/valid-describe-callback": "off",
40+
"jest/no-export": "off",
41+
"jest/no-done-callback": "warn"
42+
}
43+
}
44+
);

0 commit comments

Comments
 (0)