-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy patheslint.config.mjs
113 lines (111 loc) · 3.27 KB
/
eslint.config.mjs
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import tseslint from 'typescript-eslint';
import eslint from '@eslint/js';
import storybook from 'eslint-plugin-storybook';
import reacthooks from 'eslint-plugin-react-hooks';
import globals from 'globals';
import reactrefresh from 'eslint-plugin-react-refresh';
import react from 'eslint-plugin-react';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import json from '@eslint/json';
const noUnusedVars = [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: true,
},
];
export default [
{
...json.configs.recommended,
files: ['**/*.json'],
language: 'json/jsonc',
rules: {
'json/no-duplicate-keys': 'error',
},
},
...[eslint.configs.recommended, ...tseslint.configs.recommended].map((conf) => ({
...conf,
files: ['apis/**/{src,test}/**/*.{ts,js}', 'idea/**/src/**/*.{ts,js}', 'tools/**/src/**/*.{ts,js}'],
ignores: ['apis/gear/src/types/lookup.ts', 'idea/gear/frontend/**'],
})),
{
files: ['apis/**/{src,test}/**/*.{ts,js}', 'idea/**/src/**/*.{ts,js}', 'tools/**/src/**/*.{ts,js}'],
ignores: ['apis/gear/src/types/lookup.ts', 'idea/gear/frontend/**'],
rules: {
'@typescript-eslint/no-unused-vars': noUnusedVars,
'@typescript-eslint/no-explicit-any': 'off',
'prefer-rest-params': 'off',
'@typescript-eslint/no-empty-object-type': ['error', { allowInterfaces: 'with-single-extends' }],
},
},
...[reactrefresh.configs.recommended, ...tseslint.configs.recommended].map((conf) => ({
...conf,
files: ['utils/**/src/**/*.{ts,js,tsx,jsx}'],
})),
{
files: ['utils/**/src/**/*.{ts,js,tsx,jsx}'],
plugins: {
storybook,
'react-hooks': reacthooks,
},
languageOptions: {
globals: {
...globals.browser,
...globals.es2020,
},
},
rules: {
'react-refresh/only-export-components': [
'warn',
{
allowConstantExport: true,
},
],
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true,
},
],
},
},
...[
eslint.configs.recommended,
...tseslint.configs.recommended,
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
jsxA11y.flatConfigs.recommended,
].map((conf) => ({ ...conf, files: ['idea/gear/frontend/src/**/*.{ts,js,tsx,jsx}'] })),
{
files: ['idea/gear/frontend/src/**/*.{ts,js,tsx,jsx}'],
plugins: {
'react-hooks': reacthooks,
},
languageOptions: {
ecmaVersion: 'latest',
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'react/display-name': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'no-shadow': 'error',
'no-shadow-restricted-names': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'react-hooks/exhaustive-deps': 'error',
'@typescript-eslint/no-unused-vars': noUnusedVars,
},
},
];