|
1 | | - 'use strict' |
| 1 | +'use strict' |
2 | 2 |
|
3 | | - import stylistic from '@stylistic/eslint-plugin' |
4 | | - import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' |
5 | | - import jest from 'eslint-plugin-jest' |
6 | | - import love from 'eslint-config-love' |
| 3 | +import { defineConfig, globalIgnores } from 'eslint/config' |
| 4 | +import stylistic from '@stylistic/eslint-plugin' |
| 5 | +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' |
| 6 | +import jest from 'eslint-plugin-jest' |
| 7 | +import love from 'eslint-config-love' |
7 | 8 |
|
8 | | - export default [ |
9 | | - { |
10 | | - ignores: ['dist', '**/*.js'] |
11 | | - }, |
12 | | - // Stylistic |
13 | | - { |
14 | | - plugins: { |
15 | | - '@stylistic': stylistic |
16 | | - }, |
17 | | - rules: { |
18 | | - '@stylistic/indent': ['error', 4], |
19 | | - '@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }], |
20 | | - '@stylistic/space-before-function-paren': 'off', |
21 | | - '@stylistic/no-unmodified-loop-condition': 'off' |
22 | | - } |
23 | | - }, |
24 | | - // eslint-config-love |
25 | | - { |
26 | | - ...love |
| 9 | + |
| 10 | +export default defineConfig([ |
| 11 | + globalIgnores(['dist/', '**/*.js']), |
| 12 | + { |
| 13 | + files: ['**/*.ts'] |
| 14 | + }, |
| 15 | + // Stylistic |
| 16 | + { |
| 17 | + plugins: { |
| 18 | + '@stylistic': stylistic |
27 | 19 | }, |
28 | | - // Jest |
29 | | - { |
30 | | - files: ['test/**/*.test.ts', 'tests/**/*.test.ts', 'test/**/*.spec.ts', 'tests/**/*.spec.ts'], |
31 | | - ...jest.configs['flat/recommended'], |
32 | | - rules: { |
33 | | - ...jest.configs['flat/recommended'].rules, |
34 | | - ...jest.configs['flat/style'].rules |
35 | | - } |
| 20 | + rules: { |
| 21 | + '@stylistic/indent': ['error', 4], |
| 22 | + '@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }], |
| 23 | + '@stylistic/space-before-function-paren': 'off', |
| 24 | + '@stylistic/no-unmodified-loop-condition': 'off', |
| 25 | + '@typescript-eslint/no-magic-numbers': 'off' |
| 26 | + } |
| 27 | + }, |
| 28 | + // eslint-config-love |
| 29 | + { |
| 30 | + ...love |
| 31 | + }, |
| 32 | + // Jest |
| 33 | + { |
| 34 | + files: ['test/**/*.test.ts', 'tests/**/*.test.ts', 'test/**/*.spec.ts', 'tests/**/*.spec.ts'], |
| 35 | + ...jest.configs['flat/recommended'], |
| 36 | + rules: { |
| 37 | + ...jest.configs['flat/recommended'].rules, |
| 38 | + ...jest.configs['flat/style'].rules |
| 39 | + } |
| 40 | + }, |
| 41 | + // Prettier |
| 42 | + eslintPluginPrettierRecommended, |
| 43 | + // Custom |
| 44 | + { |
| 45 | + rules: { |
| 46 | + 'max-nested-callbacks': 'off', |
| 47 | + 'max-lines': 'off' |
36 | 48 | }, |
37 | | - // Prettier |
38 | | - eslintPluginPrettierRecommended, |
39 | | - // Custom |
40 | | - { |
41 | | - rules:{ |
42 | | - 'max-nested-callbacks': 'off', |
43 | | - 'max-lines': 'off' |
44 | | - }, |
45 | | - files: ['tests/**.test.ts'] |
| 49 | + files: ['tests/**.test.ts'] |
| 50 | + }, |
| 51 | + { |
| 52 | + files: ['**/*.ts'], |
| 53 | + rules: { |
| 54 | + '@typescript-eslint/no-magic-numbers': 'off' |
46 | 55 | } |
47 | | - ] |
| 56 | + } |
| 57 | +]) |
0 commit comments