-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
188 lines (188 loc) · 4.69 KB
/
.eslintrc.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:react/recommended',
'airbnb',
'airbnb/hooks',
'react-app',
'react-app/jest',
'airbnb-typescript',
'prettier',
'plugin:react/jsx-runtime',
'plugin:storybook/recommended',
],
parserOptions: {
project: ['./tsconfig.json', './tsconfig.local.json'],
},
plugins: [
'promise',
'@typescript-eslint',
'import',
'simple-import-sort',
'testing-library',
'react',
],
env: {
node: true,
jest: true,
},
globals: {
__DEV__: 'readonly',
__TEST__: 'readonly',
__PROD__: 'readonly',
$: 'writable',
},
rules: {
'jsx-a11y/label-has-associated-control': [
'error',
{
controlComponents: ['Switch.Root'],
},
],
'linebreak-style': ['error', 'unix'],
'no-var': ['error'],
'no-mixed-spaces-and-tabs': ['error'],
'brace-style': ['error'],
'spaced-comment': 'warn',
'no-trailing-spaces': 'warn',
'key-spacing': 'error',
'max-len': 'off',
'no-plusplus': 'off',
'@typescript-eslint/no-unsafe-assignment': 'error',
'@typescript-eslint/no-unsafe-call': 'error',
'@typescript-eslint/no-unsafe-argument': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'object-curly-spacing': ['error', 'always'],
'eol-last': 'error',
'unicode-bom': 'error',
'react/react-in-jsx-scope': 'off',
'padded-blocks': ['warn', 'never'],
'jsx-a11y/control-has-associated-label': 'off',
'no-unused-vars': [
'warn',
{
args: 'after-used',
ignoreRestSiblings: true,
argsIgnorePattern: '^(_|(args|props|event|e)$)',
varsIgnorePattern: '^_',
},
],
'no-multiple-empty-lines': 'warn',
'no-restricted-imports': [
'error',
{
patterns: ['components/examples/*', 'components/display/Glyph', 'enzyme'],
},
],
'no-restricted-globals': ['error', 'location'],
'no-throw-literal': 'error',
camelcase: [
'error',
{
allow: ['data-testid'],
},
],
eqeqeq: ['error', 'smart'],
'arrow-body-style': 'off',
'function-call-argument-newline': 'off',
'lines-between-class-members': 'off',
'@typescript-eslint/lines-between-class-members': 'off',
'prefer-arrow-callback': [
'error',
{
allowNamedFunctions: true,
allowUnboundThis: false,
},
],
'sort-imports': 'off',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'import/prefer-default-export': 'off',
'import/no-default-export': 'off',
'simple-import-sort/imports': [
'error',
{
groups: [
['^\\u0000'],
['^@?\\w'],
['^components/'],
['^models/'],
['^util/'],
['^\\.'],
['^\\u0000.*\\.s?css$'],
],
},
],
'simple-import-sort/exports': 'error',
'testing-library/consistent-data-testid': [
'error',
{
testIdPattern: '([a-z][a-z\\-]*)+[a-z]',
testIdAttribute: ['data-testid'],
},
],
'@typescript-eslint/consistent-type-assertions': [
'error',
{
assertionStyle: 'as',
objectLiteralTypeAssertions: 'allow',
},
],
},
overrides: [
{
files: ['*.spec.*', '*.test.*'],
rules: {
'@typescript-eslint/no-floating-promises': ['error'],
},
},
{
files: ['*.stories.*'],
rules: {
'import/no-extraneous-dependencies': 'off',
'react/jsx-props-no-spreading': 'off',
'react/function-component-definition': 'off',
'no-console': 'off',
},
},
{
files: ['*.tsx', '*.ts'],
rules: {
'consistent-return': 'off',
'react/jsx-props-no-spreading': 'off',
'react/require-default-props': 'off',
'react/destructuring-assignment': 'off',
'no-unused-vars': 'off',
'class-methods-use-this': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'after-used',
ignoreRestSiblings: true,
argsIgnorePattern: '^(_|(args|props|event|e)$)',
varsIgnorePattern: '^_',
},
],
semi: 'off',
'@typescript-eslint/semi': ['error'],
'react/self-closing-comp': 'warn',
},
},
{
files: ['*.js'],
rules: {
'no-unused-vars': [
'error',
{
args: 'after-used',
ignoreRestSiblings: true,
argsIgnorePattern: '^(_|(args|props|event|e)$)',
varsIgnorePattern: '^_',
},
],
},
},
],
};