-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
175 lines (175 loc) · 6.23 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
module.exports = {
env: {
browser: true,
node: true
},
settings: {
react: {
version: 'detect'
},
'import/resolver': {
typescript: {},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
}
},
extends: [
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
'plugin:import/errors',
'plugin:react/jsx-runtime'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname
},
ignorePatterns: ['**/*.js'],
rules: {
'react/prop-types': 'off',
curly: [2, 'multi-line'],
'no-console': 'error',
'import/no-default-export': ['error'],
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/consistent-indexed-object-style': 'error',
'@typescript-eslint/consistent-type-assertions': [
'error',
{ assertionStyle: 'as' }
],
'@typescript-eslint/explicit-module-boundary-types': 'error',
'no-empty-function': 'off',
'@typescript-eslint/member-ordering': 'error',
'@typescript-eslint/method-signature-style': 'error',
'@typescript-eslint/no-base-to-string': 'error',
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
'@typescript-eslint/no-dynamic-delete': 'error',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-invalid-void-type': 'error',
'@typescript-eslint/no-meaningless-void-operator': 'error',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-literal-enum-member': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/prefer-ts-expect-error': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/typedef': 'error',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/dot-notation': 'error',
'@typescript-eslint/no-dupe-class-members': 'error',
'@typescript-eslint/no-duplicate-enum-values': 'error',
'@typescript-eslint/no-duplicate-imports': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-invalid-this': 'error',
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
'@typescript-eslint/no-loop-func': 'error',
'@typescript-eslint/no-loss-of-precision': 'error',
'@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/no-redundant-type-constituents': 'error',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-throw-literal': 'error',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/return-await': 'error',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': ['error', { fixToUnknown: true }],
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'no-unused-vars': 'off',
'no-await-in-loop': 'off',
'class-methods-use-this': 'off',
'lines-between-class-members': [
'error',
'always',
{ exceptAfterSingleLine: true }
],
'no-constructor-return': 'off',
'no-nested-ternary': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: ['class', 'function', 'block-like'],
next: ['class', 'function', 'block-like']
},
{
blankLine: 'always',
prev: ['multiline-expression'],
next: ['*']
},
{
blankLine: 'always',
prev: ['*'],
next: ['multiline-expression']
},
{
blankLine: 'always',
prev: ['import'],
next: ['class']
}
],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error'
},
overrides: [
/**
* -----------------------------------------------------
* STORYBOOK
* -----------------------------------------------------
*/
{
files: ['*.stories.ts', '*.stories.tsx'],
extends: ['plugin:storybook/recommended'],
rules: {
'@typescript-eslint/consistent-type-assertions': [
'error',
{
assertionStyle: 'as',
objectLiteralTypeAssertions: 'allow'
}
],
'import/no-default-export': ['off'],
'@typescript-eslint/explicit-module-boundary-types': 'off'
}
},
/**
* -----------------------------------------------------
* EXAMPLES AND SCRIPTS
* -----------------------------------------------------
*/
{
files: [
'./packages/**/**/examples/*.{ts,tsx}',
'./scripts/**/*.{ts,tsx}',
'*.config.{ts,tsx}'
],
rules: {
'import/no-default-export': ['off'],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'no-console': 'off'
}
}
]
};