-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
117 lines (116 loc) · 4.53 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
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
114
115
116
117
import { default as eslint } from '@eslint/js';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import reactPlugin from 'eslint-plugin-react';
import globals from 'globals';
import tseslint from 'typescript-eslint';
export default tseslint.config(
eslint.configs.recommended,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
reactPlugin.configs.flat.all,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
reactPlugin.configs.flat['jsx-runtime'],
...tseslint.configs.stylisticTypeChecked,
...tseslint.configs.strictTypeChecked,
eslintPluginPrettierRecommended,
{
ignores: [
'node_modules/',
'dist/',
'build/',
'storybook-static/',
'coverage/',
'scripts/',
],
},
{
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
languageOptions: {
globals: {
...globals.browser,
},
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'react/destructuring-assignment': 'off',
'react/function-component-definition': 'off',
'react/prop-types': 'off',
'react/no-unused-prop-types': 'warn',
'react/jsx-max-depth': 'warn',
'react/no-array-index-key': 'warn',
'react/jsx-filename-extension': [
'error',
{ extensions: ['.tsx', '.ts'] },
],
'react/jsx-props-no-spreading': [
'warn',
{
html: 'ignore',
},
],
'react/jsx-no-bind': 'warn',
'react/require-default-props': 'off',
'react/jsx-no-literals': 'off',
'react/forbid-component-props': 'off',
'react/no-multi-comp': 'off',
'react/button-has-type': 'warn',
'react/hook-use-state': 'warn',
'react/jsx-no-useless-fragment': 'warn',
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/unbound-method': 'warn',
'@typescript-eslint/no-empty-object-type': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/prefer-find': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'warn',
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowNumber: true,
},
],
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/no-duplicate-type-constituents': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/prefer-function-type': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/no-confusing-void-expression': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unnecessary-condition': 'warn',
'@typescript-eslint/no-unnecessary-type-parameters': 'warn',
},
},
{
files: ['**/*.stories.tsx', '**/*.test.ts', '**/*.test.tsx'],
rules: {
'react/jsx-props-no-spreading': [
'warn',
{
html: 'ignore',
},
],
'react/jsx-no-bind': 'warn',
'react/button-has-type': 'warn',
},
},
);