@odg/eslint-config 3.1.0 → 3.2.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/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Linter } from
|
|
1
|
+
import type { Linter } from "eslint";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ODG ESLint Configuration
|
|
@@ -22,4 +22,4 @@ import type { Linter } from 'eslint';
|
|
|
22
22
|
*/
|
|
23
23
|
declare const config: Linter.Config[];
|
|
24
24
|
|
|
25
|
-
export default config;
|
|
25
|
+
export default config;
|
package/package.json
CHANGED
package/rules/global/base.mjs
CHANGED
|
@@ -102,7 +102,7 @@ export default {
|
|
|
102
102
|
"kebabCase": true,
|
|
103
103
|
"pascalCase": true,
|
|
104
104
|
},
|
|
105
|
-
"ignore": [ "
|
|
105
|
+
"ignore": [ ".md$" ],
|
|
106
106
|
},
|
|
107
107
|
],
|
|
108
108
|
"no-restricted-syntax": [
|
|
@@ -133,8 +133,8 @@ export default {
|
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
"selector": "BinaryExpression[operator='instanceof'][right.name='Error']",
|
|
136
|
-
"message": "Avoid 'error instances'. Use the specific specifications of your @odg/exception
|
|
137
|
-
+ "or structural type checking for greater security between packets.",
|
|
136
|
+
"message": "Avoid 'error instances'. Use the specific specifications of your @odg/exception"
|
|
137
|
+
+ "(Exception.isError) or structural type checking for greater security between packets.",
|
|
138
138
|
},
|
|
139
139
|
],
|
|
140
140
|
"no-magic-numbers": [
|
|
@@ -244,6 +244,7 @@ export default {
|
|
|
244
244
|
allowBlockStart: true,
|
|
245
245
|
allowInterfaceStart: true,
|
|
246
246
|
allowTypeStart: true,
|
|
247
|
+
allowArrayStart: true,
|
|
247
248
|
},
|
|
248
249
|
], // Linha em branco antes do comentário
|
|
249
250
|
"@stylistic/lines-between-class-members": [
|
|
@@ -444,7 +445,7 @@ export default {
|
|
|
444
445
|
* Export sempre isolado (antes e depois)
|
|
445
446
|
*/
|
|
446
447
|
{ "blankLine": "always", "prev": "*", "next": EXPORTS },
|
|
447
|
-
{ "blankLine": "
|
|
448
|
+
{ "blankLine": "always", "prev": EXPORTS, "next": EXPORTS },
|
|
448
449
|
|
|
449
450
|
/*
|
|
450
451
|
* ------------------------------------------------------
|
|
@@ -466,10 +467,10 @@ export default {
|
|
|
466
467
|
"@stylistic/space-before-function-paren": [
|
|
467
468
|
"error",
|
|
468
469
|
{
|
|
469
|
-
anonymous: "never",
|
|
470
|
-
named: "never",
|
|
471
|
-
asyncArrow: "always",
|
|
472
|
-
catch: "always",
|
|
470
|
+
"anonymous": "never",
|
|
471
|
+
"named": "never",
|
|
472
|
+
"asyncArrow": "always",
|
|
473
|
+
"catch": "always",
|
|
473
474
|
},
|
|
474
475
|
], // Não permite espaço antes dos parenteses
|
|
475
476
|
"@stylistic/space-in-parens": [ "error", "never" ], // Não permite espaço entre parenteses
|
|
@@ -343,6 +343,84 @@ export default {
|
|
|
343
343
|
"vars-on-top": [ "error" ], // Caso a regra de var seja desativa elas devem ficar no topo
|
|
344
344
|
"strict": [ "error" ], // Strict javascript top file
|
|
345
345
|
"no-shadow-restricted-names": [ "error" ], // Sem variável com palavra reservada
|
|
346
|
+
"id-denylist": [
|
|
347
|
+
"error",
|
|
348
|
+
|
|
349
|
+
// Tipos TS
|
|
350
|
+
"number",
|
|
351
|
+
"string",
|
|
352
|
+
"boolean",
|
|
353
|
+
"any",
|
|
354
|
+
"void",
|
|
355
|
+
"never",
|
|
356
|
+
"unknown",
|
|
357
|
+
|
|
358
|
+
// Controle de Fluxo
|
|
359
|
+
"yield",
|
|
360
|
+
"await",
|
|
361
|
+
"async",
|
|
362
|
+
|
|
363
|
+
// Modificadores de Acesso
|
|
364
|
+
"public",
|
|
365
|
+
"protected",
|
|
366
|
+
"private",
|
|
367
|
+
"readonly",
|
|
368
|
+
"static",
|
|
369
|
+
|
|
370
|
+
// Estrutura
|
|
371
|
+
"class",
|
|
372
|
+
"interface",
|
|
373
|
+
"type",
|
|
374
|
+
"enum",
|
|
375
|
+
"namespace",
|
|
376
|
+
"module",
|
|
377
|
+
|
|
378
|
+
// Declaração
|
|
379
|
+
"function",
|
|
380
|
+
"var",
|
|
381
|
+
"let",
|
|
382
|
+
"const",
|
|
383
|
+
|
|
384
|
+
// Condicionais/Loops
|
|
385
|
+
"if",
|
|
386
|
+
"else",
|
|
387
|
+
"for",
|
|
388
|
+
"while",
|
|
389
|
+
"do",
|
|
390
|
+
"switch",
|
|
391
|
+
"case",
|
|
392
|
+
"default",
|
|
393
|
+
|
|
394
|
+
// Exceções
|
|
395
|
+
"try",
|
|
396
|
+
"catch",
|
|
397
|
+
"finally",
|
|
398
|
+
"throw",
|
|
399
|
+
|
|
400
|
+
// Módulos
|
|
401
|
+
"import",
|
|
402
|
+
"export",
|
|
403
|
+
"from",
|
|
404
|
+
"as",
|
|
405
|
+
|
|
406
|
+
// POO
|
|
407
|
+
"this",
|
|
408
|
+
"super",
|
|
409
|
+
"new",
|
|
410
|
+
"extends",
|
|
411
|
+
"implements",
|
|
412
|
+
|
|
413
|
+
// Genéricos proibidos
|
|
414
|
+
"data",
|
|
415
|
+
"val",
|
|
416
|
+
"obj",
|
|
417
|
+
"item",
|
|
418
|
+
"list",
|
|
419
|
+
"res",
|
|
420
|
+
"req",
|
|
421
|
+
|
|
422
|
+
// "callback", Callback parâmetro é bloqueado tb
|
|
423
|
+
], // Sem variável com palavra reservada
|
|
346
424
|
"logical-assignment-operators": [ "error", "always" ], // Faça ||= ao invés a = a || b
|
|
347
425
|
"no-with": [ "error" ], // Não use with
|
|
348
426
|
|
|
@@ -14,20 +14,20 @@ const allAccessibility = [
|
|
|
14
14
|
/**
|
|
15
15
|
* Order member of class
|
|
16
16
|
*
|
|
17
|
-
* @param {Array<string>}
|
|
17
|
+
* @param {Array<string>} propertyTypes Tags name position
|
|
18
18
|
* @param {string} tag Type of order
|
|
19
19
|
* @param {Array<string>} accessibilityList Accessibility list of class
|
|
20
20
|
* @returns {Array<string>}
|
|
21
21
|
*/
|
|
22
|
-
function orderMember(
|
|
22
|
+
function orderMember(propertyTypes, tag, accessibilityList) {
|
|
23
23
|
return [
|
|
24
|
-
...accessibilityList.flatMap((accessibility) =>
|
|
25
|
-
(
|
|
24
|
+
...accessibilityList.flatMap((accessibility) => propertyTypes.map(
|
|
25
|
+
(propertyType) => {
|
|
26
26
|
const accessibilityName = accessibility ? `${accessibility}-` : "";
|
|
27
27
|
|
|
28
|
-
if (accessibility === "private" &&
|
|
28
|
+
if (accessibility === "private" && propertyType === "abstract") return "";
|
|
29
29
|
|
|
30
|
-
return `${accessibilityName}${
|
|
30
|
+
return `${accessibilityName}${propertyType}-${tag}`;
|
|
31
31
|
},
|
|
32
32
|
)).filter(Boolean),
|
|
33
33
|
`${tag}`,
|
|
@@ -95,8 +95,8 @@ export default {
|
|
|
95
95
|
"@typescript-eslint/array-type": [
|
|
96
96
|
"error",
|
|
97
97
|
{
|
|
98
|
-
default: "array-simple",
|
|
99
|
-
readonly: "array-simple",
|
|
98
|
+
"default": "array-simple",
|
|
99
|
+
"readonly": "array-simple",
|
|
100
100
|
},
|
|
101
101
|
], // Não permite tipos de array incorretos
|
|
102
102
|
"jsdoc/require-returns-check": [ "off" ],
|
|
@@ -167,6 +167,7 @@ export default {
|
|
|
167
167
|
"call-signature",
|
|
168
168
|
|
|
169
169
|
...orderMember([ "static", "decorated", "instance" ], "field", allAccessibility),
|
|
170
|
+
...orderMember([ "abstract" ], "field", allAccessibility),
|
|
170
171
|
|
|
171
172
|
// Static initialization
|
|
172
173
|
"static-initialization",
|
|
@@ -185,7 +186,6 @@ export default {
|
|
|
185
186
|
|
|
186
187
|
// Methods
|
|
187
188
|
...orderMember([ "static", "decorated", "instance" ], "method", allAccessibility),
|
|
188
|
-
...orderMember([ "abstract" ], "field", allAccessibility),
|
|
189
189
|
...orderMember([ "abstract" ], "method", allAccessibility),
|
|
190
190
|
],
|
|
191
191
|
},
|
|
@@ -203,6 +203,7 @@ export default {
|
|
|
203
203
|
"[accessors]",
|
|
204
204
|
"[setters]",
|
|
205
205
|
"[non-accessors]",
|
|
206
|
+
"[static-methods]",
|
|
206
207
|
"[methods]",
|
|
207
208
|
"[conventional-private-methods]",
|
|
208
209
|
"[readonly]",
|