-
Notifications
You must be signed in to change notification settings - Fork 5
/
.eslintrc.js
215 lines (215 loc) · 5.59 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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
module.exports = {
root: true,
env: {
node: true,
browser: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:unicorn/recommended',
'plugin:promise/recommended',
'plugin:sonarjs/recommended',
'plugin:import/warnings',
'plugin:regexp/recommended',
'plugin:etc/recommended',
'plugin:testing-library/dom',
'plugin:testing-library/react',
'plugin:prettier/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
project: 'tsconfig.json',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
warnOnUnsupportedTypeScriptVersion: false,
},
plugins: [
'react',
'react-hooks',
'unicorn',
'import',
'wix-editor',
'@typescript-eslint',
'prettier',
'simple-import-sort',
'sort-class-members',
'promise',
'sonarjs',
'etc',
'testing-library',
'@kyleshevlin',
'boundaries',
'only-warn',
],
ignorePatterns: ['@generated/**', '*.config.js', '.*rc.js'],
settings: {
react: {
createClass: 'createReactClass', // Regex for Component Factory to use,
// default to "createReactClass"
pragma: 'React', // Pragma to use, default to "React"
fragment: 'Fragment', // Fragment to use (may be a property of <pragma>), default to "Fragment"
version: 'detect', // React version. "detect" automatically picks the version you have installed.
},
'import/resolver': {
typescript: {},
node: {},
},
'boundaries/ignore': [
'**/*.spec.{ts,tsx}',
'**/testing/**',
'**/@generated/**',
'src/main.{ts,tsx}',
],
'boundaries/elements': [
{
type: 'common',
pattern: 'src/app_modules',
mode: 'folder',
},
{
type: 'components',
pattern: 'src/components',
mode: 'folder',
},
{
type: 'application',
pattern: 'src/application',
mode: 'folder',
},
{
type: 'api',
pattern: 'src/api',
mode: 'folder',
},
{
type: 'pages',
pattern: 'src/app',
mode: 'folder',
},
],
},
rules: {
// boundaries
'boundaries/element-types': [
1,
{
// Allow or disallow any dependency by default
default: 'disallow',
// Define a custom message for this rule
message: '${file.type} is not allowed to import ${dependency.type}',
rules: [
{
// In this type of files...
from: ['pages'],
// ...allow importing this type of elements
allow: ['application', 'components'],
},
{
from: ['api'],
allow: ['application'],
message: 'API can import only application interfaces',
},
],
},
],
'boundaries/no-unknown': 1,
// core
'consistent-return': [1, { treatUndefinedAsUnspecified: true }],
quotes: [1, 'single', { allowTemplateLiterals: true, avoidEscape: true }],
semi: [1, 'always'],
'max-lines': [1, { max: 300 }],
'max-params': [1, { max: 5 }],
'no-unneeded-ternary': [1],
// wix-editor
'wix-editor/no-instanceof-array': 1,
'wix-editor/no-not-not': 1,
'wix-editor/no-unneeded-match': 1,
'wix-editor/prefer-filter': 1,
'wix-editor/prefer-ternary': 1,
'wix-editor/return-boolean': 1,
'wix-editor/simplify-boolean-expression': 1,
// unicorn
'unicorn/no-null': 0,
'unicorn/no-useless-undefined': 0,
'unicorn/prefer-spread': 0,
'unicorn/catch-error-name': 0,
'unicorn/prevent-abbreviations': [
1,
{
replacements: {
args: false,
err: false,
prod: false,
ref: false,
params: false,
props: false,
},
},
],
'unicorn/filename-case': [
0,
{
cases: {
kebabCase: true,
pascalCase: true,
},
},
],
// import
'import/max-dependencies': [1, { max: 15 }],
// simple-import-sort with recomended settings
'simple-import-sort/imports': 1,
'simple-import-sort/exports': 1,
'sort-imports': 0,
'import/first': 1,
'import/newline-after-import': 1,
'import/no-duplicates': 1,
// typescript-eslint
'@typescript-eslint/no-floating-promises': 1,
'@typescript-eslint/no-unnecessary-condition': 1,
'@typescript-eslint/explicit-module-boundary-types': 0,
// sort-class-members
'sort-class-members/sort-class-members': [
1,
{
order: [
'[static-properties]',
'[static-methods]',
'[properties]',
'[conventional-private-properties]',
'constructor',
'[methods]',
'[conventional-private-methods]',
],
accessorPairPositioning: 'getThenSet',
},
],
// @kyleshevlin
'@kyleshevlin/prefer-custom-hooks': 1,
// testing-library
'testing-library/render-result-naming-convention': 0,
},
overrides: [
{
files: ['*.spec.ts', '**/testing/**/*.ts'],
rules: {
'consistent-return': 0,
'max-lines': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-floating-promises': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/camelcase': 0,
'import/max-dependencies': 0,
'sonarjs/no-duplicate-string': 0,
},
},
],
};