|
1 |
| -import path from 'node:path'; |
2 |
| -import { fileURLToPath } from 'node:url'; |
3 |
| -import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'; |
4 |
| -import { FlatCompat } from '@eslint/eslintrc'; |
5 |
| -import js from '@eslint/js'; |
6 |
| -import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
7 |
| -import jsxA11Y from 'eslint-plugin-jsx-a11y'; |
8 |
| -import react from 'eslint-plugin-react'; |
9 |
| -import reactHooks from 'eslint-plugin-react-hooks'; |
10 |
| -import storybook from 'eslint-plugin-storybook'; |
11 |
| -import vitest from 'eslint-plugin-vitest'; |
12 |
| -import globals from 'globals'; |
| 1 | +import antfu from '@antfu/eslint-config'; |
| 2 | +import tailwindcss from 'eslint-plugin-tailwindcss'; |
13 | 3 |
|
14 |
| -const __filename = fileURLToPath(import.meta.url); |
15 |
| -const __dirname = path.dirname(__filename); |
16 |
| -const compat = new FlatCompat({ |
17 |
| - baseDirectory: __dirname, |
18 |
| - recommendedConfig: js.configs.recommended, |
19 |
| - allConfig: js.configs.all, |
20 |
| -}); |
21 |
| - |
22 |
| -export default [ |
| 4 | +export default antfu( |
23 | 5 | {
|
| 6 | + react: true, |
| 7 | + formatters: { |
| 8 | + css: true, |
| 9 | + html: true, |
| 10 | + markdown: 'prettier', |
| 11 | + }, |
| 12 | + stylistic: { |
| 13 | + semi: true, |
| 14 | + overrides: { |
| 15 | + 'semi': ['error', 'always'], |
| 16 | + 'semi-spacing': ['error', { after: true, before: false }], |
| 17 | + 'semi-style': ['error', 'last'], |
| 18 | + 'no-extra-semi': 'error', |
| 19 | + 'no-unexpected-multiline': 'error', |
| 20 | + 'no-unreachable': 'error', |
| 21 | + }, |
| 22 | + }, |
| 23 | + typescript: { |
| 24 | + overrides: { |
| 25 | + 'ts/consistent-type-definitions': ['error', 'type'], |
| 26 | + }, |
| 27 | + }, |
24 | 28 | ignores: [
|
25 | 29 | '**/node_modules/',
|
26 | 30 | '**/.next/',
|
27 | 31 | '**/build/',
|
28 | 32 | '**/coverage/',
|
29 | 33 | '**/.eslintrc.json',
|
30 | 34 | '**/next-env.d.ts',
|
31 |
| - 'test/setupTests.ts', |
32 | 35 | '**/*.config.js',
|
33 |
| - '**/*.config.mjs', |
34 |
| - '**/__mocks__', |
35 | 36 | '**/storybook-static/',
|
36 | 37 | 'public/mockServiceWorker.js',
|
37 |
| - '**/*.module.css.d.ts', |
38 |
| - '**/*.module.css.d.ts.map', |
39 | 38 | '**/vitest.config.mts',
|
40 | 39 | '**/vitest.setup.mts',
|
| 40 | + 'next.config.mjs', |
| 41 | + 'tsconfig.json', |
41 | 42 | ],
|
42 | 43 | },
|
43 |
| - ...fixupConfigRules( |
44 |
| - compat.extends( |
45 |
| - 'eslint:recommended', |
46 |
| - 'plugin:@typescript-eslint/recommended', |
47 |
| - 'plugin:@typescript-eslint/recommended-requiring-type-checking', |
48 |
| - 'standard-with-typescript', |
49 |
| - 'plugin:jsx-a11y/recommended', |
50 |
| - 'plugin:react/recommended', |
51 |
| - 'plugin:react/jsx-runtime', |
52 |
| - 'plugin:react-hooks/recommended', |
53 |
| - 'plugin:tailwindcss/recommended', |
54 |
| - 'prettier', |
55 |
| - ), |
56 |
| - ), |
57 |
| - { |
58 |
| - plugins: { |
59 |
| - '@typescript-eslint': fixupPluginRules(typescriptEslint), |
60 |
| - 'jsx-a11y': fixupPluginRules(jsxA11Y), |
61 |
| - react: fixupPluginRules(react), |
62 |
| - 'react-hooks': fixupPluginRules(reactHooks), |
63 |
| - storybook, |
64 |
| - vitest, |
65 |
| - }, |
66 |
| - |
67 |
| - languageOptions: { |
68 |
| - globals: { |
69 |
| - ...globals.browser, |
70 |
| - ...globals.node, |
71 |
| - }, |
72 |
| - |
73 |
| - ecmaVersion: 'latest', |
74 |
| - sourceType: 'module', |
75 |
| - |
76 |
| - parserOptions: { |
77 |
| - tsconfigRootDir: '.', |
78 |
| - project: ['./tsconfig.json', './tsconfig.storybook.json'], |
79 |
| - }, |
80 |
| - }, |
81 |
| - |
82 |
| - settings: { |
83 |
| - react: { |
84 |
| - version: 'detect', |
85 |
| - }, |
86 |
| - }, |
87 |
| - |
88 |
| - rules: { |
89 |
| - 'padding-line-between-statements': [ |
90 |
| - 'error', |
91 |
| - { |
92 |
| - blankLine: 'always', |
93 |
| - prev: '*', |
94 |
| - next: 'return', |
95 |
| - }, |
96 |
| - ], |
97 |
| - |
98 |
| - '@typescript-eslint/consistent-type-definitions': 'off', |
99 |
| - '@typescript-eslint/explicit-function-return-type': 'off', |
100 |
| - '@typescript-eslint/explicit-module-boundary-types': ['error'], |
101 |
| - |
102 |
| - '@typescript-eslint/no-misused-promises': [ |
103 |
| - 'error', |
104 |
| - { |
105 |
| - checksVoidReturn: false, |
106 |
| - }, |
107 |
| - ], |
108 |
| - |
109 |
| - '@typescript-eslint/no-unused-vars': [ |
110 |
| - 'error', |
111 |
| - { |
112 |
| - argsIgnorePattern: '^_', |
113 |
| - varsIgnorePattern: '^_', |
114 |
| - }, |
115 |
| - ], |
116 |
| - |
117 |
| - '@typescript-eslint/strict-boolean-expressions': [ |
118 |
| - 'error', |
119 |
| - { |
120 |
| - allowNullableObject: true, |
121 |
| - }, |
122 |
| - ], |
123 |
| - |
124 |
| - '@typescript-eslint/triple-slash-reference': [ |
125 |
| - 'error', |
126 |
| - { |
127 |
| - types: 'always', |
128 |
| - }, |
129 |
| - ], |
130 |
| - |
131 |
| - 'import/extensions': [ |
132 |
| - 'error', |
133 |
| - { |
134 |
| - ignorePackages: true, |
135 |
| - |
136 |
| - pattern: { |
137 |
| - js: 'never', |
138 |
| - jsx: 'never', |
139 |
| - ts: 'never', |
140 |
| - tsx: 'never', |
141 |
| - }, |
142 |
| - }, |
143 |
| - ], |
144 |
| - |
145 |
| - 'react/display-name': 'off', |
146 |
| - 'tailwindcss/classnames-order': 'error', |
147 |
| - }, |
148 |
| - }, |
149 | 44 | {
|
150 |
| - files: ['**/*.tsx'], |
151 |
| - |
152 | 45 | rules: {
|
153 |
| - 'react/prop-types': 'off', |
| 46 | + 'node/prefer-global/process': 'off', |
154 | 47 | },
|
155 | 48 | },
|
156 |
| -]; |
| 49 | + ...tailwindcss.configs['flat/recommended'], |
| 50 | +); |
0 commit comments