|
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 | | - "@typescript-eslint/class-name-casing": "error", |
24 | 43 | "@typescript-eslint/consistent-type-assertions": "error", |
25 | 44 | "@typescript-eslint/interface-name-prefix": "off", |
26 | | - "@typescript-eslint/member-delimiter-style": [ |
27 | | - "error", |
28 | | - { |
29 | | - "multiline": { |
30 | | - "delimiter": "semi", |
31 | | - "requireLast": true |
32 | | - }, |
33 | | - "singleline": { |
34 | | - "delimiter": "semi", |
35 | | - "requireLast": true |
36 | | - } |
37 | | - } |
38 | | - ], |
| 45 | + |
39 | 46 | "@typescript-eslint/no-misused-promises": "off", |
40 | 47 | "@typescript-eslint/no-empty-function": "error", |
41 | 48 | "@typescript-eslint/no-empty-interface": "error", |
|
48 | 55 | "@typescript-eslint/prefer-for-of": "error", |
49 | 56 | "@typescript-eslint/prefer-function-type": "error", |
50 | 57 | "@typescript-eslint/prefer-namespace-keyword": "error", |
51 | | - "@typescript-eslint/unbound-method": "off", |
52 | | - "@typescript-eslint/quotes": [ |
53 | | - "error", |
54 | | - "single", |
55 | | - { |
56 | | - "avoidEscape": true |
57 | | - } |
58 | | - ], |
59 | | - "@typescript-eslint/semi": [ |
60 | | - "error", |
61 | | - "always", |
62 | | - { |
63 | | - "omitLastInOneLineBlock": true |
64 | | - } |
65 | | - ], |
| 58 | + "@typescript-eslint/unbound-method": "off", |
| 59 | + |
| 60 | + "quotes": ["error", "single", { |
| 61 | + avoidEscape: true, |
| 62 | + }], |
| 63 | + |
| 64 | + "semi": ["error", "always", { |
| 65 | + omitLastInOneLineBlock: true, |
| 66 | + }], |
| 67 | + |
66 | 68 | "@typescript-eslint/triple-slash-reference": "error", |
67 | 69 | "@typescript-eslint/unified-signatures": "error", |
68 | | - "arrow-parens": [ |
69 | | - "off", |
70 | | - "as-needed" |
71 | | - ], |
72 | | - "camelcase": "error", |
| 70 | + "arrow-parens": ["off", "as-needed"], |
| 71 | + camelcase: "error", |
73 | 72 | "comma-dangle": "off", |
74 | | - "complexity": "off", |
| 73 | + complexity: "off", |
75 | 74 | "constructor-super": "error", |
76 | 75 | "dot-notation": "error", |
77 | | - "eqeqeq": [ |
78 | | - "error", |
79 | | - "smart" |
80 | | - ], |
| 76 | + eqeqeq: ["error", "smart"], |
81 | 77 | "guard-for-in": "error", |
| 78 | + |
82 | 79 | "id-blacklist": [ |
83 | 80 | "error", |
84 | 81 | "any", |
|
88 | 85 | "string", |
89 | 86 | "Boolean", |
90 | 87 | "boolean", |
91 | | - "Undefined" |
| 88 | + "Undefined", |
92 | 89 | ], |
| 90 | + |
93 | 91 | "id-match": "error", |
94 | 92 | "max-classes-per-file": "off", |
95 | | - "max-len": [ |
96 | | - "error", |
97 | | - { |
98 | | - "code": 80 |
99 | | - } |
100 | | - ], |
| 93 | + |
| 94 | + "max-len": ["error", { |
| 95 | + code: 80, |
| 96 | + }], |
| 97 | + |
101 | 98 | "new-parens": "error", |
102 | 99 | "no-bitwise": "off", |
103 | 100 | "no-caller": "error", |
|
110 | 107 | "no-invalid-this": "off", |
111 | 108 | "no-multiple-empty-lines": "off", |
112 | 109 | "no-new-wrappers": "error", |
113 | | - "no-shadow": [ |
114 | | - "error", |
115 | | - { |
116 | | - "hoist": "all" |
117 | | - } |
118 | | - ], |
| 110 | + |
| 111 | + "no-shadow": ["error", { |
| 112 | + hoist: "all", |
| 113 | + }], |
| 114 | + |
119 | 115 | "no-throw-literal": "error", |
120 | 116 | "no-trailing-spaces": "error", |
121 | 117 | "no-undef-init": "error", |
|
125 | 121 | "no-unused-labels": "error", |
126 | 122 | "no-var": "error", |
127 | 123 | "object-shorthand": "error", |
128 | | - "one-var": [ |
129 | | - "error", |
130 | | - "never" |
131 | | - ], |
| 124 | + "one-var": ["error", "never"], |
132 | 125 | "prefer-arrow/prefer-arrow-functions": "off", |
133 | 126 | "prefer-const": "error", |
134 | | - "radix": "error", |
| 127 | + radix: "error", |
135 | 128 | "spaced-comment": "off", |
136 | 129 | "use-isnan": "error", |
137 | 130 | "valid-typeof": "off", |
138 | | - "semi": ["error", "always", { "omitLastInOneLineBlock": true }] |
139 | | - } |
140 | | -} |
| 131 | + |
| 132 | + semi: ["error", "always", { |
| 133 | + omitLastInOneLineBlock: true, |
| 134 | + }], |
| 135 | + }, |
| 136 | +}]; |
0 commit comments