-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
87 lines (82 loc) · 2.96 KB
/
eslint.config.js
File metadata and controls
87 lines (82 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import js from '@eslint/js';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import reactPlugin from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import importX, { createNodeResolver } from 'eslint-plugin-import-x';
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import prettier from 'eslint-plugin-prettier/recommended';
import testingLibrary from 'eslint-plugin-testing-library';
import jestDom from 'eslint-plugin-jest-dom';
import vitest from '@vitest/eslint-plugin';
export default [
// Global ignores
{ ignores: ['node_modules/', 'public/mockServiceWorker.js', 'generators/', 'dist/'] },
// Base JS rules
js.configs.recommended,
// TypeScript + React files
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsParser,
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
globals: {
...globals.browser,
...globals.node,
...globals.es2021,
},
},
settings: {
react: { version: 'detect' },
'import-x/resolver-next': [createTypeScriptImportResolver(), createNodeResolver()],
},
plugins: {
'@typescript-eslint': tsPlugin,
react: reactPlugin,
'react-hooks': reactHooks,
'import-x': importX,
'jsx-a11y': jsxA11y,
'testing-library': testingLibrary,
'jest-dom': jestDom,
vitest,
},
rules: {
...tsPlugin.configs.recommended.rules,
...reactPlugin.configs.flat.recommended.rules,
...reactHooks.configs['recommended-latest'].rules,
...importX.configs.recommended.rules,
...importX.configs.typescript.rules,
...jsxA11y.flatConfigs.recommended.rules,
...testingLibrary.configs['flat/react'].rules,
...jestDom.configs['flat/recommended'].rules,
...vitest.configs.recommended.rules,
// Custom overrides
'import-x/no-cycle': 'error',
'linebreak-style': ['error', 'unix'],
'react/prop-types': 'off',
'import-x/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object'],
'newlines-between': 'always',
alphabetize: { order: 'asc', caseInsensitive: true },
},
],
'import-x/default': 'off',
'import-x/no-named-as-default-member': 'off',
'import-x/no-named-as-default': 'off',
'react/react-in-jsx-scope': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
},
},
// Prettier must be last
prettier,
];