|
1 | | -{ |
2 | | - "env": { |
3 | | - "browser": true, |
4 | | - "es6": true, |
5 | | - "node": true |
| 1 | +import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
| 2 | +import globals from "globals"; |
| 3 | +import tsParser from "@typescript-eslint/parser"; |
| 4 | +import path from "node:path"; |
| 5 | +import { fileURLToPath } from "node:url"; |
| 6 | +import js from "@eslint/js"; |
| 7 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 8 | + |
| 9 | +const __filename = fileURLToPath(import.meta.url); |
| 10 | +const __dirname = path.dirname(__filename); |
| 11 | +const compat = new FlatCompat({ |
| 12 | + baseDirectory: __dirname, |
| 13 | + recommendedConfig: js.configs.recommended, |
| 14 | + allConfig: js.configs.all |
| 15 | +}); |
| 16 | + |
| 17 | +export default [...compat.extends( |
| 18 | + "plugin:@typescript-eslint/recommended", |
| 19 | + "plugin:@typescript-eslint/recommended-requiring-type-checking", |
| 20 | +), { |
| 21 | + plugins: { |
| 22 | + "@typescript-eslint": typescriptEslint, |
6 | 23 | }, |
7 | | - "extends": [ |
8 | | - "plugin:@typescript-eslint/recommended", |
9 | | - "plugin:@typescript-eslint/recommended-requiring-type-checking" |
10 | | - ], |
11 | | - "parser": "@typescript-eslint/parser", |
12 | | - "parserOptions": { |
13 | | - "project": "tsconfig.json", |
14 | | - "sourceType": "module" |
| 24 | + |
| 25 | + languageOptions: { |
| 26 | + globals: { |
| 27 | + ...globals.browser, |
| 28 | + ...globals.node, |
| 29 | + }, |
| 30 | + |
| 31 | + parser: tsParser, |
| 32 | + ecmaVersion: 5, |
| 33 | + sourceType: "module", |
| 34 | + |
| 35 | + parserOptions: { |
| 36 | + project: "tsconfig.json", |
| 37 | + }, |
15 | 38 | }, |
16 | | - "plugins": [ |
17 | | - "@typescript-eslint" |
18 | | - ], |
19 | | - "rules": { |
| 39 | + |
| 40 | + rules: { |
20 | 41 | "@typescript-eslint/adjacent-overload-signatures": "error", |
21 | 42 | "@typescript-eslint/array-type": "error", |
22 | | - "@typescript-eslint/ban-types": "error", |
23 | 43 | "@typescript-eslint/class-name-casing": "off", |
24 | 44 | "@typescript-eslint/consistent-type-assertions": "error", |
25 | 45 | "@typescript-eslint/interface-name-prefix": "off", |
26 | 46 | "@typescript-eslint/no-unsafe-member-access": "off", |
27 | 47 | "@typescript-eslint/no-unsafe-call": "off", |
28 | 48 | "@typescript-eslint/no-unsafe-assignment": "off", |
29 | | - "@typescript-eslint/member-delimiter-style": [ |
30 | | - "error", |
31 | | - { |
32 | | - "multiline": { |
33 | | - "delimiter": "semi", |
34 | | - "requireLast": true |
35 | | - }, |
36 | | - "singleline": { |
37 | | - "delimiter": "semi", |
38 | | - "requireLast": false |
39 | | - } |
40 | | - } |
41 | | - ], |
42 | 49 | "@typescript-eslint/no-misused-promises": "off", |
43 | 50 | "@typescript-eslint/no-empty-function": "error", |
44 | 51 | "@typescript-eslint/no-empty-interface": "error", |
|
51 | 58 | "@typescript-eslint/prefer-for-of": "error", |
52 | 59 | "@typescript-eslint/prefer-function-type": "error", |
53 | 60 | "@typescript-eslint/prefer-namespace-keyword": "error", |
54 | | - "@typescript-eslint/unbound-method": "off", |
55 | | - "@typescript-eslint/quotes": [ |
56 | | - "error", |
57 | | - "single", |
58 | | - { |
59 | | - "avoidEscape": true |
60 | | - } |
61 | | - ], |
62 | | - "@typescript-eslint/semi": "error", |
| 61 | + "@typescript-eslint/unbound-method": "off", |
| 62 | + |
| 63 | + "quotes": ["error", "single", { |
| 64 | + avoidEscape: true, |
| 65 | + }], |
| 66 | + |
| 67 | + "semi": "error", |
63 | 68 | "@typescript-eslint/triple-slash-reference": "error", |
64 | 69 | "@typescript-eslint/unified-signatures": "error", |
65 | | - "arrow-parens": [ |
66 | | - "off", |
67 | | - "as-needed" |
68 | | - ], |
69 | | - "camelcase": "error", |
| 70 | + "arrow-parens": ["off", "as-needed"], |
| 71 | + camelcase: "error", |
70 | 72 | "comma-dangle": "off", |
71 | | - "complexity": "off", |
| 73 | + complexity: "off", |
72 | 74 | "constructor-super": "error", |
73 | 75 | "dot-notation": "error", |
74 | | - "eqeqeq": [ |
75 | | - "error", |
76 | | - "smart" |
77 | | - ], |
| 76 | + eqeqeq: ["error", "smart"], |
78 | 77 | "guard-for-in": "error", |
| 78 | + |
79 | 79 | "id-blacklist": [ |
80 | 80 | "error", |
81 | 81 | "any", |
|
86 | 86 | "Boolean", |
87 | 87 | "boolean", |
88 | 88 | "Undefined", |
89 | | - "undefined" |
| 89 | + "undefined", |
90 | 90 | ], |
| 91 | + |
91 | 92 | "id-match": "error", |
92 | 93 | "max-classes-per-file": "off", |
93 | | - "max-len": [ |
94 | | - "error", |
95 | | - { |
96 | | - "code": 80 |
97 | | - } |
98 | | - ], |
| 94 | + |
| 95 | + "max-len": ["error", { |
| 96 | + code: 80, |
| 97 | + }], |
| 98 | + |
99 | 99 | "new-parens": "error", |
100 | 100 | "no-bitwise": "off", |
101 | 101 | "no-caller": "error", |
|
108 | 108 | "no-invalid-this": "off", |
109 | 109 | "no-multiple-empty-lines": "off", |
110 | 110 | "no-new-wrappers": "error", |
111 | | - "no-shadow": [ |
112 | | - "error", |
113 | | - { |
114 | | - "hoist": "all" |
115 | | - } |
116 | | - ], |
| 111 | + |
| 112 | + "no-shadow": ["error", { |
| 113 | + hoist: "all", |
| 114 | + }], |
| 115 | + |
117 | 116 | "no-throw-literal": "error", |
118 | 117 | "no-trailing-spaces": "error", |
119 | 118 | "no-undef-init": "error", |
|
123 | 122 | "no-unused-labels": "error", |
124 | 123 | "no-var": "error", |
125 | 124 | "object-shorthand": "error", |
126 | | - "one-var": [ |
127 | | - "error", |
128 | | - "never" |
129 | | - ], |
| 125 | + "one-var": ["error", "never"], |
130 | 126 | "prefer-arrow/prefer-arrow-functions": "off", |
131 | 127 | "prefer-const": "error", |
132 | | - "radix": "error", |
| 128 | + radix: "error", |
133 | 129 | "spaced-comment": "off", |
134 | 130 | "use-isnan": "error", |
135 | | - "valid-typeof": "off" |
136 | | - } |
137 | | -} |
| 131 | + "valid-typeof": "off", |
| 132 | + }, |
| 133 | +}]; |
0 commit comments