@yamato-daiwa/style_guides 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/BasicPreset.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const ECMA_ScriptBasicRules = require("./Partials/ECMA_ScriptBasicRules.js")
|
|
2
|
+
const TypeScriptOverridings = require("./Partials/Overridings/TypeScriptOverridings");
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
|
|
7
|
+
parser: "@typescript-eslint/parser",
|
|
8
|
+
|
|
9
|
+
parserOptions: {
|
|
10
|
+
sourceType: "module",
|
|
11
|
+
project: "tsconfig.json",
|
|
12
|
+
tsconfigRootDir: "./"
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
env: {
|
|
16
|
+
"es6": true,
|
|
17
|
+
"browser": true,
|
|
18
|
+
"node": true
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
plugins: [
|
|
22
|
+
"@typescript-eslint",
|
|
23
|
+
"node"
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
rules: {
|
|
27
|
+
...ECMA_ScriptBasicRules
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
overrides: [
|
|
31
|
+
TypeScriptOverridings
|
|
32
|
+
],
|
|
33
|
+
|
|
34
|
+
globals: {
|
|
35
|
+
BigInt: "readonly",
|
|
36
|
+
NodeJS: "readonly",
|
|
37
|
+
BufferEncoding: "readonly"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
|
|
3
|
+
/* --- ECMAScript code validity ----------------------------------------------------------------------------------- */
|
|
4
|
+
"array-callback-return": "error",
|
|
5
|
+
"constructor-super": "error",
|
|
6
|
+
"getter-return": "error",
|
|
7
|
+
"no-class-assign": "error",
|
|
8
|
+
"no-const-assign": "error",
|
|
9
|
+
"no-constructor-return": "error",
|
|
10
|
+
"no-import-assign": "error",
|
|
11
|
+
"no-invalid-regexp": "error",
|
|
12
|
+
"no-new-symbol": "error",
|
|
13
|
+
"no-obj-calls": "error",
|
|
14
|
+
"no-promise-executor-return": "error",
|
|
15
|
+
"no-setter-return": "error",
|
|
16
|
+
"no-this-before-super": "error",
|
|
17
|
+
"no-undef": "error",
|
|
18
|
+
"no-unreachable": "error",
|
|
19
|
+
"no-delete-var": "error",
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/* --- Algorithmic errors preventing ------------------------------------------------------------------------------ */
|
|
23
|
+
"for-direction": "error",
|
|
24
|
+
"no-async-promise-executor": "error",
|
|
25
|
+
"no-compare-neg-zero": "error",
|
|
26
|
+
"no-cond-assign": "error",
|
|
27
|
+
"no-constant-condition": "error",
|
|
28
|
+
"no-control-regex": "error",
|
|
29
|
+
"no-dupe-args": "error",
|
|
30
|
+
"no-dupe-class-members": "error",
|
|
31
|
+
"no-dupe-else-if": "error",
|
|
32
|
+
"no-dupe-keys": "error",
|
|
33
|
+
"no-duplicate-case": "error",
|
|
34
|
+
"no-empty-character-class": "error",
|
|
35
|
+
"no-empty-pattern": "error",
|
|
36
|
+
"no-ex-assign": "error",
|
|
37
|
+
"no-fallthrough": "error",
|
|
38
|
+
"no-func-assign": "error",
|
|
39
|
+
"no-inner-declarations": "error",
|
|
40
|
+
"no-irregular-whitespace": [
|
|
41
|
+
"error",
|
|
42
|
+
{
|
|
43
|
+
skipStrings: true,
|
|
44
|
+
skipTemplates: true,
|
|
45
|
+
skipComments: true,
|
|
46
|
+
skipRegExps: true
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"no-loss-of-precision": "error",
|
|
50
|
+
"no-misleading-character-class": "error",
|
|
51
|
+
"no-prototype-builtins": "error",
|
|
52
|
+
"no-unmodified-loop-condition": "error",
|
|
53
|
+
"no-unreachable-loop": "error",
|
|
54
|
+
"no-unsafe-finally": "error",
|
|
55
|
+
"no-unsafe-negation": "error",
|
|
56
|
+
"no-unsafe-optional-chaining": "error",
|
|
57
|
+
"no-use-before-define": [ "error", { functions: false } ],
|
|
58
|
+
"require-atomic-updates": "error",
|
|
59
|
+
"use-isnan": "error",
|
|
60
|
+
"valid-typeof": "error",
|
|
61
|
+
"guard-for-in": "error",
|
|
62
|
+
"no-case-declarations": "error",
|
|
63
|
+
"no-global-assign": "error",
|
|
64
|
+
"no-loop-func": "error",
|
|
65
|
+
"no-shadow": "error",
|
|
66
|
+
"no-shadow-restricted-names": "error",
|
|
67
|
+
"operator-assignment": [ "error", "never" ],
|
|
68
|
+
"prefer-object-has-own": [ "error" ],
|
|
69
|
+
"radix": "error",
|
|
70
|
+
"require-unicode-regexp": "error",
|
|
71
|
+
"yoda": "error",
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
/* --- Must not be in production building ------------------------------------------------------------------------- */
|
|
75
|
+
"no-debugger": "error",
|
|
76
|
+
"no-console": "error",
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
/* --- Prevention of the confusing / Stupid errors ---------------------------------------------------------------- */
|
|
80
|
+
"no-self-assign": "error",
|
|
81
|
+
"no-self-compare": "error",
|
|
82
|
+
"no-sparse-arrays": "error",
|
|
83
|
+
"no-template-curly-in-string": "error",
|
|
84
|
+
"no-unexpected-multiline": "error",
|
|
85
|
+
"class-methods-use-this": "warn",
|
|
86
|
+
"consistent-return": "warn",
|
|
87
|
+
"default-case-last": "error",
|
|
88
|
+
"default-param-last": "error",
|
|
89
|
+
"func-names": [ "error", "always" ],
|
|
90
|
+
"func-style": [ "error", "declaration" ],
|
|
91
|
+
"init-declarations": [ "warn", "always" ],
|
|
92
|
+
"new-cap": [ "error" ],
|
|
93
|
+
"no-array-constructor": "error",
|
|
94
|
+
"no-bitwise": "error",
|
|
95
|
+
"no-confusing-arrow": [ "error", { allowParens: true } ],
|
|
96
|
+
"no-div-regex": "error",
|
|
97
|
+
"no-extend-native": "error",
|
|
98
|
+
"no-extra-boolean-cast": "error",
|
|
99
|
+
"no-implicit-coercion": "error",
|
|
100
|
+
"no-implicit-globals": "error",
|
|
101
|
+
"no-invalid-this": "error",
|
|
102
|
+
"no-mixed-operators": "error",
|
|
103
|
+
"no-multi-assign": "error",
|
|
104
|
+
"no-negated-condition": "error",
|
|
105
|
+
"no-new": "error",
|
|
106
|
+
"no-new-func": "error",
|
|
107
|
+
"no-param-reassign": "error",
|
|
108
|
+
"no-regex-spaces": "error",
|
|
109
|
+
"no-return-assign": "error",
|
|
110
|
+
"no-sequences": "error",
|
|
111
|
+
"no-throw-literal": "error",
|
|
112
|
+
"no-undefined": "error",
|
|
113
|
+
"no-underscore-dangle": "warn",
|
|
114
|
+
"no-unused-expressions": "error",
|
|
115
|
+
"no-useless-escape": "error",
|
|
116
|
+
"no-useless-rename": "error",
|
|
117
|
+
"no-useless-return": "error",
|
|
118
|
+
"no-void": "error",
|
|
119
|
+
"prefer-numeric-literals": "error",
|
|
120
|
+
"prefer-promise-reject-errors": "error",
|
|
121
|
+
"prefer-rest-params": "error",
|
|
122
|
+
"prefer-spread": "error",
|
|
123
|
+
"require-await": "error",
|
|
124
|
+
"require-yield": "error",
|
|
125
|
+
"symbol-description": "error",
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
/* --- Elimination of useless code -------------------------------------------------------------------------------- */
|
|
129
|
+
"no-useless-backreference": "error",
|
|
130
|
+
"arrow-body-style": [ "warn", "as-needed" ],
|
|
131
|
+
"no-else-return": "error",
|
|
132
|
+
"no-extra-bind": "error",
|
|
133
|
+
"no-extra-label": "error",
|
|
134
|
+
"no-extra-semi": "error",
|
|
135
|
+
"no-new-object": "error",
|
|
136
|
+
"no-new-wrappers": "error",
|
|
137
|
+
"no-return-await": "error",
|
|
138
|
+
"no-undef-init": "error",
|
|
139
|
+
"no-unneeded-ternary": "error",
|
|
140
|
+
"no-useless-call": "error",
|
|
141
|
+
"no-useless-catch": "error",
|
|
142
|
+
"no-useless-computed-key": "error",
|
|
143
|
+
"no-useless-concat": "error",
|
|
144
|
+
"no-useless-constructor": "error",
|
|
145
|
+
"object-shorthand": [
|
|
146
|
+
"warn",
|
|
147
|
+
"always",
|
|
148
|
+
{
|
|
149
|
+
avoidQuotes: true,
|
|
150
|
+
avoidExplicitReturnArrows: true
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"no-extra-parens": [
|
|
154
|
+
"warn",
|
|
155
|
+
"all",
|
|
156
|
+
{
|
|
157
|
+
"nestedBinaryExpressions": false,
|
|
158
|
+
"enforceForArrowConditionals": false
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
/* --- Unification of equivalent writings ------------------------------------------------------------------------- */
|
|
164
|
+
"curly": "error",
|
|
165
|
+
"dot-notation": "warn",
|
|
166
|
+
"no-floating-decimal": "error",
|
|
167
|
+
"one-var": [ "error", "never" ],
|
|
168
|
+
"one-var-declaration-per-line": [ "error", "initializations" ],
|
|
169
|
+
"prefer-object-spread": "error",
|
|
170
|
+
"prefer-regex-literals": [ "error", { disallowRedundantWrapping: true } ],
|
|
171
|
+
"prefer-template": "error",
|
|
172
|
+
"quote-props": [ "error", "as-needed" ],
|
|
173
|
+
"array-bracket-newline": [ "warn", "consistent" ],
|
|
174
|
+
"array-bracket-spacing": [ "warn", "always" ],
|
|
175
|
+
"array-element-newline": [ "warn", "consistent" ],
|
|
176
|
+
"arrow-parens": "warn",
|
|
177
|
+
"arrow-spacing": "warn",
|
|
178
|
+
"block-spacing": [ "warn", "always" ],
|
|
179
|
+
"brace-style": [ "warn", "1tbs", { allowSingleLine: true } ],
|
|
180
|
+
"comma-dangle": "warn",
|
|
181
|
+
"comma-spacing": "warn",
|
|
182
|
+
"comma-style": [ "error", "last" ],
|
|
183
|
+
"computed-property-spacing": [ "warn", "never" ],
|
|
184
|
+
"dot-location": [ "warn", "object" ],
|
|
185
|
+
"func-call-spacing": "warn",
|
|
186
|
+
"function-call-argument-newline": [ "error", "consistent" ],
|
|
187
|
+
"function-paren-newline": [ "error", "consistent" ],
|
|
188
|
+
"generator-star-spacing": "warn",
|
|
189
|
+
"jsx-quotes": "warn",
|
|
190
|
+
"key-spacing": "warn",
|
|
191
|
+
"keyword-spacing": "warn",
|
|
192
|
+
"lines-around-comment": [ "error", { "beforeBlockComment": true } ],
|
|
193
|
+
"max-len": [
|
|
194
|
+
"warn",
|
|
195
|
+
{
|
|
196
|
+
code: 130,
|
|
197
|
+
ignoreUrls: true,
|
|
198
|
+
ignorePattern: "^\\s{4}\"[@~]?[\\w/:.-]+\";\\s*$"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"max-statements-per-line": [ "warn", { max: 2 } ],
|
|
202
|
+
"new-parens": "error",
|
|
203
|
+
"newline-per-chained-call": [ "warn", { ignoreChainWithDepth: 2 } ],
|
|
204
|
+
"no-whitespace-before-property": "warn",
|
|
205
|
+
"object-curly-newline": [ "warn", { consistent: true } ],
|
|
206
|
+
"object-curly-spacing": [ "warn", "always" ],
|
|
207
|
+
"object-property-newline": [ "warn", { allowAllPropertiesOnSameLine: true } ],
|
|
208
|
+
"quotes": [ "error", "double", { avoidEscape: true } ],
|
|
209
|
+
"rest-spread-spacing": [ "warn", "never" ],
|
|
210
|
+
"semi": "error",
|
|
211
|
+
"semi-spacing": "warn",
|
|
212
|
+
"semi-style": "warn",
|
|
213
|
+
"space-before-blocks": "warn",
|
|
214
|
+
"space-before-function-paren": [ "warn", { "anonymous": "always", "named": "never", "asyncArrow": "always" } ],
|
|
215
|
+
"space-in-parens": [ "warn", "never" ],
|
|
216
|
+
"space-infix-ops": "warn",
|
|
217
|
+
"space-unary-ops": "warn",
|
|
218
|
+
"switch-colon-spacing": "warn",
|
|
219
|
+
"template-curly-spacing": [ "warn", "always" ],
|
|
220
|
+
"template-tag-spacing": [ "warn", "never" ],
|
|
221
|
+
"wrap-iife": [ "error", "inside" ],
|
|
222
|
+
"yield-star-spacing": "warn",
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
/* --- Neatness --------------------------------------------------------------------------------------------------- */
|
|
226
|
+
"no-duplicate-imports": "error",
|
|
227
|
+
"no-unused-private-class-members": "error",
|
|
228
|
+
"no-unused-vars": "error",
|
|
229
|
+
"capitalized-comments": "warn",
|
|
230
|
+
"grouped-accessor-pairs": [ "warn", "getBeforeSet" ],
|
|
231
|
+
"id-denylist": [
|
|
232
|
+
"error",
|
|
233
|
+
"args",
|
|
234
|
+
"argv",
|
|
235
|
+
"array",
|
|
236
|
+
"brsr",
|
|
237
|
+
"data",
|
|
238
|
+
"list",
|
|
239
|
+
"prop",
|
|
240
|
+
"props",
|
|
241
|
+
"string"
|
|
242
|
+
],
|
|
243
|
+
"id-length": [
|
|
244
|
+
"error",
|
|
245
|
+
{
|
|
246
|
+
min: 4,
|
|
247
|
+
properties: "never",
|
|
248
|
+
exceptions: [
|
|
249
|
+
"add",
|
|
250
|
+
"ID",
|
|
251
|
+
"key",
|
|
252
|
+
"pug",
|
|
253
|
+
"Pug",
|
|
254
|
+
"vue",
|
|
255
|
+
"Vue"
|
|
256
|
+
]
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
"max-classes-per-file": "error",
|
|
260
|
+
"max-depth": [ "warn", 3 ],
|
|
261
|
+
"max-nested-callbacks": [ "error", 2 ],
|
|
262
|
+
"max-params": [ "error", 3 ],
|
|
263
|
+
"multiline-comment-style": [ "warn", "bare-block" ],
|
|
264
|
+
"no-empty": "error",
|
|
265
|
+
"no-empty-function": "error",
|
|
266
|
+
"no-inline-comments": "error",
|
|
267
|
+
"no-lone-blocks": "error",
|
|
268
|
+
"no-lonely-if": "error",
|
|
269
|
+
"no-magic-numbers": [
|
|
270
|
+
"error",
|
|
271
|
+
{
|
|
272
|
+
"enforceConst": true,
|
|
273
|
+
"ignore": [
|
|
274
|
+
-1,
|
|
275
|
+
0,
|
|
276
|
+
0.5,
|
|
277
|
+
1,
|
|
278
|
+
2,
|
|
279
|
+
10,
|
|
280
|
+
100
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"no-nested-ternary": "error",
|
|
285
|
+
"no-warning-comments": "warn",
|
|
286
|
+
"prefer-named-capture-group": "error",
|
|
287
|
+
"spaced-comment": [ "warn", "always", { "block": { "markers": [ "!" ], "balanced": true } } ],
|
|
288
|
+
"no-mixed-spaces-and-tabs": "warn",
|
|
289
|
+
"no-multi-spaces": "warn",
|
|
290
|
+
"no-multiple-empty-lines": [
|
|
291
|
+
"warn",
|
|
292
|
+
{
|
|
293
|
+
max: 2,
|
|
294
|
+
maxBOF: 0,
|
|
295
|
+
maxEOF: 1
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
/* --- Preventing of deprecated or not recommended functionality -------------------------------------------------- */
|
|
301
|
+
"eqeqeq": [ "error", "always" ],
|
|
302
|
+
"no-alert": "error",
|
|
303
|
+
"no-caller": "error",
|
|
304
|
+
"no-eq-null": "error",
|
|
305
|
+
"no-eval": "error",
|
|
306
|
+
"no-implied-eval": "error",
|
|
307
|
+
"no-iterator": "error",
|
|
308
|
+
"no-label-var": "error",
|
|
309
|
+
"no-labels": "error",
|
|
310
|
+
"no-nonoctal-decimal-escape": "error",
|
|
311
|
+
"no-octal": "error",
|
|
312
|
+
"no-octal-escape": "error",
|
|
313
|
+
"no-proto": "error",
|
|
314
|
+
"no-script-url": "error",
|
|
315
|
+
"no-var": "error",
|
|
316
|
+
"no-with": "error",
|
|
317
|
+
"strict": "error",
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
/* --- Not sorted yet --------------------------------------------------------------------------------------------- */
|
|
321
|
+
"no-await-in-loop": "error",
|
|
322
|
+
"prefer-arrow-callback": "warn",
|
|
323
|
+
"prefer-const": "error",
|
|
324
|
+
"eol-last": [ "error", "always" ],
|
|
325
|
+
"unicode-bom": "error"
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
/* --- Experimental ----------------------------------------------------------------------------------------------- */
|
|
329
|
+
}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
const ECMA_ScriptBasicRules = require("./../ECMA_ScriptBasicRules");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
|
|
6
|
+
"files": [ "*.ts", "*.tsx" ],
|
|
7
|
+
|
|
8
|
+
"rules": {
|
|
9
|
+
|
|
10
|
+
/* --- Type safety ---------------------------------------------------------------------------------------------- */
|
|
11
|
+
"@typescript-eslint/consistent-type-assertions": [ "error", { "assertionStyle": "never" } ],
|
|
12
|
+
|
|
13
|
+
"@typescript-eslint/no-base-to-string": "error",
|
|
14
|
+
|
|
15
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
16
|
+
|
|
17
|
+
"@typescript-eslint/explicit-function-return-type": [
|
|
18
|
+
"error",
|
|
19
|
+
{
|
|
20
|
+
allowExpressions: false,
|
|
21
|
+
allowTypedFunctionExpressions: false,
|
|
22
|
+
allowHigherOrderFunctions: false,
|
|
23
|
+
allowDirectConstAssertionInArrowFunctions: false,
|
|
24
|
+
allowConciseArrowFunctionExpressionsStartingWithVoid: false
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
|
|
28
|
+
"@typescript-eslint/no-implicit-any-catch": "error",
|
|
29
|
+
|
|
30
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
31
|
+
|
|
32
|
+
"@typescript-eslint/no-non-null-assertion": "error",
|
|
33
|
+
|
|
34
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
|
|
35
|
+
|
|
36
|
+
"@typescript-eslint/no-unsafe-argument": "error",
|
|
37
|
+
|
|
38
|
+
"@typescript-eslint/no-unsafe-call": "error",
|
|
39
|
+
|
|
40
|
+
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
41
|
+
|
|
42
|
+
"@typescript-eslint/prefer-return-this-type": "warn",
|
|
43
|
+
|
|
44
|
+
"@typescript-eslint/strict-boolean-expressions": "error",
|
|
45
|
+
|
|
46
|
+
"@typescript-eslint/typedef": [
|
|
47
|
+
"error",
|
|
48
|
+
{
|
|
49
|
+
"arrayDestructuring": true,
|
|
50
|
+
"arrowParameter": true,
|
|
51
|
+
"memberVariableDeclaration": true,
|
|
52
|
+
"objectDestructuring": true,
|
|
53
|
+
"parameter": true,
|
|
54
|
+
"propertyDeclaration": true,
|
|
55
|
+
"variableDeclaration": true
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
/* --- Algorithmic errors preventing ---------------------------------------------------------------------------- */
|
|
61
|
+
"no-dupe-class-members": "off",
|
|
62
|
+
"@typescript-eslint/no-dupe-class-members": "error",
|
|
63
|
+
|
|
64
|
+
"no-loop-func": "off",
|
|
65
|
+
"@typescript-eslint/no-loop-func": "error",
|
|
66
|
+
|
|
67
|
+
"no-loss-of-precision": "off",
|
|
68
|
+
"@typescript-eslint/no-loss-of-precision": "error",
|
|
69
|
+
|
|
70
|
+
"no-redeclare": "off",
|
|
71
|
+
"@typescript-eslint/no-redeclare": [ "error", { ignoreDeclarationMerge: true } ],
|
|
72
|
+
|
|
73
|
+
"no-shadow": "off",
|
|
74
|
+
"@typescript-eslint/no-shadow": "error",
|
|
75
|
+
|
|
76
|
+
"no-use-before-define": "off",
|
|
77
|
+
"@typescript-eslint/no-use-before-define": [
|
|
78
|
+
...ECMA_ScriptBasicRules["no-use-before-define"].slice(0, 1),
|
|
79
|
+
{
|
|
80
|
+
...ECMA_ScriptBasicRules["no-use-before-define"][1],
|
|
81
|
+
...{
|
|
82
|
+
"typedefs": false
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
|
|
87
|
+
"@typescript-eslint/unbound-method": [ "error", { "ignoreStatic": true } ],
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/* --- Prevention of the confusing / Stupid errors -------------------------------------------------------------- */
|
|
91
|
+
"@typescript-eslint/await-thenable": "error",
|
|
92
|
+
|
|
93
|
+
"@typescript-eslint/no-confusing-non-null-assertion": "error",
|
|
94
|
+
|
|
95
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
96
|
+
|
|
97
|
+
"default-param-last": "off",
|
|
98
|
+
"@typescript-eslint/default-param-last": "error",
|
|
99
|
+
|
|
100
|
+
"init-declarations": "off",
|
|
101
|
+
"@typescript-eslint/init-declarations": "error",
|
|
102
|
+
|
|
103
|
+
"@typescript-eslint/no-array-constructor": "error",
|
|
104
|
+
|
|
105
|
+
"@typescript-eslint/no-confusing-void-expression": "error",
|
|
106
|
+
|
|
107
|
+
"no-invalid-this": "off",
|
|
108
|
+
"@typescript-eslint/no-invalid-this": "error",
|
|
109
|
+
|
|
110
|
+
"@typescript-eslint/no-invalid-void-type": "error",
|
|
111
|
+
|
|
112
|
+
"@typescript-eslint/no-meaningless-void-operator": "error",
|
|
113
|
+
|
|
114
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
115
|
+
|
|
116
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
117
|
+
|
|
118
|
+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
119
|
+
|
|
120
|
+
"@typescript-eslint/no-redundant-type-constituents": "error",
|
|
121
|
+
|
|
122
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
123
|
+
|
|
124
|
+
"no-throw-literal": "off",
|
|
125
|
+
"@typescript-eslint/no-throw-literal": "error",
|
|
126
|
+
|
|
127
|
+
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
128
|
+
|
|
129
|
+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
|
130
|
+
|
|
131
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
132
|
+
|
|
133
|
+
"no-unused-expressions": "off",
|
|
134
|
+
"@typescript-eslint/no-unused-expressions": "error",
|
|
135
|
+
|
|
136
|
+
"@typescript-eslint/prefer-literal-enum-member": "error",
|
|
137
|
+
|
|
138
|
+
"@typescript-eslint/prefer-readonly": "error",
|
|
139
|
+
|
|
140
|
+
"@typescript-eslint/require-array-sort-compare": "error",
|
|
141
|
+
|
|
142
|
+
"require-await": "off",
|
|
143
|
+
"@typescript-eslint/require-await": "error",
|
|
144
|
+
|
|
145
|
+
"@typescript-eslint/restrict-plus-operands": "error",
|
|
146
|
+
|
|
147
|
+
"@typescript-eslint/restrict-template-expressions": [
|
|
148
|
+
"error",
|
|
149
|
+
{
|
|
150
|
+
"allowNumber": true,
|
|
151
|
+
"allowBoolean": true,
|
|
152
|
+
"allowNullish": true
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
|
|
156
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
/* --- Elimination of useless code ------------------------------------------------------------------------------- */
|
|
160
|
+
"comma-dangle": "off",
|
|
161
|
+
"@typescript-eslint/comma-dangle": "error",
|
|
162
|
+
|
|
163
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
164
|
+
|
|
165
|
+
"no-extra-parens": "off",
|
|
166
|
+
"@typescript-eslint/no-extra-parens": ECMA_ScriptBasicRules["no-extra-parens"],
|
|
167
|
+
|
|
168
|
+
"no-extra-semi": "off",
|
|
169
|
+
"@typescript-eslint/no-extra-semi": "error",
|
|
170
|
+
|
|
171
|
+
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
172
|
+
|
|
173
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
174
|
+
|
|
175
|
+
"@typescript-eslint/no-useless-constructor": "error",
|
|
176
|
+
|
|
177
|
+
"@typescript-eslint/return-await": "error",
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
/* --- Neatness ------------------------------------------------------------------------------------------------- */
|
|
181
|
+
"@typescript-eslint/adjacent-overload-signatures": "warn",
|
|
182
|
+
|
|
183
|
+
"comma-spacing": "off",
|
|
184
|
+
"@typescript-eslint/comma-spacing": "warn",
|
|
185
|
+
|
|
186
|
+
"@typescript-eslint/member-ordering": [
|
|
187
|
+
"warn",
|
|
188
|
+
{
|
|
189
|
+
"default": [
|
|
190
|
+
|
|
191
|
+
"signature",
|
|
192
|
+
|
|
193
|
+
"public-static-field",
|
|
194
|
+
"protected-static-field",
|
|
195
|
+
"private-static-field",
|
|
196
|
+
|
|
197
|
+
"public-abstract-field",
|
|
198
|
+
"protected-abstract-field",
|
|
199
|
+
|
|
200
|
+
"public-instance-field",
|
|
201
|
+
"protected-instance-field",
|
|
202
|
+
"private-instance-field",
|
|
203
|
+
|
|
204
|
+
"public-static-method",
|
|
205
|
+
|
|
206
|
+
"constructor",
|
|
207
|
+
|
|
208
|
+
"public-abstract-method",
|
|
209
|
+
"protected-abstract-method",
|
|
210
|
+
|
|
211
|
+
"public-instance-method",
|
|
212
|
+
"protected-instance-method",
|
|
213
|
+
"private-instance-method",
|
|
214
|
+
|
|
215
|
+
"protected-static-method",
|
|
216
|
+
"private-static-method"
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
|
|
221
|
+
"no-duplicate-imports": "off",
|
|
222
|
+
"@typescript-eslint/no-duplicate-imports": "error",
|
|
223
|
+
|
|
224
|
+
"no-empty-function": "off",
|
|
225
|
+
"@typescript-eslint/no-empty-function": "error",
|
|
226
|
+
|
|
227
|
+
"no-magic-numbers": "off",
|
|
228
|
+
"@typescript-eslint/no-magic-numbers": [
|
|
229
|
+
...ECMA_ScriptBasicRules["no-magic-numbers"].slice(0, 1),
|
|
230
|
+
{
|
|
231
|
+
...ECMA_ScriptBasicRules["no-magic-numbers"][1],
|
|
232
|
+
...{
|
|
233
|
+
"ignoreReadonlyClassProperties": true,
|
|
234
|
+
"ignoreEnums": true,
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
|
|
239
|
+
"no-unused-vars": "off",
|
|
240
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
/* --- Unification of equivalent writings ----------------------------------------------------------------------- */
|
|
244
|
+
"@typescript-eslint/array-type": [ "warn", { default: "generic" } ],
|
|
245
|
+
|
|
246
|
+
"brace-style": "off",
|
|
247
|
+
"@typescript-eslint/brace-style": ECMA_ScriptBasicRules["brace-style"],
|
|
248
|
+
|
|
249
|
+
"@typescript-eslint/class-literal-property-style": "warn",
|
|
250
|
+
|
|
251
|
+
"@typescript-eslint/consistent-indexed-object-style": [ "warn", "index-signature" ],
|
|
252
|
+
|
|
253
|
+
"dot-notation": "off",
|
|
254
|
+
"@typescript-eslint/dot-notation": "warn",
|
|
255
|
+
|
|
256
|
+
"func-call-spacing": "off",
|
|
257
|
+
"@typescript-eslint/func-call-spacing": "warn",
|
|
258
|
+
|
|
259
|
+
"keyword-spacing": "off",
|
|
260
|
+
"@typescript-eslint/keyword-spacing": "warn",
|
|
261
|
+
|
|
262
|
+
"@typescript-eslint/member-delimiter-style": [
|
|
263
|
+
"warn",
|
|
264
|
+
{
|
|
265
|
+
"multiline": {
|
|
266
|
+
"delimiter": "semi",
|
|
267
|
+
"requireLast": true
|
|
268
|
+
},
|
|
269
|
+
"singleline": {
|
|
270
|
+
"delimiter": "semi",
|
|
271
|
+
"requireLast": true
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
|
|
276
|
+
"@typescript-eslint/no-extraneous-class": [
|
|
277
|
+
"error",
|
|
278
|
+
{
|
|
279
|
+
allowStaticOnly: true,
|
|
280
|
+
allowWithDecorator: true
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
|
|
284
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
285
|
+
|
|
286
|
+
"@typescript-eslint/no-parameter-properties": "error",
|
|
287
|
+
|
|
288
|
+
"object-curly-spacing": "off",
|
|
289
|
+
"@typescript-eslint/object-curly-spacing": ECMA_ScriptBasicRules["object-curly-spacing"],
|
|
290
|
+
|
|
291
|
+
"@typescript-eslint/prefer-function-type": "warn",
|
|
292
|
+
|
|
293
|
+
"@typescript-eslint/prefer-includes": "warn",
|
|
294
|
+
|
|
295
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
296
|
+
|
|
297
|
+
"@typescript-eslint/prefer-nullish-coalescing": "warn",
|
|
298
|
+
|
|
299
|
+
"@typescript-eslint/prefer-optional-chain": "warn",
|
|
300
|
+
|
|
301
|
+
"@typescript-eslint/prefer-reduce-type-parameter": "warn",
|
|
302
|
+
|
|
303
|
+
"@typescript-eslint/prefer-regexp-exec": "warn",
|
|
304
|
+
|
|
305
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
|
|
306
|
+
|
|
307
|
+
"@typescript-eslint/promise-function-async": "error",
|
|
308
|
+
|
|
309
|
+
"quotes": "off",
|
|
310
|
+
"@typescript-eslint/quotes": [
|
|
311
|
+
"error",
|
|
312
|
+
"double",
|
|
313
|
+
{
|
|
314
|
+
"avoidEscape": true
|
|
315
|
+
}
|
|
316
|
+
],
|
|
317
|
+
|
|
318
|
+
"semi": "off",
|
|
319
|
+
"@typescript-eslint/semi": "error",
|
|
320
|
+
|
|
321
|
+
"space-before-blocks": "off",
|
|
322
|
+
"@typescript-eslint/space-before-blocks": [ "error" ],
|
|
323
|
+
|
|
324
|
+
"space-before-function-paren": "off",
|
|
325
|
+
"@typescript-eslint/space-before-function-paren": ECMA_ScriptBasicRules["space-before-function-paren"],
|
|
326
|
+
|
|
327
|
+
"space-infix-ops": "off",
|
|
328
|
+
"@typescript-eslint/space-infix-ops": "warn",
|
|
329
|
+
|
|
330
|
+
"@typescript-eslint/type-annotation-spacing": "warn",
|
|
331
|
+
|
|
332
|
+
"@typescript-eslint/unified-signatures": "warn",
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
/* --- Fast-and-dirty code prevention --------------------------------------------------------------------------- */
|
|
336
|
+
"@typescript-eslint/ban-ts-comment": "error",
|
|
337
|
+
|
|
338
|
+
"@typescript-eslint/ban-types": "error",
|
|
339
|
+
|
|
340
|
+
"@typescript-eslint/explicit-member-accessibility": [ "error", { accessibility: "explicit" } ],
|
|
341
|
+
|
|
342
|
+
"@typescript-eslint/no-empty-interface": "error",
|
|
343
|
+
|
|
344
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
345
|
+
|
|
346
|
+
"@typescript-eslint/no-useless-empty-export": "error",
|
|
347
|
+
|
|
348
|
+
"@typescript-eslint/prefer-enum-initializers": "error",
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
/* --- Preventing of deprecated or not recommended functionality ------------------------------------------------ */
|
|
352
|
+
"@typescript-eslint/ban-tslint-comment": "error",
|
|
353
|
+
|
|
354
|
+
"@typescript-eslint/method-signature-style": "error",
|
|
355
|
+
|
|
356
|
+
"no-implied-eval": "off",
|
|
357
|
+
"@typescript-eslint/no-implied-eval": "error",
|
|
358
|
+
|
|
359
|
+
"@typescript-eslint/triple-slash-reference": "error",
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
/* --- Other ---------------------------------------------------------------------------------------------------- */
|
|
363
|
+
"@typescript-eslint/consistent-type-exports": [ "error", { fixMixedExportsWithInlineTypeSpecifier: true } ],
|
|
364
|
+
|
|
365
|
+
"@typescript-eslint/consistent-type-imports": [ "error" ],
|
|
366
|
+
|
|
367
|
+
"@typescript-eslint/no-dynamic-delete": "error",
|
|
368
|
+
|
|
369
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
370
|
+
|
|
371
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
/* --- Experimental --------------------------------------------------------------------------------------------- */
|
|
375
|
+
"@typescript-eslint/prefer-readonly-parameter-types": "warn"
|
|
376
|
+
}
|
|
377
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yamato-daiwa/style_guides",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "The guidelines for ESLint, Pug and Stylus.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/TokugawaTakeshi/Yamato-Daiwa-StyleGuides.git"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"eslint",
|
|
11
|
+
"eslintconfig",
|
|
12
|
+
"puglint",
|
|
13
|
+
"puglintconfig",
|
|
14
|
+
"styleguide",
|
|
15
|
+
"yamato-daiwa"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"typescript": "4.6.3"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "5.19.0",
|
|
23
|
+
"@typescript-eslint/parser": "5.19.0",
|
|
24
|
+
"eslint": "8.13.0",
|
|
25
|
+
"eslint-plugin-node": "11.1.0"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
|
29
|
+
"@typescript-eslint/parser": "^5.18.0",
|
|
30
|
+
"eslint": "^8.13.0",
|
|
31
|
+
"eslint-plugin-node": "^11.1.0",
|
|
32
|
+
"typescript": ">=4.0.0 <4.7.0"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"BasicPreset.js",
|
|
36
|
+
"Partials"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"JavaScript test": "eslint Tests/JavaScriptTest.js --config BasicPreset.js",
|
|
40
|
+
"TypeScript test": "eslint Tests/TypeScriptTest.ts --config BasicPreset.js"
|
|
41
|
+
}
|
|
42
|
+
}
|