-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
236 lines (230 loc) · 8.89 KB
/
index.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
module.exports = {
extends: [
'airbnb-base',
'airbnb-typescript/base',
'plugin:jsdoc/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'prettier',
],
plugins: [
'import',
'simple-import-sort',
'prettier',
],
env: {
es2020: true,
},
rules: {
'class-methods-use-this': 'off',
'global-require': 'off',
'@typescript-eslint/lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
'max-classes-per-file': ['warn', 2],
'no-console': 'off',
'no-continue': 'off',
'no-lonely-if': 'off',
'no-multiple-empty-lines': ['warn', { max: 1 }],
'no-param-reassign': 'off',
'no-plusplus': 'off',
'no-prototype-builtins': 'off',
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'lodash',
message:
'Please import specific lodash functions one by one (e.g. "import merge from \'lodash/merge\'").',
},
],
patterns: [
'lodash/*',
'!lodash/cloneDeep',
'!lodash/cloneDeepWith',
'!lodash/isEmpty',
'!lodash/merge',
],
},
],
'no-restricted-syntax': [
'error',
{
selector: 'LabeledStatement',
message:
'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
selector: 'WithStatement',
message:
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'off',
'no-underscore-dangle': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', ignoreRestSiblings: true }],
'prefer-destructuring': ['error', { object: true, array: false }],
'sort-imports': 'off',
'import/no-default-export': ['error'],
'import/no-unresolved': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: false,
optionalDependencies: false,
peerDependencies: true,
},
],
'import/order': 'off',
'import/prefer-default-export': 'off',
'jsdoc/check-access': 'warn',
'jsdoc/check-tag-names': ['warn', { definedTags: ['moduleConfig'] }],
'jsdoc/no-undefined-types': 'off',
'jsdoc/require-description': 'off',
'jsdoc/require-hyphen-before-param-description': ['warn', 'never'],
'jsdoc/require-jsdoc': ['warn', {
publicOnly: false,
require: {
ArrowFunctionExpression: false,
ClassDeclaration: false,
ClassExpression: false,
FunctionDeclaration: true,
FunctionExpression: false,
MethodDefinition: true,
},
exemptEmptyFunctions: true,
enableFixer: false,
}],
'jsdoc/require-param-description': 'off',
'jsdoc/require-returns-description': 'off',
'jsdoc/tag-lines': [
'warn',
'any',
{
startLines: 1,
tags: {
param: { lines: 'never' },
returns: { lines: 'never' },
},
}
],
'prettier/prettier': 'warn',
'simple-import-sort/imports': [
'warn',
{
groups: [
// side effect imports
['^\\u0000'],
// packages
['^@?[a-z]'],
// absolute imports
['^[^.]'],
// relative imports
['^\\.'],
// internal modules
['^(config|engine|enums|external|hup|interfaces|model|modules|render|types|uber|ui|utils|view_models|vue)(/.*|$)'],
// internal root modules
['^[A-Z]'],
// internal client
['^(app|config_env|config_title|game)$'],
// internal assets
['^(images|shaders|templates)(/.*|$)'],
],
},
],
// Disable rules that require type checking and enable base rules.
// Enabling type information by specifying 'parserOptions.project' requires the whole
// project to be build before linting. Currently too slow for large code bases.
'@typescript-eslint/await-thenable': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/no-confusing-void-expression': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-for-in-array': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unnecessary-boolean-literal-compare Flags': 'off',
'@typescript-eslint/no-unnecessary-condition Prevents': 'off',
'@typescript-eslint/no-unnecessary-qualifier Warns': 'off',
'@typescript-eslint/no-unnecessary-type-arguments Enforces': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unsafe-assignment Disallows': 'off',
'@typescript-eslint/no-unsafe-call Disallows': 'off',
'@typescript-eslint/no-unsafe-member-access Disallows': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
'@typescript-eslint/prefer-includes': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/prefer-readonly Requires': 'off',
'@typescript-eslint/prefer-readonly-parameter-types Requires': 'off',
'@typescript-eslint/prefer-reduce-type-parameter Prefer': 'off',
'@typescript-eslint/prefer-regexp-exec Enforce': 'off',
'@typescript-eslint/prefer-string-starts-ends-with': 'off',
'@typescript-eslint/promise-function-async Requires': 'off',
'@typescript-eslint/require-array-sort-compare Requires': 'off',
'@typescript-eslint/restrict-plus-operands When': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/strict-boolean-expressions Restricts': 'off',
'@typescript-eslint/switch-exhaustiveness-check': 'off',
'@typescript-eslint/unbound-method': 'off',
// extension rules
'@typescript-eslint/dot-notation': 'off',
'dot-notation': ['error', { allowKeywords: true }],
'@typescript-eslint/no-implied-eval': 'off',
'no-implied-eval': 'error',
'@typescript-eslint/no-throw-literal': 'off',
'no-throw-literal': 'error',
'@typescript-eslint/require-await': 'off',
'require-await': 'off',
'@typescript-eslint/return-await': 'off',
'no-return-await': 'error',
// use T[] over Array<T>
'@typescript-eslint/array-type': ['warn', { default: 'array' }],
// enforce import over require()
'@typescript-eslint/no-require-imports': 'error',
},
settings: {
jsdoc: {
preferredTypes: {
'Array<>': '[]',
'Array.<>': '[]',
},
},
},
overrides: [
{
files: ['**/*.d.ts'],
rules: {
'import/no-default-export': 'off',
'jsdoc/require-returns-check': 'off',
},
},
{
files: ['**/*.ts'],
settings: {
jsdoc: {
mode: 'typescript',
},
},
rules: {
'jsdoc/no-types': 'warn',
'jsdoc/require-jsdoc': ['warn', {
publicOnly: false,
require: {
ArrowFunctionExpression: false,
ClassDeclaration: false,
ClassExpression: false,
FunctionDeclaration: false,
FunctionExpression: false,
MethodDefinition: false,
},
exemptEmptyFunctions: true,
enableFixer: false,
}],
'jsdoc/require-param': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns-type': 'off',
},
},
],
};