@odg/eslint-config 1.6.0 → 1.8.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.js +52 -24
- package/package.json +3 -2
- package/rules/global/base.js +124 -0
- package/rules/{javascript → global}/errors.js +0 -0
- package/rules/{javascript → global}/possible-errors.js +0 -1
- package/rules/{javascript → global}/security.js +0 -0
- package/rules/ini/base.js +0 -1
- package/rules/javascript/best-practices.js +4 -107
- package/rules/javascript/js-documentation.js +0 -1
- package/rules/typescript/best-practices.js +13 -1
- package/rules/typescript/tests.js +3 -0
package/index.js
CHANGED
|
@@ -1,33 +1,23 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
node: true,
|
|
4
|
+
browser: true,
|
|
5
|
+
},
|
|
2
6
|
plugins: [
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"promise",
|
|
7
|
+
"file-progress",
|
|
8
|
+
"json-schema-validator",
|
|
6
9
|
"regexp",
|
|
7
|
-
"
|
|
8
|
-
"security",
|
|
9
|
-
"unicorn",
|
|
10
|
-
"html",
|
|
11
|
-
"n",
|
|
12
|
-
"array-func",
|
|
13
|
-
"no-constructor-bind",
|
|
14
|
-
"anti-trojan-source",
|
|
10
|
+
"import",
|
|
15
11
|
"sonar",
|
|
16
|
-
"regex",
|
|
17
12
|
"sonarjs",
|
|
18
|
-
"
|
|
13
|
+
"security",
|
|
14
|
+
"anti-trojan-source",
|
|
19
15
|
],
|
|
20
|
-
env: {
|
|
21
|
-
node: true,
|
|
22
|
-
browser: true,
|
|
23
|
-
},
|
|
24
16
|
extends: [
|
|
25
|
-
"./rules/
|
|
26
|
-
"./rules/
|
|
27
|
-
"./rules/
|
|
28
|
-
"./rules/
|
|
29
|
-
"./rules/javascript/performance.js",
|
|
30
|
-
"./rules/javascript/possible-errors.js",
|
|
17
|
+
"./rules/global/base.js",
|
|
18
|
+
"./rules/global/errors.js",
|
|
19
|
+
"./rules/global/possible-errors.js",
|
|
20
|
+
"./rules/global/security.js",
|
|
31
21
|
],
|
|
32
22
|
ignorePatterns: [
|
|
33
23
|
"!.*",
|
|
@@ -76,6 +66,32 @@ module.exports = {
|
|
|
76
66
|
ecmaVersion: 2022,
|
|
77
67
|
},
|
|
78
68
|
overrides: [
|
|
69
|
+
{
|
|
70
|
+
files: [ "*.js", "*.jsx", "*.mjs", "*.cjs", "*.ts", "*.tsx", "*.mts", "*.cts" ],
|
|
71
|
+
plugins: [
|
|
72
|
+
"import",
|
|
73
|
+
"jsdoc",
|
|
74
|
+
"promise",
|
|
75
|
+
"regexp",
|
|
76
|
+
"filenames",
|
|
77
|
+
"security",
|
|
78
|
+
"unicorn",
|
|
79
|
+
"html",
|
|
80
|
+
"n",
|
|
81
|
+
"array-func",
|
|
82
|
+
"no-constructor-bind",
|
|
83
|
+
"anti-trojan-source",
|
|
84
|
+
"sonar",
|
|
85
|
+
"regex",
|
|
86
|
+
"sonarjs",
|
|
87
|
+
"json-schema-validator",
|
|
88
|
+
],
|
|
89
|
+
extends: [
|
|
90
|
+
"./rules/javascript/best-practices.js",
|
|
91
|
+
"./rules/javascript/js-documentation.js",
|
|
92
|
+
"./rules/javascript/performance.js",
|
|
93
|
+
],
|
|
94
|
+
},
|
|
79
95
|
{
|
|
80
96
|
files: [ "*.ts", "*.tsx", "*.mts", "*.cts" ],
|
|
81
97
|
plugins: [
|
|
@@ -185,10 +201,22 @@ module.exports = {
|
|
|
185
201
|
files: [
|
|
186
202
|
".gitignore",
|
|
187
203
|
".npmignore",
|
|
204
|
+
"*ignore",
|
|
205
|
+
"*.md",
|
|
206
|
+
"*.bash",
|
|
207
|
+
"*.sh",
|
|
208
|
+
"*.ps1",
|
|
209
|
+
"*.powershell",
|
|
210
|
+
"*.java",
|
|
211
|
+
"*.tf",
|
|
212
|
+
"Jenkinsfile",
|
|
213
|
+
"Dockerfile",
|
|
188
214
|
],
|
|
189
215
|
parser: "any-eslint-parser",
|
|
190
216
|
extends: [ "./rules/any/base.js" ],
|
|
191
217
|
},
|
|
192
218
|
],
|
|
193
|
-
rules: {
|
|
219
|
+
rules: {
|
|
220
|
+
"file-progress/activate": 1,
|
|
221
|
+
},
|
|
194
222
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odg/eslint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.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>",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"lint": "
|
|
8
|
+
"lint": "eslint \"**/*.+(js|jsx|ts|tsx|json|jsonc|json5|yml|yaml|xml|txt|svg|properties|gradle|java|cpp|c|cs|html|css|groovy|gitignore|npmignore|toml|env|example|sample|ini|php|bat|powershell|ps1|sh|bash)\""
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"eslint": "*",
|
|
29
29
|
"eslint-plugin-anti-trojan-source": "^1.1.0",
|
|
30
30
|
"eslint-plugin-array-func": "^3.1.7",
|
|
31
|
+
"eslint-plugin-file-progress": "^1.3.0",
|
|
31
32
|
"eslint-plugin-filenames": "^1.3.2",
|
|
32
33
|
"eslint-plugin-html": "^7.1.0",
|
|
33
34
|
"eslint-plugin-import": "^2.26.0",
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const indentSize = 4;
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
rules: {
|
|
5
|
+
"indent": [ "error", indentSize, {
|
|
6
|
+
SwitchCase: 1,
|
|
7
|
+
VariableDeclarator: 1,
|
|
8
|
+
outerIIFEBody: 1,
|
|
9
|
+
MemberExpression: 1,
|
|
10
|
+
FunctionDeclaration: { parameters: 1, body: 1 },
|
|
11
|
+
FunctionExpression: { parameters: 1, body: 1 },
|
|
12
|
+
CallExpression: { arguments: 1 },
|
|
13
|
+
ArrayExpression: 1,
|
|
14
|
+
ObjectExpression: 1,
|
|
15
|
+
ImportDeclaration: 1,
|
|
16
|
+
flatTernaryExpressions: false,
|
|
17
|
+
ignoreComments: false,
|
|
18
|
+
} ], // 4 spaces
|
|
19
|
+
"quotes": [ "error", "double" ], // Aspas duplas
|
|
20
|
+
"capitalized-comments": [ "error" ], // Comentários devem ser iniciados em letras maiúsculas
|
|
21
|
+
"space-before-function-paren": [ "error", {
|
|
22
|
+
anonymous: "never",
|
|
23
|
+
named: "never",
|
|
24
|
+
asyncArrow: "always",
|
|
25
|
+
} ], // Não permite espaço antes dos parenteses
|
|
26
|
+
"dot-location": [ "error", "property" ], // Object.property ponto junto com a property
|
|
27
|
+
"no-extra-parens": [ "error" ], // Não permite parênteses extra
|
|
28
|
+
"no-extra-semi": [ "error" ], // Não permite ;, duplicadas ou desnecessárias
|
|
29
|
+
"linebreak-style": [ "error", "unix" ], // Força usar \n apenas em vez de \r\n
|
|
30
|
+
"max-len": [ "warn", {
|
|
31
|
+
code: 120,
|
|
32
|
+
ignoreUrls: true,
|
|
33
|
+
} ], // Caracteres máximo por linhas
|
|
34
|
+
"eol-last": [ "error", "always" ], // Força finalizar com \n no final
|
|
35
|
+
"array-bracket-spacing": [ "error", "always" ], // Força usar espaço entre chaves
|
|
36
|
+
"unicode-bom": [ "error", "never" ], // Disabled "unicode-bom"
|
|
37
|
+
"no-self-assign": [ "error" ], // Nao se atribua seu próprio valor a variável
|
|
38
|
+
"array-bracket-newline": [ "error", "consistent" ], // Quebra linha Array
|
|
39
|
+
"no-irregular-whitespace": [ "error" ], // Não permite espaços entre palavras
|
|
40
|
+
"no-floating-decimal": [ "error" ], // Não permite decimais flutuantes sem zero a esquerda.
|
|
41
|
+
"semi-spacing": [ "error", { before: false, after: true } ], // Não permite espaço antes do ;
|
|
42
|
+
"no-undef": [ "error", { "typeof": true } ], // Não chame variáveis não definidas
|
|
43
|
+
"regexp/negation": [ "error" ], // This rule enforces use of \D, \W, \S and \P on negation.
|
|
44
|
+
"regexp/confusing-quantifier": [ "error" ], // No Especifique quantidade em opcional
|
|
45
|
+
"regexp/control-character-escape": [ "error" ], // Use \r ao invés de \u0009
|
|
46
|
+
"regexp/no-dupe-characters-character-class": [ "error" ], // Rvita condições duplicada em []
|
|
47
|
+
"regexp/no-invisible-character": [ "error" ], // Evita colocar tab espaço em regex
|
|
48
|
+
"regexp/no-legacy-features": [ "error", {
|
|
49
|
+
staticProperties: [
|
|
50
|
+
"input",
|
|
51
|
+
"$_",
|
|
52
|
+
"lastMatch",
|
|
53
|
+
"$&",
|
|
54
|
+
"lastParen",
|
|
55
|
+
"$+",
|
|
56
|
+
"leftContext",
|
|
57
|
+
"$`",
|
|
58
|
+
"rightContext",
|
|
59
|
+
"$'",
|
|
60
|
+
"$1",
|
|
61
|
+
"$2",
|
|
62
|
+
"$3",
|
|
63
|
+
"$4",
|
|
64
|
+
"$5",
|
|
65
|
+
"$6",
|
|
66
|
+
"$7",
|
|
67
|
+
"$8",
|
|
68
|
+
"$9",
|
|
69
|
+
],
|
|
70
|
+
prototypeMethods: [ "compile" ],
|
|
71
|
+
} ],
|
|
72
|
+
"regexp/no-non-standard-flag": [ "error" ], // Bloqueia flags não padronizada
|
|
73
|
+
"regexp/no-obscure-range": [ "error" ], // Range regex /[A-\x43]/;
|
|
74
|
+
"regexp/no-trivially-nested-quantifier": [ "error" ], // Bloqueia flags não padronizada
|
|
75
|
+
"regexp/no-unused-capturing-group": [ "error" ], // Não crie grupos que não está sendo usado.
|
|
76
|
+
"regexp/no-useless-character-class": [ "error" ], // Não crie blocos desnecessários
|
|
77
|
+
"regexp/no-useless-flag": [ "error" ], // Não Use Flag desnecessários
|
|
78
|
+
"regexp/no-useless-lazy": [ "error" ],
|
|
79
|
+
"regexp/no-useless-quantifier": [ "error" ], // Não permite Quantifiers sem efeitos
|
|
80
|
+
"regexp/no-useless-range": [ "error" ], // Não permite Range desnecessários
|
|
81
|
+
"regexp/no-useless-two-nums-quantifier": [ "error" ], // Não permite Range Iguais
|
|
82
|
+
"regexp/no-zero-quantifier": [ "error" ], // Não permite Quantidade {0}
|
|
83
|
+
"regexp/optimal-lookaround-quantifier": [ "error" ],
|
|
84
|
+
"regexp/optimal-quantifier-concatenation": [ "error" ],
|
|
85
|
+
"regexp/prefer-quantifier": [ "error" ], // Use {4} ao invés de replicar
|
|
86
|
+
"regexp/prefer-range": [ "error" ], // Prefira [0-9] ao invés [1234567890]
|
|
87
|
+
"regexp/sort-alternatives": [ "error" ], // Coloque [a|b|c] ordem alfabética
|
|
88
|
+
"regexp/hexadecimal-escape": [ "error" ], // \x0a ao invés \u000a
|
|
89
|
+
"regexp/match-any": [ "error" ], // Não da match com qualquer coisa
|
|
90
|
+
"regexp/no-useless-escape": [ "error" ], // Não coloca \ contra em local sem efeito
|
|
91
|
+
"regexp/no-useless-non-capturing-group": [ "error" ], // Grupo não necessário
|
|
92
|
+
"regexp/prefer-character-class": [ "error" ], // Prefira [] ao invés de |
|
|
93
|
+
"regexp/prefer-d": [ "error" ], // Prefira \d
|
|
94
|
+
"regexp/prefer-plus-quantifier": [ "error" ], // Prefira + ao invés de {1, }
|
|
95
|
+
"regexp/prefer-question-quantifier": [ "error" ], // Prefira ? ao invés de {0,1}
|
|
96
|
+
"regexp/prefer-star-quantifier": [ "error" ], // Prefira * ao invés de {0,}
|
|
97
|
+
"regexp/prefer-unicode-codepoint-escapes": [ "error" ], // Use Unicode
|
|
98
|
+
"regexp/prefer-w": [ "error" ], // Use \w
|
|
99
|
+
"regexp/sort-character-class-elements": [ "error" ], // Coloque [] em ordem Alfabética
|
|
100
|
+
"regexp/sort-flags": [ "error" ], // Flag em ordem alfabética
|
|
101
|
+
"regexp/prefer-named-capture-group": [ "error" ], // Prefira group com nomes
|
|
102
|
+
// "regexp/prefer-regexp-exec": [ "error" ], // Prefira exec em regex // ? Desabilitado falso positivo
|
|
103
|
+
"unicorn/no-empty-file": [ "error" ], // Não crie arquivo vazio
|
|
104
|
+
"no-magic-numbers": [
|
|
105
|
+
"warn",
|
|
106
|
+
{ "ignore": [ 0, 1, -1 ], "enforceConst": true, "ignoreDefaultValues": true },
|
|
107
|
+
], // Não permite numero mágicos
|
|
108
|
+
"semi-style": [ "error", "last" ], // Local do ponto e virgula
|
|
109
|
+
"no-negated-condition": [ "error" ], // Não negue condições
|
|
110
|
+
"sonar/regex-complexity": [ "error" ], // Regex Complexidade
|
|
111
|
+
"sonarjs/no-identical-functions": [ "error" ], // Não faça funções iguais
|
|
112
|
+
"sonarjs/no-inverted-boolean-check": [ "error" ], // Não faça funções iguais
|
|
113
|
+
"sonarjs/no-nested-switch": [ "error" ], // Não faça switch dentro do outro
|
|
114
|
+
"sonarjs/no-nested-template-literals": [ "error" ], // Não faça string Template dentro de outra
|
|
115
|
+
"sonarjs/no-redundant-boolean": [ "error" ], // Não faça !false ou `boolReturnFunc() || false`
|
|
116
|
+
"sonarjs/prefer-immediate-return": [ "error" ], // Prefira retornar imediatamente a variável
|
|
117
|
+
"sonarjs/prefer-object-literal": [ "error" ], // Prefira declarar dentro do objeto inicial ao invés de injetar
|
|
118
|
+
"sonarjs/prefer-single-boolean-return": [ "error" ], // Retorne a boolean em vez de fazer if e else
|
|
119
|
+
"no-multiple-empty-lines": [
|
|
120
|
+
"error",
|
|
121
|
+
{ "max": 1, "maxEOF": 0, "maxBOF": 0 },
|
|
122
|
+
], // Não permita varias linhas em branco
|
|
123
|
+
},
|
|
124
|
+
};
|
|
File without changes
|
|
@@ -3,7 +3,6 @@ module.exports = {
|
|
|
3
3
|
"no-extra-bind": [ "error" ], // Não use bind desnecessário
|
|
4
4
|
"no-global-assign": [ "error" ], // Não atribua propriedade globais
|
|
5
5
|
"require-yield": [ "error" ], // Coloque yield em generator functions
|
|
6
|
-
"no-template-curly-in-string": [ "error" ], // Não faça templete string de forma incorreta
|
|
7
6
|
"no-dupe-else-if": [ "error" ], // Não permite elseif duplicado
|
|
8
7
|
"no-useless-backreference": [ "error" ], // Bloqueia regex com referencia inútil
|
|
9
8
|
"no-unused-private-class-members": [ "error" ], // Métodos privados não sendo usados
|
|
File without changes
|
package/rules/ini/base.js
CHANGED
|
@@ -23,7 +23,6 @@ module.exports = {
|
|
|
23
23
|
"toml/array-bracket-spacing": [ "error" ], // Espaço declarar array
|
|
24
24
|
"toml/array-element-newline": [ "error", "consistent" ], // Array multipla linhas
|
|
25
25
|
"toml/comma-style": [ "error" ], // Virgula a direita
|
|
26
|
-
"capitalized-comments": [ "off" ], // Virgula a direita
|
|
27
26
|
"toml/spaced-comment": [ "error" ], // Espaço a esquerda comentário
|
|
28
27
|
"toml/inline-table-curly-spacing": [ "error", "always", {
|
|
29
28
|
arraysInObjects: true,
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
const indentSize = 4;
|
|
2
1
|
const alwaysMultiline = "always-multiline";
|
|
3
2
|
|
|
4
3
|
module.exports = {
|
|
5
4
|
rules: {
|
|
6
|
-
"indent": [ "error", indentSize ], // 4 spaces
|
|
7
5
|
"semi": [ "error", "always" ], // Força usar ponto-virgula ;
|
|
8
|
-
"quotes": [ "error", "double" ], // Aspas duplas
|
|
9
6
|
"lines-between-class-members": [ "error", "always" ], // Força linha em branco entre props classe e funções
|
|
10
|
-
"space-before-function-paren": [ "error", {
|
|
11
|
-
anonymous: "never",
|
|
12
|
-
named: "never",
|
|
13
|
-
asyncArrow: "always",
|
|
14
|
-
} ], // Não permite espaço antes dos parenteses
|
|
15
7
|
"no-unused-vars": [ "error", {
|
|
16
8
|
"vars": "all",
|
|
17
9
|
"args": "after-used",
|
|
@@ -37,9 +29,6 @@ module.exports = {
|
|
|
37
29
|
} ], // Virgula no final de tudo
|
|
38
30
|
"no-array-constructor": [ "error" ], // Não permite usar new Array()
|
|
39
31
|
"no-throw-literal": [ "error" ], // Não permite throw "string" ou diferente de classe
|
|
40
|
-
"dot-location": [ "error", "property" ], // Object.property ponto junto com a property
|
|
41
|
-
"no-extra-parens": [ "error" ], // Não permite parênteses extra
|
|
42
|
-
"no-extra-semi": [ "error" ], // Não permite ;, duplicadas ou desnecessárias
|
|
43
32
|
"no-empty-function": [ "error" ], // Não permite funções vazias
|
|
44
33
|
"no-duplicate-imports": [ "error" ], // Bloqueia import duplicado
|
|
45
34
|
"import/no-duplicates": [ "error" ], // Bloqueia import duplicado
|
|
@@ -49,12 +38,6 @@ module.exports = {
|
|
|
49
38
|
"error",
|
|
50
39
|
{ disallowArithmeticOperators: true },
|
|
51
40
|
], // Protege de optional que pode gerar errors
|
|
52
|
-
"linebreak-style": [ "error", "unix" ], // Força usar \n apenas em vez de \r\n
|
|
53
|
-
"eol-last": [ "error", "always" ], // Força finalizar com \n no final
|
|
54
|
-
"max-len": [ "warn", {
|
|
55
|
-
code: 120,
|
|
56
|
-
ignoreUrls: true,
|
|
57
|
-
} ], // Caracteres máximo por linhas
|
|
58
41
|
"camelcase": [ "error" ], // Força camelCase
|
|
59
42
|
"padded-blocks": [ "error", {
|
|
60
43
|
classes: "always",
|
|
@@ -62,7 +45,6 @@ module.exports = {
|
|
|
62
45
|
switches: "never",
|
|
63
46
|
} ], // Força não usar blocos com espaços
|
|
64
47
|
"no-multi-assign": [ "error" ], // Força não usar atribuição múltipla
|
|
65
|
-
"array-bracket-spacing": [ "error", "always" ], // Força usar espaço entre chaves
|
|
66
48
|
"keyword-spacing": [ "error", {
|
|
67
49
|
before: true,
|
|
68
50
|
after: true,
|
|
@@ -78,22 +60,17 @@ module.exports = {
|
|
|
78
60
|
},
|
|
79
61
|
},
|
|
80
62
|
],
|
|
81
|
-
"unicode-bom": [ "error", "never" ], // Disabled "unicode-bom"
|
|
82
63
|
"space-in-parens": [ "error", "never" ], // Não permite espaço entre parenteses
|
|
83
64
|
"no-multi-spaces": [ "error" ], // Nao permite vários espaços if( i )
|
|
84
65
|
"computed-property-spacing": [ "error", "never" ], // Desliga espaço ao recuperar item $a[ 'I' ] ou $a[ ] = 12;
|
|
85
|
-
"no-self-assign": [ "error" ], // Nao se atribua seu próprio valor a variável
|
|
86
|
-
"array-bracket-newline": [ "error", "consistent" ], // Quebra linha Array
|
|
87
66
|
"prefer-arrow-callback": [ "error" ], // Força arrow function
|
|
88
67
|
"arrow-body-style": [ "error", "as-needed" ], // Força arrow function sem body
|
|
89
68
|
"no-empty": [ "error" ], // Não permite blocos vazios (if, while, for, function, etc)
|
|
90
|
-
|
|
91
69
|
"newline-before-return": [ "error" ], // Força retorno de função com \n antes
|
|
92
70
|
"multiline-comment-style": [ "error", "starred-block" ], // Força /* comentário */ ao invés de // varias vezes
|
|
93
71
|
"no-unreachable": [ "error" ], // Não permite unreachable code
|
|
94
72
|
"no-multi-str": [ "error" ], // Não quebre linha dentro de uma string
|
|
95
73
|
"consistent-this": [ "error", "that" ], // Não permite this em locais inconsistente.
|
|
96
|
-
"no-irregular-whitespace": [ "error" ], // Não permite espaços entre palavras
|
|
97
74
|
"dot-notation": [ "error" ], // Força usar dot em objeto em vez de object["key"]
|
|
98
75
|
"no-whitespace-before-property": [ "error" ], // Não permite espaço antes de property
|
|
99
76
|
"no-trailing-spaces": [ "error" ], // Não permite espaço apos ou antes do ponto
|
|
@@ -116,7 +93,6 @@ module.exports = {
|
|
|
116
93
|
"eqeqeq": [ "error", "always" ], // Usa igual e do mesmo tipo
|
|
117
94
|
"no-extra-label": [ "error" ], // Não permite usar labels extra desnecessárias
|
|
118
95
|
"no-labels": [ "error" ], // Disable Label/GOTO
|
|
119
|
-
"no-floating-decimal": [ "error" ], // Não permite decimais flutuantes sem zero a esquerda.
|
|
120
96
|
"no-native-reassign": [ "error" ], // Não permite reatribuição de funções/vars nativas
|
|
121
97
|
"no-new": [ "error" ], // Não permite usar new sem salva-lo
|
|
122
98
|
"no-new-func": [ "error" ], // Não permite usar new Function()
|
|
@@ -128,13 +104,8 @@ module.exports = {
|
|
|
128
104
|
"no-new-require": [ "error" ], // Não permite usar new require()
|
|
129
105
|
"no-new-object": [ "error" ], // Não permite usar new Object
|
|
130
106
|
"prefer-template": [ "error" ], // Prefer template literals over string concatenation
|
|
131
|
-
"no-multiple-empty-lines": [
|
|
132
|
-
"error",
|
|
133
|
-
{ "max": 1, "maxEOF": 0, "maxBOF": 0 },
|
|
134
|
-
], // Não permita varias linhas em branco
|
|
135
107
|
"no-async-promise-executor": [ "error" ], // Não permita use função async para executar promise
|
|
136
108
|
"prefer-promise-reject-errors": [ "error" ], // Passe uma Exception em promise ao invés de string/number
|
|
137
|
-
"semi-spacing": [ "error", { before: false, after: true } ], // Não permite espaço antes do ;
|
|
138
109
|
"no-var": [ "error" ], // Não user var prefira let ou const
|
|
139
110
|
"promise/no-new-statics": [ "error" ], // Não permite usar new em static promise
|
|
140
111
|
"promise/no-return-wrap": [ "error" ], // Não use promise.resolve ou reject dentro de then e catch
|
|
@@ -160,7 +131,6 @@ module.exports = {
|
|
|
160
131
|
"new-cap": [ "error", { newIsCap: true } ], // New require first Letter uppercase
|
|
161
132
|
"no-caller": [ "error" ], // Não permite usar callee
|
|
162
133
|
"no-script-url": [ "error" ], // Não permite usar script url
|
|
163
|
-
"no-undef": [ "error", { "typeof": true } ], // Não chame variáveis não definidas
|
|
164
134
|
"func-names": [ "error", "as-needed" ], // Nome de funções somente quando necessário
|
|
165
135
|
"no-param-reassign": [ "error" ], // Não permite reatribuição de parâmetros
|
|
166
136
|
"quote-props": [ "error", "consistent" ], // Aspas no objeto somente se algum for necessário
|
|
@@ -177,66 +147,6 @@ module.exports = {
|
|
|
177
147
|
"object-property-newline": [ "error", {
|
|
178
148
|
allowAllPropertiesOnSameLine: true,
|
|
179
149
|
} ], // Quebre todos objetos ou nenhum
|
|
180
|
-
"regexp/confusing-quantifier": [ "error" ], // No Especifique quantidade em opcional
|
|
181
|
-
"regexp/control-character-escape": [ "error" ], // Use \r ao invés de \u0009
|
|
182
|
-
"regexp/negation": [ "error" ], // This rule enforces use of \D, \W, \S and \P on negation.
|
|
183
|
-
"regexp/no-dupe-characters-character-class": [ "error" ], // Rvita condições duplicada em []
|
|
184
|
-
"regexp/no-invisible-character": [ "error" ], // Evita colocar tab espaço em regex
|
|
185
|
-
"regexp/no-legacy-features": [ "error", {
|
|
186
|
-
staticProperties: [
|
|
187
|
-
"input",
|
|
188
|
-
"$_",
|
|
189
|
-
"lastMatch",
|
|
190
|
-
"$&",
|
|
191
|
-
"lastParen",
|
|
192
|
-
"$+",
|
|
193
|
-
"leftContext",
|
|
194
|
-
"$`",
|
|
195
|
-
"rightContext",
|
|
196
|
-
"$'",
|
|
197
|
-
"$1",
|
|
198
|
-
"$2",
|
|
199
|
-
"$3",
|
|
200
|
-
"$4",
|
|
201
|
-
"$5",
|
|
202
|
-
"$6",
|
|
203
|
-
"$7",
|
|
204
|
-
"$8",
|
|
205
|
-
"$9",
|
|
206
|
-
],
|
|
207
|
-
prototypeMethods: [ "compile" ],
|
|
208
|
-
} ],
|
|
209
|
-
"regexp/no-non-standard-flag": [ "error" ], // Bloqueia flags não padronizada
|
|
210
|
-
"regexp/no-obscure-range": [ "error" ], // Range regex /[A-\x43]/;
|
|
211
|
-
"regexp/no-trivially-nested-quantifier": [ "error" ], // Bloqueia flags não padronizada
|
|
212
|
-
"regexp/no-unused-capturing-group": [ "error" ], // Não crie grupos que não está sendo usado.
|
|
213
|
-
"regexp/no-useless-character-class": [ "error" ], // Não crie blocos desnecessários
|
|
214
|
-
"regexp/no-useless-flag": [ "error" ], // Não Use Flag desnecessários
|
|
215
|
-
"regexp/no-useless-lazy": [ "error" ],
|
|
216
|
-
"regexp/no-useless-quantifier": [ "error" ], // Não permite Quantifiers sem efeitos
|
|
217
|
-
"regexp/no-useless-range": [ "error" ], // Não permite Range desnecessários
|
|
218
|
-
"regexp/no-useless-two-nums-quantifier": [ "error" ], // Não permite Range Iguais
|
|
219
|
-
"regexp/no-zero-quantifier": [ "error" ], // Não permite Quantidade {0}
|
|
220
|
-
"regexp/optimal-lookaround-quantifier": [ "error" ],
|
|
221
|
-
"regexp/optimal-quantifier-concatenation": [ "error" ],
|
|
222
|
-
"regexp/prefer-quantifier": [ "error" ], // Use {4} ao invés de replicar
|
|
223
|
-
"regexp/prefer-range": [ "error" ], // Prefira [0-9] ao invés [1234567890]
|
|
224
|
-
"regexp/sort-alternatives": [ "error" ], // Coloque [a|b|c] ordem alfabética
|
|
225
|
-
"regexp/hexadecimal-escape": [ "error" ], // \x0a ao invés \u000a
|
|
226
|
-
"regexp/match-any": [ "error" ], // Não da match com qualquer coisa
|
|
227
|
-
"regexp/no-useless-escape": [ "error" ], // Não coloca \ contra em local sem efeito
|
|
228
|
-
"regexp/no-useless-non-capturing-group": [ "error" ], // Grupo não necessário
|
|
229
|
-
"regexp/prefer-character-class": [ "error" ], // Prefira [] ao invés de |
|
|
230
|
-
"regexp/prefer-d": [ "error" ], // Prefira \d
|
|
231
|
-
"regexp/prefer-plus-quantifier": [ "error" ], // Prefira + ao invés de {1, }
|
|
232
|
-
"regexp/prefer-question-quantifier": [ "error" ], // Prefira ? ao invés de {0,1}
|
|
233
|
-
"regexp/prefer-star-quantifier": [ "error" ], // Prefira * ao invés de {0,}
|
|
234
|
-
"regexp/prefer-unicode-codepoint-escapes": [ "error" ], // Use Unicode
|
|
235
|
-
"regexp/prefer-w": [ "error" ], // Use \w
|
|
236
|
-
"regexp/sort-character-class-elements": [ "error" ], // Coloque [] em ordem Alfabética
|
|
237
|
-
"regexp/sort-flags": [ "error" ], // Flag em ordem alfabética
|
|
238
|
-
"regexp/prefer-named-capture-group": [ "error" ], // Prefira group com nomes
|
|
239
|
-
// "regexp/prefer-regexp-exec": [ "error" ], // Prefira exec em regex // ? Desabilitado falso positivo
|
|
240
150
|
"max-statements-per-line": [ "error", { "max": 1 } ], // Máximo operação em 1 linha
|
|
241
151
|
"arrow-parens": [ "error", "always" ], // Arrow Function sempre com parentese
|
|
242
152
|
"padding-line-between-statements": [
|
|
@@ -277,7 +187,6 @@ module.exports = {
|
|
|
277
187
|
"unicorn/no-array-method-this-argument": [ "error" ], // Evita this array que pode falhar
|
|
278
188
|
"unicorn/no-array-push-push": [ "error" ], // Faça apenas 1 push ao invés de vários
|
|
279
189
|
"unicorn/no-await-expression-member": [ "error" ], // Não use (await getObject()).property;
|
|
280
|
-
"unicorn/no-empty-file": [ "error" ], // Não crie arquivo vazio
|
|
281
190
|
"unicorn/no-for-loop": [ "error" ], // Use ForOf em vez de for
|
|
282
191
|
"unicorn/no-invalid-remove-event-listener": [ "error" ], // Não use removeEventListener Invalid
|
|
283
192
|
"no-lonely-if": [ "error" ], // Não faz if cadeia desnecessário
|
|
@@ -323,14 +232,16 @@ module.exports = {
|
|
|
323
232
|
"unicorn/template-indent": [ "error" ], // Indenter em template string
|
|
324
233
|
"unicorn/no-nested-ternary": [ "error" ], // Ternário ilegível
|
|
325
234
|
"no-shadow": [ "error" ], // Erro caso ja esteja declarado escopo a cima
|
|
326
|
-
"sonar/no-globals-shadowing": [ "error" ], // Não declare palavras reservadas
|
|
327
235
|
"no-delete-var": [ "error" ], // Não delete variáveis
|
|
328
236
|
"no-lone-blocks": [ "error" ], // Não crie bloco desnecessários
|
|
329
237
|
"no-proto": [ "error" ], // Não use __proto__ depreciada desde ECMA 3.1
|
|
330
238
|
"id-length": [ "error", {
|
|
331
239
|
"min": 3,
|
|
332
240
|
"exceptions": [ "i", "fs", "os", "id", "ip" ],
|
|
241
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
242
|
+
"exceptionPatterns": [ "^\\${1,2}[a-z]?$" ],
|
|
333
243
|
} ], // Tamanho mínimo das variáveis
|
|
244
|
+
"no-template-curly-in-string": [ "error" ], // Não faça templete string de forma incorreta
|
|
334
245
|
"max-depth": [ "error", { "max": 3 } ], // Tamanho máximo do Hadouken
|
|
335
246
|
"max-params": [ "error", { "max": 4 } ], // Máximo de parâmetros
|
|
336
247
|
"max-statements": [ "error" ], // Máximo atribuição em função
|
|
@@ -348,10 +259,6 @@ module.exports = {
|
|
|
348
259
|
"no-promise-executor-return": [ "error" ], // Não coloque um retorno em new Promise()
|
|
349
260
|
"no-nonoctal-decimal-escape": [ "error" ], // Não coloque scape em numero decimais
|
|
350
261
|
"prefer-destructuring": [ "error" ], // Prefira desestruturar array ao invés
|
|
351
|
-
"no-magic-numbers": [
|
|
352
|
-
"warn",
|
|
353
|
-
{ "ignore": [ 0, 1, -1 ], "enforceConst": true, "ignoreDefaultValues": true },
|
|
354
|
-
], // Não permite numero mágicos
|
|
355
262
|
"complexity": [ "error", { "max": 10 } ], // Complexidade código
|
|
356
263
|
"func-style": [ "error", "declaration" ], // Declare function name() em vez de var = function()
|
|
357
264
|
"no-else-return": [ "error" ], // Não use else se tem retorno
|
|
@@ -485,7 +392,6 @@ module.exports = {
|
|
|
485
392
|
"no-shadow-restricted-names": [ "error" ], // Sem variável com palavra reservada
|
|
486
393
|
"logical-assignment-operators": [ "error", "always" ], // Faça ||= ao invés a = a || b
|
|
487
394
|
"no-with": [ "error" ], // Não use with
|
|
488
|
-
"semi-style": [ "error", "last" ], // Local do ponto e virgula
|
|
489
395
|
"object-curly-newline": [
|
|
490
396
|
"error",
|
|
491
397
|
{
|
|
@@ -511,7 +417,6 @@ module.exports = {
|
|
|
511
417
|
},
|
|
512
418
|
},
|
|
513
419
|
],
|
|
514
|
-
"no-negated-condition": [ "error" ], // Local do ponto e virgula
|
|
515
420
|
"no-mixed-spaces-and-tabs": [ "error" ],
|
|
516
421
|
"func-name-matching": [
|
|
517
422
|
"error",
|
|
@@ -535,16 +440,8 @@ module.exports = {
|
|
|
535
440
|
"sonar/no-redundant-optional": [ "error" ], // Não use ? e undefined
|
|
536
441
|
"sonar/prefer-type-guard": [ "error" ], // Força retorna is boolean
|
|
537
442
|
"sonar/production-debug": [ "error" ], // Não use debug em prod
|
|
538
|
-
"sonar/regex-complexity": [ "error" ], // Regex Complexidade
|
|
539
443
|
"sonar/shorthand-property-grouping": [ "error" ], // Agrupe { a, b, c:1, d:2}
|
|
540
444
|
"sonar/unused-named-groups": [ "error" ], // Grupos não usados de regex
|
|
541
|
-
|
|
542
|
-
"sonarjs/no-inverted-boolean-check": [ "error" ], // Não faça funções iguais
|
|
543
|
-
"sonarjs/no-nested-switch": [ "error" ], // Não faça switch dentro do outro
|
|
544
|
-
"sonarjs/no-nested-template-literals": [ "error" ], // Não faça string Template dentro de outra
|
|
545
|
-
"sonarjs/no-redundant-boolean": [ "error" ], // Não faça !false ou `boolReturnFunc() || false`
|
|
546
|
-
"sonarjs/prefer-immediate-return": [ "error" ], // Prefira retornar imediatamente a variável
|
|
547
|
-
"sonarjs/prefer-object-literal": [ "error" ], // Prefira declarar dentro do objeto inicial ao invés de injetar
|
|
548
|
-
"sonarjs/prefer-single-boolean-return": [ "error" ], // Retorne a boolean em vez de fazer if e else
|
|
445
|
+
|
|
549
446
|
},
|
|
550
447
|
};
|
|
@@ -3,7 +3,6 @@ module.exports = {
|
|
|
3
3
|
"spaced-comment": [ "error", "always", {
|
|
4
4
|
exceptions: [ "-", "+" ],
|
|
5
5
|
} ], // Força espaço apos do // comentário
|
|
6
|
-
"capitalized-comments": [ "error" ], // Comentários devem ser iniciados em letras maiúsculas
|
|
7
6
|
"jsdoc/check-access": [ "error" ],
|
|
8
7
|
"jsdoc/check-alignment": [ "error" ], // Não desalinhe o * da docblock
|
|
9
8
|
"jsdoc/check-indentation": [ "error" ], // Força formatação na docblock
|
|
@@ -10,7 +10,19 @@ module.exports = {
|
|
|
10
10
|
"error",
|
|
11
11
|
indentSize,
|
|
12
12
|
{
|
|
13
|
-
|
|
13
|
+
SwitchCase: 1,
|
|
14
|
+
VariableDeclarator: 1,
|
|
15
|
+
outerIIFEBody: 1,
|
|
16
|
+
MemberExpression: 1,
|
|
17
|
+
FunctionDeclaration: { parameters: 1, body: 1 },
|
|
18
|
+
FunctionExpression: { parameters: 1, body: 1 },
|
|
19
|
+
CallExpression: { arguments: 1 },
|
|
20
|
+
ArrayExpression: 1,
|
|
21
|
+
ObjectExpression: 1,
|
|
22
|
+
ImportDeclaration: 1,
|
|
23
|
+
flatTernaryExpressions: false,
|
|
24
|
+
ignoreComments: false,
|
|
25
|
+
ignoredNodes: [ "TSTypeParameterInstantiation" ],
|
|
14
26
|
},
|
|
15
27
|
], // Força indent com 4 espaços
|
|
16
28
|
"quotes": [ "off" ], // Aspas duplas
|
|
@@ -8,5 +8,8 @@ module.exports = {
|
|
|
8
8
|
"max-statements": [ "error", MAX_STATEMENTS ],
|
|
9
9
|
"sonar/no-code-after-done": [ "error" ], // Não coloque código depois done test
|
|
10
10
|
"sonar/test-check-exception": [ "error" ], // Test exception
|
|
11
|
+
"unicorn/consistent-function-scoping": [ "error", {
|
|
12
|
+
checkArrowFunctions: false,
|
|
13
|
+
} ], // Remova sub função quando possível
|
|
11
14
|
},
|
|
12
15
|
};
|