-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
86 lines (85 loc) · 2.24 KB
/
eslint.config.js
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
import js from '@eslint/js';
import stylisticJs from '@stylistic/eslint-plugin-js';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import perfectionist from 'eslint-plugin-perfectionist';
import prettier from 'eslint-plugin-prettier/recommended';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import globals from 'globals';
import ts from 'typescript-eslint';
export default ts.config(
{
ignores: ['.react-router/', 'build/'],
},
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
{
extends: [js.configs.recommended, perfectionist.configs['recommended-natural']],
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
languageOptions: {
globals: {
...globals.serviceworker,
...globals.browser,
...globals.node,
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
plugins: {
'@stylistic/js': stylisticJs,
},
rules: {
'@stylistic/js/lines-between-class-members': [
'error',
{
enforce: [
{ blankLine: 'always', next: '*', prev: '*' },
{ blankLine: 'never', next: 'field', prev: 'field' },
],
},
],
},
},
{
extends: [prettier],
files: ['**/*.js'],
},
{
extends: [
ts.configs.strictTypeChecked,
ts.configs.stylisticTypeChecked,
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
jsxA11y.flatConfigs.strict,
prettier,
],
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
'react-hooks': reactHooks,
},
rules: {
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }],
'react-hooks/exhaustive-deps': 'error',
'react-hooks/rules-of-hooks': 'error',
},
settings: {
react: {
version: 'detect',
},
},
},
);