-
Notifications
You must be signed in to change notification settings - Fork 7
/
.eslintrc.js
executable file
·199 lines (197 loc) · 6.38 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
189
190
191
192
193
194
195
196
197
198
199
module.exports = {
'env': {
'node': true,
'browser': true,
'es2021': true
},
'extends': [
'eslint:recommended',
'plugin:import/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:tailwindcss/recommended',
'plugin:@typescript-eslint/recommended',
'next/core-web-vitals'
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaFeatures': {'jsx': true},
'ecmaVersion': 2022,
'sourceType': 'module',
'tsconfigRootDir': __dirname,
'project': ['./tsconfig.json']
},
'plugins': [
'@typescript-eslint',
'react',
'tailwindcss',
'unused-imports',
'simple-import-sort',
'import'
],
'settings': {
'react': {'version': 'detect'},
'import/resolver': {'typescript': {}}
},
'rules': {
'import/default': 0,
'no-mixed-spaces-and-tabs': 2,
'react/prop-types': 0,
'no-async-promise-executor': 0,
'import/no-unresolved': 0, //Issue with package exports
'quotes': [2, 'single', {'avoidEscape': true}],
'object-curly-spacing': [2, 'never'],
'array-bracket-spacing': [2, 'never'],
'semi': 'error',
'no-else-return': ['error', {'allowElseIf': false}],
'eol-last': ['error', 'always'],
'import/no-named-as-default-member': 2,
'tailwindcss/no-custom-classname': 0,
'array-bracket-newline': ['error', {'multiline': true}],
'react/jsx-curly-brace-presence': ['error', {'props': 'always', 'children': 'always'}],
'react/jsx-first-prop-new-line': ['error', 'multiline'],
'react/jsx-max-props-per-line': ['error', {'maximum': {'single': 2, 'multi': 1}}],
'react/jsx-closing-tag-location': 2,
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn', {
'vars': 'all',
'varsIgnorePattern': '^_',
'args': 'after-used',
'argsIgnorePattern': '^_'
}
],
'simple-import-sort/imports': 2,
'simple-import-sort/exports': 2,
'import/first': 2,
'import/newline-after-import': 2,
'import/no-duplicates': 2,
'curly': ['error', 'all'],
'object-curly-newline': [
'error', {
'ObjectExpression': {'multiline': true, 'consistent': true},
'ObjectPattern': {'multiline': true, 'consistent': true},
'ImportDeclaration': 'never',
'ExportDeclaration': {'multiline': true, 'minProperties': 3}
}
],
'object-property-newline': ['error', {'allowAllPropertiesOnSameLine': true}],
'prefer-destructuring': ['error', {'array': true, 'object': true}, {'enforceForRenamedProperties': false}],
'@typescript-eslint/consistent-type-imports': [
2, {
'prefer': 'type-imports',
'disallowTypeAnnotations': true,
'fixStyle': 'separate-type-imports'
}
],
'no-multi-spaces': ['error', {ignoreEOLComments: false}],
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-unused-vars': 2,
'@typescript-eslint/array-type': ['error', {'default': 'array'}],
'@typescript-eslint/consistent-type-assertions': ['error', {'assertionStyle': 'as', 'objectLiteralTypeAssertions': 'never'}],
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/consistent-indexed-object-style': ['error', 'index-signature'],
'@typescript-eslint/naming-convention': [
'error',
{'selector': 'default', 'format': ['camelCase']},
{'selector': 'function', 'format': ['camelCase', 'PascalCase']},
{'selector': 'variableLike', 'format': ['camelCase', 'PascalCase', 'UPPER_CASE'], 'leadingUnderscore': 'allow'},
{'selector': 'variable', 'types': ['boolean'], 'format': ['PascalCase'], 'prefix': ['is', 'should', 'has', 'can', 'did', 'will', 'with']},
{
'selector': 'default',
'format': null,
'filter': {'regex': '^(0-9)$', 'match': false}
},
{
'selector': 'variableLike',
'filter': {'regex': '^(set)', 'match': true},
'format': ['camelCase'],
'prefix': ['set_']
},
{
'selector': 'variableLike',
'format': ['PascalCase'],
'filter': {'regex': '(Context)$|(ContextApp)$|^Component$', 'match': true}
},
{'selector': ['typeParameter', 'typeAlias'], 'format': ['PascalCase'], 'prefix': ['T']},
{'selector': 'interface', 'format': ['PascalCase'], 'prefix': ['I']},
{
'selector': ['default', 'variableLike', 'parameter'],
'format': null,
'filter': {'regex': '^(__html|_css)$', 'match': true}
}
],
'@typescript-eslint/no-misused-promises': ['error', {'checksConditionals': true, 'checksVoidReturn': false}],
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': [
'error', {
'allowComparingNullableBooleansToTrue': false,
'allowComparingNullableBooleansToFalse': false
}
],
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/type-annotation-spacing': [
'error', {
'before': true,
'after': true,
'overrides': {'colon': {'before': false, 'after': true}}
}
],
'brace-style': 'off',
'@typescript-eslint/brace-style': ['error', '1tbs'],
'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': ['error'],
'comma-spacing': 'off',
'@typescript-eslint/comma-spacing': ['error'],
'dot-notation': 'off',
'@typescript-eslint/dot-notation': ['error'],
'indent': 'off',
'@typescript-eslint/indent': ['error', 'tab']
},
overrides: [
{
files: ['*.{ts,tsx}'],
rules: {
'simple-import-sort/imports': [
'error',
{
groups: [
[
'^react',
'^next',
'^(ethers|ethcall)?\\w',
'^axios', '^swr',
'^tailwindcss', '^framer-motion', '^nprogress',
'^@?\\w',
'^(@yearn-finance/.*)?\\w',
'^(@common/.*)?\\w',
'^(@y.*)?\\w'
],
// Parent imports.
['^\\u0000', '^\\.\\.(?!/?$)', '^\\.\\./?$', '^\\./?$', '^\\.(?!/?$)', '^\\./(?=.*/)(?!/?$)'],
//Types imports.
[
'^node:.*\\u0000$',
'^(@yearn-finance)?\\w.*\\u0000$',
'^(@common)?\\w.*\\u0000$',
'^(@y.*)?\\w.*\\u0000$',
'^@?\\w.*\\u0000$',
'^[^.].*\\u0000$',
'^\\..*\\u0000$'
],
// Style imports.
['^.+\\.s?css$']
]
}
]
}
}
]
};