|
1 |
| -import { defineConfig, globalIgnores } from 'eslint/config' |
2 |
| -import tsParser from '@typescript-eslint/parser' |
3 |
| -import globals from 'globals' |
4 |
| -import path from 'node:path' |
5 |
| -import { fileURLToPath } from 'node:url' |
6 |
| -import js from '@eslint/js' |
7 |
| -import { FlatCompat } from '@eslint/eslintrc' |
| 1 | +import eslintJS from "@eslint/js" |
| 2 | +import tsEslint from "typescript-eslint" |
8 | 3 |
|
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 defineConfig([ |
18 |
| - globalIgnores([ |
19 |
| - '**/rs', |
20 |
| - '**/out', |
21 |
| - '**/pkg', |
22 |
| - '**/dist', |
23 |
| - '**/*.d.ts', |
24 |
| - 'src/test/**/*', |
25 |
| - 'src/wasm/**/*', |
26 |
| - 'src/assets/**/*', |
27 |
| - '__mocks__/vscode.ts', |
28 |
| - ]), |
29 |
| - { |
30 |
| - extends: compat.extends('@cnblogs/typescript'), |
31 |
| - |
32 |
| - languageOptions: { |
33 |
| - parser: tsParser, |
34 |
| - ecmaVersion: 6, |
35 |
| - sourceType: 'module', |
36 |
| - |
37 |
| - parserOptions: { |
38 |
| - project: ['./tsconfig.json', './ui/tsconfig.json', './test/tsconfig.json'], |
39 |
| - }, |
40 |
| - }, |
41 |
| - |
42 |
| - rules: { |
43 |
| - 'prettier/prettier': [ |
44 |
| - 'error', |
45 |
| - { |
46 |
| - endOfLine: 'auto', |
47 |
| - }, |
48 |
| - ], |
49 |
| - |
50 |
| - '@typescript-eslint/strict-boolean-expressions': [ |
51 |
| - 'warn', |
52 |
| - { |
53 |
| - allowString: false, |
54 |
| - allowNumber: false, |
55 |
| - allowNullableObject: false, |
56 |
| - allowNullableBoolean: false, |
57 |
| - }, |
58 |
| - ], |
| 4 | +export default tsEslint.config({ |
| 5 | + files: ["**/*.ts"], |
| 6 | + ignores: [ |
| 7 | + "**/rs", |
| 8 | + "**/out", |
| 9 | + "**/pkg", |
| 10 | + "**/dist", |
| 11 | + "**/*.d.ts", |
| 12 | + "src/test/**/*", |
| 13 | + "src/wasm/**/*", |
| 14 | + "src/assets/**/*", |
| 15 | + "__mocks__/vscode.ts", |
| 16 | + ], |
| 17 | + languageOptions: { |
| 18 | + parserOptions: { |
| 19 | + project: true, |
| 20 | + tsconfigRootDir: import.meta.dirname, |
59 | 21 | },
|
60 | 22 | },
|
61 |
| - { |
62 |
| - files: ['**/*.config.js'], |
63 |
| - |
64 |
| - languageOptions: { |
65 |
| - globals: { |
66 |
| - ...globals.node, |
| 23 | + extends: [ |
| 24 | + eslintJS.configs.recommended, |
| 25 | + ...tsEslint.configs.recommended, |
| 26 | + ...tsEslint.configs.stylistic, |
| 27 | + ], |
| 28 | + rules: { |
| 29 | + "@typescript-eslint/explicit-member-accessibility": [ |
| 30 | + "off", |
| 31 | + { |
| 32 | + accessibility: "explicit", |
67 | 33 | },
|
68 |
| - }, |
| 34 | + ], |
| 35 | + "arrow-parens": ["off", "always"], |
| 36 | + "import/order": "off", |
| 37 | + "@typescript-eslint/member-ordering": "off", |
| 38 | + "no-underscore-dangle": "off", |
| 39 | + "@typescript-eslint/naming-convention": "off", |
| 40 | + "jsdoc/newline-after-description": 0, |
| 41 | + "@typescript-eslint/consistent-indexed-object-style": "off", |
| 42 | + "@typescript-eslint/array-type": "off", |
| 43 | + "no-extra-boolean-cast": "off", |
| 44 | + "@typescript-eslint/no-empty-function": "off", |
| 45 | + "@typescript-eslint/no-explicit-any": "off", |
| 46 | + "@typescript-eslint/no-inferrable-types": "off", |
| 47 | + "@typescript-eslint/no-unused-vars": "off", |
| 48 | + "@typescript-eslint/ban-ts-comment": "off", |
| 49 | + "no-case-declarations": "off", |
| 50 | + "no-prototype-builtins": "off", |
| 51 | + "@typescript-eslint/consistent-type-definitions": "off", |
| 52 | + "@typescript-eslint/adjacent-overload-signatures": "off", |
69 | 53 | },
|
70 |
| -]) |
| 54 | +}) |
0 commit comments