|
1 | | -import eslintPlugin from '@typescript-eslint/eslint-plugin' |
2 | | -import eslintParser from '@typescript-eslint/parser' |
3 | | -import importPlugin from 'eslint-plugin-import' |
| 1 | +import eslint from "@eslint/js" |
| 2 | +import globals from "globals" |
| 3 | +import typescriptEslint from "typescript-eslint" |
| 4 | +import stylisticJsPlugin from "@stylistic/eslint-plugin-js" |
4 | 5 |
|
5 | | -export default [ |
| 6 | +export default typescriptEslint.config( |
| 7 | + { ignores: ["**/*.d.ts", "**/coverage", "**/dist"] }, |
6 | 8 | { |
7 | | - files: [ '**/*.{js,ts}' ], // Apply to JavaScript and TypeScript files |
8 | | - ignores: [ 'node_modules', 'dist' ], // Replace .eslintignore contents |
| 9 | + extends: [ |
| 10 | + eslint.configs.recommended, |
| 11 | + ...typescriptEslint.configs.recommended, |
| 12 | + ], |
| 13 | + files: ["**/*.{ts}"], |
9 | 14 | languageOptions: { |
10 | | - ecmaVersion: 2021, |
11 | | - sourceType: 'module', |
12 | | - parser: eslintParser, |
13 | | - }, |
14 | | - plugins: { |
15 | | - '@typescript-eslint': eslintPlugin, |
16 | | - import: importPlugin, |
17 | | - }, |
18 | | - settings: { |
19 | | - 'import/resolver': { |
20 | | - typescript: { |
21 | | - // Resolve using tsconfig.json |
22 | | - project: './tsconfig.json', |
23 | | - }, |
| 15 | + ecmaVersion: "latest", |
| 16 | + sourceType: "module", |
| 17 | + globals: globals.browser, |
| 18 | + parserOptions: { |
| 19 | + parser: typescriptEslint.parser, |
24 | 20 | }, |
25 | 21 | }, |
26 | 22 | rules: { |
27 | | - '@typescript-eslint/no-inferrable-types': 'off', |
28 | | - '@typescript-eslint/explicit-function-return-type': 'off', |
29 | | - '@typescript-eslint/no-empty-interface': 'error', |
30 | | - '@typescript-eslint/no-explicit-any': 'warn', |
31 | | - '@typescript-eslint/explicit-module-boundary-types': 'error', |
32 | | - '@typescript-eslint/no-unused-vars': [ |
33 | | - 'error', |
34 | | - { |
35 | | - argsIgnorePattern: '^_', |
36 | | - varsIgnorePattern: '^_', |
37 | | - } |
38 | | - ], |
39 | | - eqeqeq: 'error', |
40 | | - camelcase: 'error', |
41 | | - 'no-console': 'error', |
42 | | - 'no-lonely-if': 'error', |
43 | | - 'comma-dangle': [ |
44 | | - 'error', |
45 | | - { |
46 | | - arrays: 'never', |
47 | | - objects: 'always-multiline', |
48 | | - imports: 'always-multiline', |
49 | | - exports: 'always-multiline', |
50 | | - functions: 'never', |
51 | | - } |
52 | | - ], |
53 | | - indent: [ 'error', 4, { SwitchCase: 1 } ], |
54 | | - 'no-tabs': 'error', |
55 | | - 'object-curly-spacing': [ 'error', 'always' ], |
56 | | - 'array-bracket-spacing': [ 'error', 'always' ], |
57 | | - curly: [ 'error', 'all' ], |
58 | | - 'template-curly-spacing': 'error', |
59 | | - 'no-trailing-spaces': 'error', |
60 | | - 'space-before-blocks': 'error', |
61 | | - semi: [ 'error', 'never' ], |
62 | | - quotes: [ 'error', 'single', { avoidEscape: true } ], |
63 | | - 'object-curly-newline': [ |
64 | | - 'error', |
65 | | - { |
66 | | - multiline: true, |
67 | | - minProperties: 2, |
68 | | - consistent: true, |
69 | | - } |
70 | | - ], |
71 | | - 'object-property-newline': [ |
72 | | - 'error', |
73 | | - { |
74 | | - allowAllPropertiesOnSameLine: true, |
75 | | - } |
76 | | - ], |
77 | | - 'object-shorthand': 'error', |
78 | | - 'no-param-reassign': [ 'error', { props: false } ], |
79 | | - 'no-extra-parens': 'error', |
80 | | - 'no-return-await': 'error', |
81 | | - 'no-self-compare': 'error', |
82 | | - 'no-template-curly-in-string': 'error', |
83 | | - 'no-throw-literal': 'error', |
84 | | - 'no-undef-init': 'error', |
85 | | - 'no-unmodified-loop-condition': 'error', |
86 | | - 'no-unneeded-ternary': 'error', |
87 | | - 'no-unreachable-loop': 'error', |
88 | | - 'no-unsafe-optional-chaining': 'error', |
89 | | - 'no-unused-expressions': 'error', |
90 | | - 'no-use-before-define': [ |
91 | | - 'error', |
92 | | - { |
93 | | - functions: false, classes: true, variables: true, |
94 | | - } |
95 | | - ], |
96 | | - 'no-useless-backreference': 'error', |
97 | | - 'no-useless-call': 'error', |
98 | | - 'no-useless-computed-key': 'error', |
99 | | - 'no-useless-concat': 'error', |
100 | | - 'no-useless-constructor': 'error', |
101 | | - 'no-useless-rename': 'error', |
102 | | - 'no-useless-return': 'error', |
103 | | - 'no-var': 'error', |
104 | | - 'nonblock-statement-body-position': 'error', |
105 | | - 'one-var-declaration-per-line': 'error', |
106 | | - 'prefer-arrow-callback': 'error', |
107 | | - 'prefer-const': 'error', |
108 | | - 'prefer-exponentiation-operator': 'error', |
109 | | - 'prefer-numeric-literals': 'error', |
110 | | - 'prefer-object-spread': 'error', |
111 | | - 'prefer-promise-reject-errors': 'error', |
112 | | - 'prefer-template': 'error', |
113 | | - 'prefer-rest-params': 'error', |
114 | | - 'rest-spread-spacing': 'error', |
115 | | - 'require-atomic-updates': 'error', |
116 | | - 'require-await': 'error', |
117 | | - 'import/order': [ |
118 | | - 'error', |
119 | | - { |
120 | | - groups: [ |
121 | | - 'builtin', |
122 | | - 'external', |
123 | | - 'internal', |
124 | | - 'parent', |
125 | | - 'sibling', |
126 | | - 'index' |
127 | | - ], |
128 | | - alphabetize: { |
129 | | - order: 'asc', |
130 | | - caseInsensitive: true, |
131 | | - }, |
132 | | - } |
133 | | - ], |
| 23 | + "@stylistic/js/semi": ["error", "never"], |
| 24 | + "@stylistic/js/block-spacing": ["error", "always"], |
| 25 | + "@stylistic/js/comma-dangle": ["error", { |
| 26 | + "arrays": "never", |
| 27 | + "objects": "always-multiline", |
| 28 | + "imports": "always-multiline", |
| 29 | + "exports": "always-multiline", |
| 30 | + "functions": "never", |
| 31 | + }], |
| 32 | + "@stylistic/js/indent": ["error", 4, { SwitchCase: 1 }], |
| 33 | + |
| 34 | + // Spacing rules |
| 35 | + "@stylistic/js/object-curly-spacing": ["error", "always"], |
| 36 | + "@stylistic/js/array-bracket-spacing": ["error", "never"], |
| 37 | + "@stylistic/js/space-in-parens": ["error", "never"], |
| 38 | + "@stylistic/js/space-infix-ops": ["error"], |
| 39 | + |
| 40 | + // Line rules |
| 41 | + "@stylistic/js/eol-last": ["error", "always"], |
| 42 | + "@stylistic/js/no-trailing-spaces": ["error"], |
| 43 | + "@stylistic/js/max-len": ["error", { "code": 255 }], |
| 44 | + |
| 45 | + // Other formatting rules |
| 46 | + "@stylistic/js/quotes": ["error", "single"], |
| 47 | + "@stylistic/js/brace-style": ["error", "1tbs"], |
| 48 | + "@stylistic/js/arrow-spacing": ["error", { "before": true, "after": true }], |
| 49 | + "@stylistic/js/keyword-spacing": ["error", { "before": true, "after": true }], |
| 50 | + }, |
| 51 | + plugins: { |
| 52 | + "@stylistic/js": stylisticJsPlugin, // Correct, explicit key-value entry. |
134 | 53 | }, |
135 | | - } |
136 | | -] |
| 54 | + }, |
| 55 | +) |
0 commit comments