@odg/eslint-config 1.20.2 → 2.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/README.md +10 -0
- package/index.js +3 -0
- package/package.json +24 -21
- package/rules/global/base.js +21 -0
- package/rules/javascript/best-practices.js +12 -1
- package/rules/typescript/best-practices.js +64 -68
- package/rules/typescript/possible-errors.js +1 -1
package/README.md
CHANGED
|
@@ -914,6 +914,7 @@ if (a) {
|
|
|
914
914
|
Enforces consistent spacing before function parenthesis.
|
|
915
915
|
|
|
916
916
|
<https://eslint.org/docs/rules/lines-between-class-members#lines-between-class-members>
|
|
917
|
+
<https://eslint.style/rules/ts/lines-between-class-members>
|
|
917
918
|
|
|
918
919
|
👍 Examples of correct code
|
|
919
920
|
|
|
@@ -1076,6 +1077,7 @@ Enforces default parameters to be last.
|
|
|
1076
1077
|
|
|
1077
1078
|
<https://eslint.org/docs/latest/rules/space-before-function-paren>
|
|
1078
1079
|
<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/space-before-function-paren.md>
|
|
1080
|
+
<https://eslint.style/rules/ts/space-before-function-paren>
|
|
1079
1081
|
|
|
1080
1082
|
👍 Examples of correct code
|
|
1081
1083
|
|
|
@@ -1211,6 +1213,7 @@ Enforces consistent spacing before and after keywords.
|
|
|
1211
1213
|
|
|
1212
1214
|
<https://eslint.org/docs/rules/keyword-spacing#keyword-spacing>
|
|
1213
1215
|
<https://eslint.org/docs/rules/yield-star-spacing>
|
|
1216
|
+
<https://eslint.style/rules/ts/keyword-spacing>
|
|
1214
1217
|
|
|
1215
1218
|
👍 Examples of correct code
|
|
1216
1219
|
|
|
@@ -1642,6 +1645,7 @@ function getY([x, y]) {
|
|
|
1642
1645
|
Putting default parameter at last allows function calls to omit optional tail arguments.
|
|
1643
1646
|
|
|
1644
1647
|
<https://eslint.org/docs/rules/comma-spacing#options>
|
|
1648
|
+
<https://eslint.style/rules/ts/comma-spacing>
|
|
1645
1649
|
|
|
1646
1650
|
👍 Examples of correct code
|
|
1647
1651
|
|
|
@@ -1677,6 +1681,7 @@ This rule enforces consistent use of trailing commas in object and array literal
|
|
|
1677
1681
|
|
|
1678
1682
|
<https://eslint.org/docs/rules/comma-dangle#comma-dangle>
|
|
1679
1683
|
<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/comma-dangle.md>
|
|
1684
|
+
<https://eslint.style/rules/ts/comma-dangle>
|
|
1680
1685
|
|
|
1681
1686
|
👍 Examples of correct code
|
|
1682
1687
|
|
|
@@ -2017,6 +2022,7 @@ Disallows unnecessary parentheses.
|
|
|
2017
2022
|
|
|
2018
2023
|
<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-extra-parens.md>
|
|
2019
2024
|
<https://eslint.org/docs/rules/no-extra-parens#no-extra-parens>
|
|
2025
|
+
<https://eslint.style/rules/ts/no-extra-parens>
|
|
2020
2026
|
|
|
2021
2027
|
👍 Examples of correct code
|
|
2022
2028
|
|
|
@@ -4155,6 +4161,7 @@ class A {
|
|
|
4155
4161
|
Require consistent spacing around type annotations.
|
|
4156
4162
|
|
|
4157
4163
|
<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/type-annotation-spacing.md>
|
|
4164
|
+
<https://eslint.style/rules/ts/type-annotation-spacing>
|
|
4158
4165
|
|
|
4159
4166
|
👍 Examples of correct code
|
|
4160
4167
|
|
|
@@ -7316,7 +7323,9 @@ Requires spacing around infix operators.
|
|
|
7316
7323
|
|
|
7317
7324
|
<https://eslint.org/docs/rules/space-infix-ops>
|
|
7318
7325
|
<https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/space-infix-ops.md>
|
|
7326
|
+
<https://eslint.style/rules/ts/space-infix-ops>
|
|
7319
7327
|
<https://eslint.org/docs/rules/key-spacing>
|
|
7328
|
+
<https://eslint.style/rules/ts/key-spacing>
|
|
7320
7329
|
|
|
7321
7330
|
👍 Examples of correct code
|
|
7322
7331
|
|
|
@@ -8267,6 +8276,7 @@ baz("one", "two",
|
|
|
8267
8276
|
Disallows space between the function name and the opening parenthesis.
|
|
8268
8277
|
|
|
8269
8278
|
<https://eslint.org/docs/latest/rules/func-call-spacing>
|
|
8279
|
+
<https://eslint.style/rules/ts/function-call-spacing>
|
|
8270
8280
|
|
|
8271
8281
|
👍 Examples of correct code
|
|
8272
8282
|
|
package/index.js
CHANGED
|
@@ -12,6 +12,8 @@ module.exports = {
|
|
|
12
12
|
"sonarjs",
|
|
13
13
|
"security",
|
|
14
14
|
"@odg",
|
|
15
|
+
"@stylistic/plus",
|
|
16
|
+
"@stylistic/js",
|
|
15
17
|
],
|
|
16
18
|
extends: [
|
|
17
19
|
"./rules/global/base.js",
|
|
@@ -108,6 +110,7 @@ module.exports = {
|
|
|
108
110
|
"regexp",
|
|
109
111
|
"filenames",
|
|
110
112
|
"sort-class-members",
|
|
113
|
+
"@stylistic/ts",
|
|
111
114
|
],
|
|
112
115
|
extends: [
|
|
113
116
|
"./rules/typescript/best-practices.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odg/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Linter for JavaScript And Typescript project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Dragons Gamers <https://www.linkedin.com/in/victor-alves-odgodinho>",
|
|
@@ -24,36 +24,39 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@babel/core": "*",
|
|
26
26
|
"@odg/eslint-plugin": "*",
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
27
|
+
"@stylistic/eslint-plugin-js": "^2.6.1",
|
|
28
|
+
"@stylistic/eslint-plugin-plus": "^2.6.1",
|
|
29
|
+
"@stylistic/eslint-plugin-ts": "^2.6.1",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
31
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
29
32
|
"any-eslint-parser": "^1.0.1",
|
|
30
33
|
"eslint": "^8",
|
|
31
34
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
32
35
|
"eslint-plugin-antfu": "^0.40.3",
|
|
33
|
-
"eslint-plugin-array-func": "^
|
|
36
|
+
"eslint-plugin-array-func": "^4.0.0",
|
|
34
37
|
"eslint-plugin-better-max-params": "^0.0.1",
|
|
35
|
-
"eslint-plugin-file-progress": "^1.
|
|
38
|
+
"eslint-plugin-file-progress": "^1.4.0",
|
|
36
39
|
"eslint-plugin-filenames": "^1.3.2",
|
|
37
|
-
"eslint-plugin-html": "^
|
|
38
|
-
"eslint-plugin-import": "^2.
|
|
40
|
+
"eslint-plugin-html": "^8.1.1",
|
|
41
|
+
"eslint-plugin-import": "^2.29.1",
|
|
39
42
|
"eslint-plugin-jsdoc": "^46.8.2",
|
|
40
|
-
"eslint-plugin-json-schema-validator": "^
|
|
41
|
-
"eslint-plugin-jsonc": "^2.
|
|
42
|
-
"eslint-plugin-n": "^
|
|
43
|
+
"eslint-plugin-json-schema-validator": "^5.1.2",
|
|
44
|
+
"eslint-plugin-jsonc": "^2.16.0",
|
|
45
|
+
"eslint-plugin-n": "^17.10.1",
|
|
43
46
|
"eslint-plugin-no-constructor-bind": "^2.0.4",
|
|
44
47
|
"eslint-plugin-php-markup": "^6.0.0",
|
|
45
|
-
"eslint-plugin-promise": "^
|
|
48
|
+
"eslint-plugin-promise": "^7.0.0",
|
|
46
49
|
"eslint-plugin-regex": "^1.10.0",
|
|
47
|
-
"eslint-plugin-regexp": "^
|
|
48
|
-
"eslint-plugin-security": "^
|
|
49
|
-
"eslint-plugin-sonar": "^0.
|
|
50
|
-
"eslint-plugin-sonarjs": "^0.
|
|
51
|
-
"eslint-plugin-sort-class-members": "^1.
|
|
52
|
-
"eslint-plugin-toml": "^0.
|
|
53
|
-
"eslint-plugin-unicorn": "^
|
|
54
|
-
"eslint-plugin-unused-imports": "^
|
|
55
|
-
"eslint-plugin-yml": "^1.
|
|
56
|
-
"toml-eslint-parser": "^0.
|
|
50
|
+
"eslint-plugin-regexp": "^2.6.0",
|
|
51
|
+
"eslint-plugin-security": "^3.0.1",
|
|
52
|
+
"eslint-plugin-sonar": "^0.13.0",
|
|
53
|
+
"eslint-plugin-sonarjs": "^1.0.4",
|
|
54
|
+
"eslint-plugin-sort-class-members": "^1.20.0",
|
|
55
|
+
"eslint-plugin-toml": "^0.11.1",
|
|
56
|
+
"eslint-plugin-unicorn": "^55.0.0",
|
|
57
|
+
"eslint-plugin-unused-imports": "^4.0.1",
|
|
58
|
+
"eslint-plugin-yml": "^1.14.0",
|
|
59
|
+
"toml-eslint-parser": "^0.10.0"
|
|
57
60
|
},
|
|
58
61
|
"files": [
|
|
59
62
|
"./index.js",
|
package/rules/global/base.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const indentSize = 4;
|
|
2
|
+
const complexity = 15;
|
|
2
3
|
|
|
3
4
|
module.exports = {
|
|
4
5
|
rules: {
|
|
@@ -16,6 +17,20 @@ module.exports = {
|
|
|
16
17
|
flatTernaryExpressions: false,
|
|
17
18
|
ignoreComments: false,
|
|
18
19
|
} ], // 4 spaces
|
|
20
|
+
"@stylistic/js/indent": [ "error", indentSize, {
|
|
21
|
+
SwitchCase: 1,
|
|
22
|
+
VariableDeclarator: 1,
|
|
23
|
+
outerIIFEBody: 1,
|
|
24
|
+
MemberExpression: 1,
|
|
25
|
+
FunctionDeclaration: { parameters: 1, body: 1 },
|
|
26
|
+
FunctionExpression: { parameters: 1, body: 1 },
|
|
27
|
+
CallExpression: { arguments: 1 },
|
|
28
|
+
ArrayExpression: 1,
|
|
29
|
+
ObjectExpression: 1,
|
|
30
|
+
ImportDeclaration: 1,
|
|
31
|
+
flatTernaryExpressions: false,
|
|
32
|
+
ignoreComments: false,
|
|
33
|
+
} ], // Ajuda indent
|
|
19
34
|
"quotes": [ "error", "double" ], // Aspas duplas
|
|
20
35
|
"capitalized-comments": [ "error", "always", {
|
|
21
36
|
"ignorePattern": "\\s*region.*|\\s*endregion.*",
|
|
@@ -43,6 +58,11 @@ module.exports = {
|
|
|
43
58
|
"semi-spacing": [ "error", { before: false, after: true } ], // Não permite espaço antes do ;
|
|
44
59
|
"no-undef": [ "error", { "typeof": true } ], // Não chame variáveis não definidas
|
|
45
60
|
"regexp/negation": [ "error" ], // This rule enforces use of \D, \W, \S and \P on negation.
|
|
61
|
+
"regexp/prefer-set-operation": [ "error" ],
|
|
62
|
+
"regexp/no-useless-set-operand": [ "error" ],
|
|
63
|
+
"regexp/simplify-set-operations": [ "error" ], // Força simplifica a regex
|
|
64
|
+
"regexp/no-empty-string-literal": [ "error" ], // Não faça blocos vazios de literal
|
|
65
|
+
"regexp/no-useless-string-literal": [ "error" ], // Literal não usada
|
|
46
66
|
"regexp/confusing-quantifier": [ "error" ], // No Especifique quantidade em opcional
|
|
47
67
|
"regexp/control-character-escape": [ "error" ], // Use \r ao invés de \u0009
|
|
48
68
|
"regexp/no-dupe-characters-character-class": [ "error" ], // Rvita condições duplicada em []
|
|
@@ -118,6 +138,7 @@ module.exports = {
|
|
|
118
138
|
"sonarjs/prefer-immediate-return": [ "error" ], // Prefira retornar imediatamente a variável
|
|
119
139
|
"sonarjs/prefer-object-literal": [ "error" ], // Prefira declarar dentro do objeto inicial ao invés de injetar
|
|
120
140
|
"sonarjs/prefer-single-boolean-return": [ "error" ], // Retorne a boolean em vez de fazer if e else
|
|
141
|
+
"sonarjs/cognitive-complexity": [ "error", complexity ], // Complexidade do codigo
|
|
121
142
|
"no-multiple-empty-lines": [
|
|
122
143
|
"error",
|
|
123
144
|
{ "max": 1, "maxEOF": 0, "maxBOF": 0 },
|
|
@@ -205,7 +205,10 @@ module.exports = {
|
|
|
205
205
|
"unicorn/no-useless-length-check": [ "error" ], // Desabilita não usado opcional literals ...
|
|
206
206
|
"unicorn/no-useless-spread": [ "error" ], // Desabilita ... em array desnecessário
|
|
207
207
|
"unicorn/no-useless-switch-case": [ "error" ], // Desabilita Case não usado
|
|
208
|
-
"unicorn/no-useless-undefined": [
|
|
208
|
+
"unicorn/no-useless-undefined": [
|
|
209
|
+
"error",
|
|
210
|
+
{ checkArrowFunctionBody: false },
|
|
211
|
+
], // Desabilita undefined desnecessário
|
|
209
212
|
"unicorn/number-literal-case": [ "error" ],
|
|
210
213
|
"unicorn/prefer-add-event-listener": [ "error" ], // Prefira AddEventListener em vez de onclick props
|
|
211
214
|
"unicorn/prefer-array-find": [ "error" ], // Prefira array Find quando possível
|
|
@@ -225,6 +228,12 @@ module.exports = {
|
|
|
225
228
|
"unicorn/prefer-string-trim-start-end": [ "error" ], // Prefira trim Start/End invés de Left/Right
|
|
226
229
|
"unicorn/prefer-switch": [ "error" ], // Prefira switch
|
|
227
230
|
"unicorn/prefer-ternary": [ "error" ], // Prefira ternário em vez de if else
|
|
231
|
+
"unicorn/no-single-promise-in-promise-methods": [ "error" ], // Promise.all precisa ter mais de 1 promise
|
|
232
|
+
"unicorn/no-await-in-promise-methods": [ "error" ], // Não coloque await dentro Promise.all
|
|
233
|
+
"unicorn/no-invalid-fetch-options": [ "error" ], // Valida função fetch
|
|
234
|
+
"unicorn/consistent-empty-array-spread": [ "error" ], // ... no ternário deve ser 2 dados tipos iguais
|
|
235
|
+
"unicorn/no-negation-in-equality-check": [ "error" ], // Evite if(!a !== b) evite isso
|
|
236
|
+
"unicorn/no-length-as-slice-end": [ "error" ], // Não coloque fim no slice igual ao length
|
|
228
237
|
"unicorn/prevent-abbreviations": [ "error", {
|
|
229
238
|
"ignore": [
|
|
230
239
|
"\\.env$",
|
|
@@ -466,5 +475,7 @@ module.exports = {
|
|
|
466
475
|
"antfu/prefer-inline-type-import": [ "error" ], // Prefira type inline
|
|
467
476
|
"antfu/named-tuple-spacing": [ "error" ], // Solicita espaço depois do : no Typescript types
|
|
468
477
|
"antfu/no-import-node-modules-by-path": [ "error" ], // Não importe de dentro da node_modules,
|
|
478
|
+
"@stylistic/plus/type-generic-spacing": [ "error" ], // De type Foo<T,K> para type Foo<T, K>
|
|
479
|
+
"@stylistic/plus/type-named-tuple-spacing": [ "error" ], // De [i? :number] para [i?: number]
|
|
469
480
|
},
|
|
470
481
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const indentSize = 4;
|
|
2
2
|
const alwaysMultiline = "always-multiline";
|
|
3
|
-
const recordObject = "Record<string, unknown>";
|
|
4
3
|
const allTypes = [
|
|
5
4
|
"static",
|
|
6
5
|
"decorated",
|
|
@@ -38,7 +37,7 @@ module.exports = {
|
|
|
38
37
|
rules: {
|
|
39
38
|
"strict": [ "off" ], // Strict javascript disable
|
|
40
39
|
"indent": [ "off" ], // 4 spaces
|
|
41
|
-
"@
|
|
40
|
+
"@stylistic/ts/indent": [
|
|
42
41
|
"error",
|
|
43
42
|
indentSize,
|
|
44
43
|
{
|
|
@@ -58,16 +57,16 @@ module.exports = {
|
|
|
58
57
|
},
|
|
59
58
|
], // Força indent com 4 espaços
|
|
60
59
|
"quotes": [ "off" ], // Aspas duplas
|
|
61
|
-
"@
|
|
60
|
+
"@stylistic/ts/quotes": [ "error", "double" ], // Força aspas dupla
|
|
62
61
|
"lines-between-class-members": [ "off" ], // Força linha em branco entre props classe e funções
|
|
63
|
-
"@
|
|
62
|
+
"@stylistic/ts/lines-between-class-members": [
|
|
64
63
|
"error",
|
|
65
64
|
"always",
|
|
66
|
-
{ "exceptAfterOverload":
|
|
65
|
+
{ "exceptAfterOverload": true },
|
|
67
66
|
], // Força linha em branco entre props classe e funções
|
|
68
67
|
"@typescript-eslint/explicit-member-accessibility": [ "error" ], // Força visibility para props
|
|
69
68
|
"space-before-function-paren": [ "off" ], // Não permite espaço antes dos parenteses
|
|
70
|
-
"@
|
|
69
|
+
"@stylistic/ts/space-before-function-paren": [ "error", {
|
|
71
70
|
anonymous: "never",
|
|
72
71
|
named: "never",
|
|
73
72
|
asyncArrow: "always",
|
|
@@ -81,7 +80,7 @@ module.exports = {
|
|
|
81
80
|
"default-param-last": [ "off" ], // Parâmetros default devem ficar no final
|
|
82
81
|
"@typescript-eslint/default-param-last": [ "error" ], // Parâmetros default devem ficar no final
|
|
83
82
|
"comma-spacing": [ "off" ],
|
|
84
|
-
"@
|
|
83
|
+
"@stylistic/ts/comma-spacing": [
|
|
85
84
|
"error",
|
|
86
85
|
{
|
|
87
86
|
before: false,
|
|
@@ -89,7 +88,7 @@ module.exports = {
|
|
|
89
88
|
},
|
|
90
89
|
], // Espaço apos a virgula
|
|
91
90
|
"comma-dangle": [ "off" ],
|
|
92
|
-
"@
|
|
91
|
+
"@stylistic/ts/comma-dangle": [ "error", {
|
|
93
92
|
arrays: alwaysMultiline,
|
|
94
93
|
objects: alwaysMultiline,
|
|
95
94
|
imports: alwaysMultiline,
|
|
@@ -103,68 +102,20 @@ module.exports = {
|
|
|
103
102
|
"@typescript-eslint/no-array-constructor": [ "error" ], // Não permite usar new Array()
|
|
104
103
|
"no-useless-constructor": [ "off" ], // Desliga Javascript rule
|
|
105
104
|
"@typescript-eslint/no-useless-constructor": [ "error" ], // Não permite construtores desnecessários
|
|
106
|
-
"no-throw-literal": [ "
|
|
107
|
-
"@typescript-eslint/no-throw-literal": [ "error" ], // Não permite throw "string" ou diferente de classe
|
|
105
|
+
"no-throw-literal": [ "error" ], // Não permite throw "string" ou diferente de classe
|
|
108
106
|
"@typescript-eslint/no-unsafe-assignment": [ "error" ], // Não permite atribuição de tipos inválidos
|
|
109
107
|
"dot-notation": [ "off" ], // Força usar ponto em objeto JS
|
|
110
108
|
"@typescript-eslint/dot-notation": [ "error" ], // Força usar ponto em objeto
|
|
111
|
-
"@
|
|
109
|
+
"@stylistic/ts/type-annotation-spacing": [ "error" ], // Não colocar junto : tipagem
|
|
112
110
|
"no-extra-parens": [ "off" ], // Não permite parênteses extra
|
|
113
|
-
"@
|
|
111
|
+
"@stylistic/ts/no-extra-parens": [ "error" ], // Não permite parênteses extra
|
|
114
112
|
"no-extra-semi": [ "off" ],
|
|
115
|
-
"@
|
|
113
|
+
"@stylistic/ts/no-extra-semi": [ "error" ], // Não permite ;, duplicadas ou desnecessárias
|
|
116
114
|
"@typescript-eslint/no-unnecessary-condition": [ "error" ], // Evita condições sempre true ou false
|
|
117
115
|
"@typescript-eslint/no-misused-promises": [ "error", {
|
|
118
116
|
checksConditionals: false, // Bloqueia condições if de promises sem await
|
|
119
117
|
} ],
|
|
120
118
|
"@typescript-eslint/no-misused-new": [ "error" ], // Não utilize new de forma incorreta em classes/interface
|
|
121
|
-
"@typescript-eslint/ban-types": [
|
|
122
|
-
"error",
|
|
123
|
-
{
|
|
124
|
-
extendDefaults: false,
|
|
125
|
-
types: {
|
|
126
|
-
"BigInt": {
|
|
127
|
-
message: "Use `bigint` instead.",
|
|
128
|
-
fixWith: "bigint",
|
|
129
|
-
},
|
|
130
|
-
"Boolean": {
|
|
131
|
-
message: "Use `boolean` instead.",
|
|
132
|
-
fixWith: "boolean",
|
|
133
|
-
},
|
|
134
|
-
"Number": {
|
|
135
|
-
message: "Use `number` instead.",
|
|
136
|
-
fixWith: "number",
|
|
137
|
-
},
|
|
138
|
-
"Object": {
|
|
139
|
-
message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
|
|
140
|
-
fixWith: recordObject,
|
|
141
|
-
},
|
|
142
|
-
"String": {
|
|
143
|
-
message: "Use `string` instead.",
|
|
144
|
-
fixWith: "string",
|
|
145
|
-
},
|
|
146
|
-
"Symbol": {
|
|
147
|
-
message: "Use `symbol` instead.",
|
|
148
|
-
fixWith: "symbol",
|
|
149
|
-
},
|
|
150
|
-
"{}": {
|
|
151
|
-
message: "The `{}` type is mostly the same as `unknown`. "
|
|
152
|
-
+ "You probably want `Record<string, unknown>` instead.",
|
|
153
|
-
fixWith: recordObject,
|
|
154
|
-
},
|
|
155
|
-
"object": {
|
|
156
|
-
message: "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
|
|
157
|
-
fixWith: recordObject,
|
|
158
|
-
},
|
|
159
|
-
"Function": "Use a specific function type instead, like `() => void`.",
|
|
160
|
-
"[]": "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead.",
|
|
161
|
-
"[[]]": "Don't use `[[]]`. Use `SomeType[][]` instead.",
|
|
162
|
-
"[[[]]]": "Don't use `[[[]]]`. Use `SomeType[][][]` instead.",
|
|
163
|
-
"[[[[]]]]": "🗿🍷 Senhores. Convocando uma reunião",
|
|
164
|
-
"[[[[[]]]]]": "🗿🍷 Senhores. Temos um código todo cracudo 🦄🔥",
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
], // Troques String -> string, Number -> number e etc
|
|
168
119
|
"@typescript-eslint/no-explicit-any": [ "error" ], // Não permite usar any
|
|
169
120
|
"no-empty-function": [ "off" ], // Não permite funções vazias
|
|
170
121
|
"@typescript-eslint/no-empty-function": [ "error" ], // Não permite funções vazias
|
|
@@ -188,9 +139,9 @@ module.exports = {
|
|
|
188
139
|
], // Não permite declaração que não altera expressão
|
|
189
140
|
"@typescript-eslint/no-unsafe-call": [ "error" ], // Não permite chamadas de funções em tipo any
|
|
190
141
|
"space-infix-ops": [ "off" ], // Espaço na separação operadores
|
|
191
|
-
"@
|
|
142
|
+
"@stylistic/ts/space-infix-ops": [ "error" ], // Espaço na separação operadores
|
|
192
143
|
"keyword-spacing": [ "off" ],
|
|
193
|
-
"@
|
|
144
|
+
"@stylistic/ts/keyword-spacing": [ "error", {
|
|
194
145
|
before: true,
|
|
195
146
|
after: true,
|
|
196
147
|
} ],
|
|
@@ -203,15 +154,22 @@ module.exports = {
|
|
|
203
154
|
"no-constructor-bind/no-constructor-bind": [ "error" ], // Não use bind no construtor para própria classe
|
|
204
155
|
"no-constructor-bind/no-constructor-state": [ "error" ],
|
|
205
156
|
"func-call-spacing": [ "off" ], // Não use espaço antes dos parens função
|
|
206
|
-
"@
|
|
157
|
+
"@stylistic/ts/function-call-spacing": [ "error", "never" ], // Não use espaço antes dos parens função
|
|
207
158
|
"object-curly-spacing": [ "off" ], // Espaço declarar objeto
|
|
208
|
-
"@
|
|
159
|
+
"@stylistic/ts/object-curly-spacing": [
|
|
160
|
+
"error",
|
|
161
|
+
"always",
|
|
162
|
+
{
|
|
163
|
+
"arraysInObjects": true,
|
|
164
|
+
"objectsInObjects": false,
|
|
165
|
+
},
|
|
166
|
+
],
|
|
209
167
|
"yield-star-spacing": [ "error", "before" ], // Espaço a esquerda yield
|
|
210
168
|
"switch-colon-spacing": [ "error", { "after": true, "before": false } ], // Não coloque espaço antes do : case
|
|
211
169
|
"semi": [ "off" ], // Use ponto e virgula ts
|
|
212
|
-
"@
|
|
170
|
+
"@stylistic/ts/semi": [ "error", "always" ], // Use ponto e virgula ts
|
|
213
171
|
"padding-line-between-statements": [ "off" ],
|
|
214
|
-
"@
|
|
172
|
+
"@stylistic/ts/padding-line-between-statements": [
|
|
215
173
|
"error",
|
|
216
174
|
{ "blankLine": "always", "prev": "*", "next": "export" }, // Uma linha em branco antes do export
|
|
217
175
|
{ "blankLine": "always", "prev": "export", "next": "*" }, // Uma linha em branco apos o export
|
|
@@ -222,6 +180,7 @@ module.exports = {
|
|
|
222
180
|
{ "blankLine": "always", "prev": "*", "next": "type" }, // Uma linha em branco antes do type
|
|
223
181
|
{ "blankLine": "always", "prev": "type", "next": "*" }, // Uma linha em branco apos o type
|
|
224
182
|
{ "blankLine": "always", "prev": "multiline-block-like", "next": "*" },
|
|
183
|
+
{ "blankLine": "always", "prev": "*", "next": [ "enum", "interface", "type" ] },
|
|
225
184
|
],
|
|
226
185
|
"@typescript-eslint/adjacent-overload-signatures": [ "error" ], // Força overload interface ficarem juntos
|
|
227
186
|
"@typescript-eslint/ban-ts-comment": [
|
|
@@ -265,7 +224,7 @@ module.exports = {
|
|
|
265
224
|
fixStyle: "separate-type-imports",
|
|
266
225
|
},
|
|
267
226
|
],
|
|
268
|
-
"@
|
|
227
|
+
"@stylistic/ts/member-delimiter-style": [
|
|
269
228
|
"error",
|
|
270
229
|
{
|
|
271
230
|
multiline: {
|
|
@@ -316,11 +275,17 @@ module.exports = {
|
|
|
316
275
|
"[static-properties]",
|
|
317
276
|
"[properties]",
|
|
318
277
|
"[conventional-private-properties]",
|
|
278
|
+
"[computed-key-methods]",
|
|
319
279
|
"constructor",
|
|
320
280
|
"[getters]",
|
|
281
|
+
"[accessors]",
|
|
321
282
|
"[setters]",
|
|
283
|
+
"[non-accessors]",
|
|
322
284
|
"[methods]",
|
|
323
285
|
"[conventional-private-methods]",
|
|
286
|
+
"[readonly]",
|
|
287
|
+
"[override]",
|
|
288
|
+
"[abstract]",
|
|
324
289
|
],
|
|
325
290
|
"accessorPairPositioning": "getThenSet",
|
|
326
291
|
"sortInterfaces": true,
|
|
@@ -465,7 +430,7 @@ module.exports = {
|
|
|
465
430
|
"@typescript-eslint/promise-function-async": [ "error" ], // Prefira async function quando retorna Promise
|
|
466
431
|
"@typescript-eslint/require-array-sort-compare": [ "error" ], // Passe parâmetro array sort
|
|
467
432
|
"@typescript-eslint/sort-type-constituents": [ "error" ], // Ordene agrupação de tipos
|
|
468
|
-
"@
|
|
433
|
+
"@stylistic/ts/space-before-blocks": [ "error" ], // Espaço apos antes {} interface e enum
|
|
469
434
|
"no-magic-numbers": [ "off" ], // Desliga Magic number JS
|
|
470
435
|
"@typescript-eslint/no-magic-numbers": [
|
|
471
436
|
"warn",
|
|
@@ -479,5 +444,36 @@ module.exports = {
|
|
|
479
444
|
], // Não permite numero mágicos
|
|
480
445
|
"@typescript-eslint/prefer-for-of": "error",
|
|
481
446
|
"@typescript-eslint/restrict-plus-operands": [ "error" ],
|
|
447
|
+
"@stylistic/ts/block-spacing": [ "error" ], // Espaço em { return true } e apos as chaves {
|
|
448
|
+
"@stylistic/ts/key-spacing": [ "error" ], // De {a:1} para { a: 1 }
|
|
449
|
+
"@stylistic/ts/object-curly-newline": [
|
|
450
|
+
"error",
|
|
451
|
+
{
|
|
452
|
+
"ExportDeclaration": {
|
|
453
|
+
"consistent": true,
|
|
454
|
+
"minProperties": 4,
|
|
455
|
+
"multiline": true,
|
|
456
|
+
},
|
|
457
|
+
"ImportDeclaration": {
|
|
458
|
+
"consistent": true,
|
|
459
|
+
"minProperties": 4,
|
|
460
|
+
"multiline": true,
|
|
461
|
+
},
|
|
462
|
+
"ObjectExpression": {
|
|
463
|
+
"consistent": true,
|
|
464
|
+
"minProperties": 4,
|
|
465
|
+
"multiline": true,
|
|
466
|
+
},
|
|
467
|
+
"ObjectPattern": {
|
|
468
|
+
"consistent": true,
|
|
469
|
+
"minProperties": 4,
|
|
470
|
+
"multiline": true,
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
], // De {a:1} para { a: 1 }
|
|
474
|
+
"@stylistic/ts/object-property-newline": [ "error", {
|
|
475
|
+
allowAllPropertiesOnSameLine: true,
|
|
476
|
+
} ],
|
|
477
|
+
"@stylistic/ts/quote-props": [ "error", "consistent" ],
|
|
482
478
|
},
|
|
483
479
|
};
|
|
@@ -23,7 +23,7 @@ module.exports = {
|
|
|
23
23
|
"error",
|
|
24
24
|
], // Switch com typo coloque default ou todos os casos
|
|
25
25
|
"brace-style": [ "off" ], // Força formatação {}
|
|
26
|
-
"@
|
|
26
|
+
"@stylistic/ts/brace-style": [ "error" ], // Força formatação {}
|
|
27
27
|
"sonarjs/no-extra-arguments": [ "off" ], // Argumentos extra ja é tratado por typescript
|
|
28
28
|
"sonarjs/no-use-of-empty-return-value": [ "off" ], // Não atribua void em uma variável
|
|
29
29
|
"@odg/no-inconsistent-docblock": [ "error" ], // Valida Docblock @param e @return com tipagem
|