|
1 |
| -const tsParser = require("@typescript-eslint/parser"); |
2 |
| -const typescriptEslint = require("@typescript-eslint/eslint-plugin"); |
3 |
| -const prettier = require("eslint-plugin-prettier"); |
4 |
| -const js = require("@eslint/js"); |
| 1 | +const tsParser = require('@typescript-eslint/parser'); |
| 2 | +const typescriptEslint = require('@typescript-eslint/eslint-plugin'); |
| 3 | +const prettier = require('eslint-plugin-prettier'); |
| 4 | +const js = require('@eslint/js'); |
5 | 5 |
|
6 |
| -const { |
7 |
| - FlatCompat, |
8 |
| -} = require("@eslint/eslintrc"); |
| 6 | +const { FlatCompat } = require('@eslint/eslintrc'); |
9 | 7 |
|
10 | 8 | const compat = new FlatCompat({
|
11 |
| - baseDirectory: __dirname, |
12 |
| - recommendedConfig: js.configs.recommended, |
13 |
| - allConfig: js.configs.all |
| 9 | + baseDirectory: __dirname, |
| 10 | + recommendedConfig: js.configs.recommended, |
| 11 | + allConfig: js.configs.all, |
14 | 12 | });
|
15 | 13 |
|
16 | 14 | module.exports = [
|
17 |
| - // Global ignores |
18 |
| - { |
19 |
| - ignores: [ |
20 |
| - "**/.github", |
21 |
| - "**/dist", |
22 |
| - "**/node_modules", |
23 |
| - "**/*.d.ts", |
24 |
| - "**/pnpm-lock.yaml", |
25 |
| - ] |
26 |
| - }, |
27 |
| - |
28 |
| - // JavaScript files |
29 |
| - { |
30 |
| - files: ["**/*.js", "**/*.cjs", "**/*.mjs"], |
31 |
| - ...js.configs.recommended, |
32 |
| - plugins: { |
33 |
| - prettier, |
34 |
| - }, |
35 |
| - rules: { |
36 |
| - "no-console": "off", |
37 |
| - "prefer-const": "off", |
38 |
| - } |
39 |
| - }, |
40 |
| - |
41 |
| - // TypeScript files |
42 |
| - { |
43 |
| - files: ["**/*.ts", "**/*.tsx"], |
44 |
| - ...compat.extends( |
45 |
| - "plugin:@typescript-eslint/recommended-type-checked", |
46 |
| - "plugin:@typescript-eslint/stylistic-type-checked", |
47 |
| - "prettier", |
48 |
| - )[0], |
| 15 | + // Global ignores |
| 16 | + { |
| 17 | + ignores: ['**/.github', '**/dist', '**/node_modules', '**/*.d.ts', '**/pnpm-lock.yaml'], |
| 18 | + }, |
49 | 19 |
|
50 |
| - languageOptions: { |
51 |
| - parser: tsParser, |
52 |
| - parserOptions: { |
53 |
| - project: ["./tsconfig.json"], |
54 |
| - tsconfigRootDir: __dirname, |
55 |
| - }, |
56 |
| - }, |
| 20 | + // JavaScript files |
| 21 | + { |
| 22 | + files: ['**/*.js', '**/*.cjs', '**/*.mjs'], |
| 23 | + ...js.configs.recommended, |
| 24 | + plugins: { |
| 25 | + prettier, |
| 26 | + }, |
| 27 | + rules: { |
| 28 | + 'no-console': 'off', |
| 29 | + 'prefer-const': 'off', |
| 30 | + }, |
| 31 | + }, |
57 | 32 |
|
58 |
| - plugins: { |
59 |
| - "@typescript-eslint": typescriptEslint, |
60 |
| - prettier, |
61 |
| - }, |
| 33 | + // TypeScript files |
| 34 | + { |
| 35 | + files: ['**/*.ts', '**/*.tsx'], |
| 36 | + ...compat.extends( |
| 37 | + 'plugin:@typescript-eslint/recommended-type-checked', |
| 38 | + 'plugin:@typescript-eslint/stylistic-type-checked', |
| 39 | + 'prettier' |
| 40 | + )[0], |
62 | 41 |
|
63 |
| - rules: { |
64 |
| - "@typescript-eslint/array-type": ["error", { |
65 |
| - default: "array-simple", |
66 |
| - }], |
| 42 | + languageOptions: { |
| 43 | + parser: tsParser, |
| 44 | + parserOptions: { |
| 45 | + project: ['./tsconfig.json'], |
| 46 | + tsconfigRootDir: __dirname, |
| 47 | + }, |
| 48 | + }, |
67 | 49 |
|
68 |
| - "@typescript-eslint/no-unused-vars": ["warn", { |
69 |
| - argsIgnorePattern: "^_", |
70 |
| - varsIgnorePattern: "^_", |
71 |
| - caughtErrorsIgnorePattern: "^_", |
72 |
| - ignoreRestSiblings: true, |
73 |
| - }], |
| 50 | + plugins: { |
| 51 | + '@typescript-eslint': typescriptEslint, |
| 52 | + prettier, |
| 53 | + }, |
74 | 54 |
|
75 |
| - "@typescript-eslint/no-shadow": ["error"], |
76 |
| - "no-console": "off", |
77 |
| - "@typescript-eslint/array-type": "off", |
78 |
| - "@typescript-eslint/ban-ts-comment": "off", |
79 |
| - "@typescript-eslint/class-literal-property-style": "off", |
80 |
| - "@typescript-eslint/consistent-indexed-object-style": "off", |
81 |
| - "@typescript-eslint/consistent-type-definitions": "off", |
82 |
| - "@typescript-eslint/dot-notation": "off", |
83 |
| - "@typescript-eslint/no-base-to-string": "off", |
84 |
| - "@typescript-eslint/no-empty-function": "off", |
85 |
| - "@typescript-eslint/no-floating-promises": "off", |
86 |
| - "@typescript-eslint/no-misused-promises": "off", |
87 |
| - "@typescript-eslint/no-redundant-type-constituents": "off", |
88 |
| - "@typescript-eslint/no-this-alias": "off", |
89 |
| - "@typescript-eslint/no-unsafe-argument": "off", |
90 |
| - "@typescript-eslint/no-unsafe-assignment": "off", |
91 |
| - "@typescript-eslint/no-unsafe-call": "off", |
92 |
| - "@typescript-eslint/no-unsafe-member-access": "off", |
93 |
| - "@typescript-eslint/no-unsafe-return": "off", |
94 |
| - "@typescript-eslint/prefer-nullish-coalescing": "off", |
95 |
| - "@typescript-eslint/prefer-optional-chain": "off", |
96 |
| - "@typescript-eslint/prefer-string-starts-ends-with": "off", |
97 |
| - "@typescript-eslint/require-await": "off", |
98 |
| - "@typescript-eslint/restrict-plus-operands": "off", |
99 |
| - "@typescript-eslint/restrict-template-expressions": "off", |
100 |
| - "@typescript-eslint/sort-type-constituents": "off", |
101 |
| - "@typescript-eslint/unbound-method": "off", |
102 |
| - "@typescript-eslint/no-explicit-any": "off", |
103 |
| - "@typescript-eslint/await-thenable": "off", |
104 |
| - "prefer-const": "off", |
105 |
| - }, |
106 |
| - } |
| 55 | + rules: { |
| 56 | + '@typescript-eslint/array-type': [ |
| 57 | + 'error', |
| 58 | + { |
| 59 | + default: 'array-simple', |
| 60 | + }, |
| 61 | + ], |
| 62 | + |
| 63 | + '@typescript-eslint/no-unused-vars': [ |
| 64 | + 'warn', |
| 65 | + { |
| 66 | + argsIgnorePattern: '^_', |
| 67 | + varsIgnorePattern: '^_', |
| 68 | + caughtErrorsIgnorePattern: '^_', |
| 69 | + ignoreRestSiblings: true, |
| 70 | + }, |
| 71 | + ], |
| 72 | + |
| 73 | + '@typescript-eslint/no-shadow': ['error'], |
| 74 | + 'no-console': 'off', |
| 75 | + '@typescript-eslint/array-type': 'off', |
| 76 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 77 | + '@typescript-eslint/class-literal-property-style': 'off', |
| 78 | + '@typescript-eslint/consistent-indexed-object-style': 'off', |
| 79 | + '@typescript-eslint/consistent-type-definitions': 'off', |
| 80 | + '@typescript-eslint/dot-notation': 'off', |
| 81 | + '@typescript-eslint/no-base-to-string': 'off', |
| 82 | + '@typescript-eslint/no-empty-function': 'off', |
| 83 | + '@typescript-eslint/no-floating-promises': 'off', |
| 84 | + '@typescript-eslint/no-misused-promises': 'off', |
| 85 | + '@typescript-eslint/no-redundant-type-constituents': 'off', |
| 86 | + '@typescript-eslint/no-this-alias': 'off', |
| 87 | + '@typescript-eslint/no-unsafe-argument': 'off', |
| 88 | + '@typescript-eslint/no-unsafe-assignment': 'off', |
| 89 | + '@typescript-eslint/no-unsafe-call': 'off', |
| 90 | + '@typescript-eslint/no-unsafe-member-access': 'off', |
| 91 | + '@typescript-eslint/no-unsafe-return': 'off', |
| 92 | + '@typescript-eslint/prefer-nullish-coalescing': 'off', |
| 93 | + '@typescript-eslint/prefer-optional-chain': 'off', |
| 94 | + '@typescript-eslint/prefer-string-starts-ends-with': 'off', |
| 95 | + '@typescript-eslint/require-await': 'off', |
| 96 | + '@typescript-eslint/restrict-plus-operands': 'off', |
| 97 | + '@typescript-eslint/restrict-template-expressions': 'off', |
| 98 | + '@typescript-eslint/sort-type-constituents': 'off', |
| 99 | + '@typescript-eslint/unbound-method': 'off', |
| 100 | + '@typescript-eslint/no-explicit-any': 'off', |
| 101 | + '@typescript-eslint/await-thenable': 'off', |
| 102 | + 'prefer-const': 'off', |
| 103 | + }, |
| 104 | + }, |
107 | 105 | ];
|
0 commit comments