Skip to content

Commit d638a9a

Browse files
committed
...
1 parent fc8a694 commit d638a9a

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

eslint.config.mjs

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
2+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
3+
import globals from "globals";
4+
import tsParser from "@typescript-eslint/parser";
5+
import path from "node:path";
6+
import { fileURLToPath } from "node:url";
7+
import js from "@eslint/js";
8+
import { FlatCompat } from "@eslint/eslintrc";
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = path.dirname(__filename);
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all
16+
});
17+
18+
export default [...fixupConfigRules(compat.extends(
19+
"plugin:@typescript-eslint/eslint-recommended",
20+
"plugin:@typescript-eslint/recommended",
21+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
22+
"plugin:import/recommended",
23+
"plugin:import/typescript",
24+
"prettier",
25+
"plugin:prettier/recommended",
26+
)), {
27+
plugins: {
28+
"@typescript-eslint": fixupPluginRules(typescriptEslint),
29+
},
30+
31+
languageOptions: {
32+
globals: {
33+
...globals.browser,
34+
...globals.commonjs,
35+
...globals.jest,
36+
...globals.node,
37+
},
38+
39+
parser: tsParser,
40+
ecmaVersion: 7,
41+
sourceType: "module",
42+
43+
parserOptions: {
44+
project: ["./tsconfig.eslint.json"],
45+
},
46+
},
47+
48+
settings: {
49+
"import/resolver": {
50+
typescript: true,
51+
node: true,
52+
},
53+
},
54+
55+
rules: {
56+
"prettier/prettier": "error",
57+
"@typescript-eslint/consistent-type-imports": "error",
58+
59+
"@typescript-eslint/no-empty-interface": ["error", {
60+
allowSingleExtends: true,
61+
}],
62+
63+
"@typescript-eslint/no-use-before-define": ["error", {
64+
functions: false,
65+
}],
66+
67+
"@typescript-eslint/no-explicit-any": [0],
68+
"import/no-named-as-default-member": [0],
69+
},
70+
}];

tsconfig.eslint.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"extends": "./tsconfig.json",
3-
"include": ["jest.config.ts", "eslint.config.mjs", "./src"],
3+
"include": ["jest.config.ts", "jest.setup.ts", "eslint.config.mjs", "./src"],
44
"exclude": []
55
}

0 commit comments

Comments
 (0)