@odg/eslint-config 1.17.0 → 1.19.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
CHANGED
|
@@ -518,6 +518,7 @@
|
|
|
518
518
|
- [No Invariant Returns](#no-invariant-returns)
|
|
519
519
|
- [Inconsistent Function Call](#inconsistent-function-call)
|
|
520
520
|
- [Duplicate Conditions](#duplicate-conditions)
|
|
521
|
+
- [Redundant Type Aliases](#redundant-type-aliases)
|
|
521
522
|
- [No Element Overwrite](#no-element-overwrite)
|
|
522
523
|
- [No Empty Collection](#no-empty-collection)
|
|
523
524
|
- [No Extra Arguments](#no-extra-arguments)
|
|
@@ -19821,7 +19822,34 @@ switch (i) { // Noncompliant
|
|
|
19821
19822
|
}
|
|
19822
19823
|
```
|
|
19823
19824
|
|
|
19824
|
-
|
|
19825
|
+
### Redundant Type Aliases
|
|
19826
|
+
|
|
19827
|
+
----------
|
|
19828
|
+
|
|
19829
|
+
Redundant type aliases should not be used
|
|
19830
|
+
|
|
19831
|
+
<https://sonarsource.github.io/rspec/#/rspec/S6564/javascript>
|
|
19832
|
+
|
|
19833
|
+
👍 Examples of correct code
|
|
19834
|
+
|
|
19835
|
+
```typescript
|
|
19836
|
+
function isPalindrom(s: string): boolean {
|
|
19837
|
+
return s === s.split('').reverse().join('');
|
|
19838
|
+
}
|
|
19839
|
+
```
|
|
19840
|
+
|
|
19841
|
+
👎 Examples of incorrect code
|
|
19842
|
+
|
|
19843
|
+
```typescript
|
|
19844
|
+
type MyString = string;
|
|
19845
|
+
type MyBoolean = boolean;
|
|
19846
|
+
|
|
19847
|
+
function isPalindrom(s: MyString): MyBoolean {
|
|
19848
|
+
return s === s.split('').reverse().join('');
|
|
19849
|
+
}
|
|
19850
|
+
```
|
|
19851
|
+
|
|
19852
|
+
### No Element Overwrite
|
|
19825
19853
|
|
|
19826
19854
|
----------
|
|
19827
19855
|
|
|
@@ -19853,7 +19881,7 @@ mySet.add(1);
|
|
|
19853
19881
|
mySet.add(1); // Noncompliant - element is already in the set
|
|
19854
19882
|
```
|
|
19855
19883
|
|
|
19856
|
-
|
|
19884
|
+
### No Empty Collection
|
|
19857
19885
|
|
|
19858
19886
|
----------
|
|
19859
19887
|
|
|
@@ -19886,7 +19914,7 @@ for (str of strings) {} // Noncompliant
|
|
|
19886
19914
|
strings.forEach(str => doSomething(str)); // Noncompliant
|
|
19887
19915
|
```
|
|
19888
19916
|
|
|
19889
|
-
|
|
19917
|
+
### No Extra Arguments
|
|
19890
19918
|
|
|
19891
19919
|
----------
|
|
19892
19920
|
|
|
@@ -19923,7 +19951,7 @@ function say(a, b) {
|
|
|
19923
19951
|
say("hello", "world", "!"); // Noncompliant; last argument is not used
|
|
19924
19952
|
```
|
|
19925
19953
|
|
|
19926
|
-
|
|
19954
|
+
### No Identical Expressions
|
|
19927
19955
|
|
|
19928
19956
|
----------
|
|
19929
19957
|
|
|
@@ -20014,7 +20042,7 @@ function foo() {
|
|
|
20014
20042
|
a = foo();
|
|
20015
20043
|
```
|
|
20016
20044
|
|
|
20017
|
-
|
|
20045
|
+
### No Collection Size Mischeck
|
|
20018
20046
|
|
|
20019
20047
|
----------
|
|
20020
20048
|
|
|
@@ -20045,7 +20073,7 @@ if (someMap.size < 0) {...} // Noncompliant
|
|
|
20045
20073
|
const result = someArray.length >= 0; // Noncompliant
|
|
20046
20074
|
```
|
|
20047
20075
|
|
|
20048
|
-
|
|
20076
|
+
### No Gratuitous Expressions
|
|
20049
20077
|
|
|
20050
20078
|
----------
|
|
20051
20079
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odg/eslint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.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>",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"typescript": "*"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
+
"@typescript-eslint/parser": "*",
|
|
21
22
|
"eslint": "*"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
@@ -28,29 +29,29 @@
|
|
|
28
29
|
"any-eslint-parser": "^1.0.1",
|
|
29
30
|
"eslint": "*",
|
|
30
31
|
"eslint-import-resolver-typescript": "^3.5.5",
|
|
31
|
-
"eslint-plugin-antfu": "^0.
|
|
32
|
+
"eslint-plugin-antfu": "^0.40.0",
|
|
32
33
|
"eslint-plugin-array-func": "^3.1.8",
|
|
33
34
|
"eslint-plugin-better-max-params": "^0.0.1",
|
|
34
35
|
"eslint-plugin-file-progress": "^1.3.0",
|
|
35
36
|
"eslint-plugin-filenames": "^1.3.2",
|
|
36
37
|
"eslint-plugin-html": "^7.1.0",
|
|
37
|
-
"eslint-plugin-import": "^2.
|
|
38
|
-
"eslint-plugin-jsdoc": "^
|
|
39
|
-
"eslint-plugin-json-schema-validator": "^4.
|
|
40
|
-
"eslint-plugin-jsonc": "^2.
|
|
41
|
-
"eslint-plugin-n": "^
|
|
38
|
+
"eslint-plugin-import": "^2.28.0",
|
|
39
|
+
"eslint-plugin-jsdoc": "^46.4.5",
|
|
40
|
+
"eslint-plugin-json-schema-validator": "^4.6.0",
|
|
41
|
+
"eslint-plugin-jsonc": "^2.9.0",
|
|
42
|
+
"eslint-plugin-n": "^16.0.1",
|
|
42
43
|
"eslint-plugin-no-constructor-bind": "^2.0.4",
|
|
43
44
|
"eslint-plugin-php-markup": "^6.0.0",
|
|
44
45
|
"eslint-plugin-promise": "^6.1.1",
|
|
45
46
|
"eslint-plugin-regex": "^1.10.0",
|
|
46
47
|
"eslint-plugin-regexp": "^1.15.0",
|
|
47
48
|
"eslint-plugin-security": "^1.7.1",
|
|
48
|
-
"eslint-plugin-sonar": "^0.
|
|
49
|
+
"eslint-plugin-sonar": "^0.12.0",
|
|
49
50
|
"eslint-plugin-sonarjs": "^0.19.0",
|
|
50
51
|
"eslint-plugin-sort-class-members": "^1.18.0",
|
|
51
52
|
"eslint-plugin-toml": "^0.5.0",
|
|
52
|
-
"eslint-plugin-unicorn": "^
|
|
53
|
-
"eslint-plugin-yml": "^1.
|
|
53
|
+
"eslint-plugin-unicorn": "^48.0.1",
|
|
54
|
+
"eslint-plugin-yml": "^1.8.0",
|
|
54
55
|
"toml-eslint-parser": "^0.6.0"
|
|
55
56
|
},
|
|
56
57
|
"files": [
|
|
@@ -68,6 +68,7 @@ module.exports = {
|
|
|
68
68
|
"sonarjs/no-duplicated-branches": [ "error" ], // Em vez de if else igual faça um ||
|
|
69
69
|
"sonarjs/no-gratuitous-expressions": [ "error" ], // Não faça a mesma condição dentro de outra
|
|
70
70
|
"sonarjs/no-unused-collection": [ "error" ], // Não faça array que não é usado
|
|
71
|
+
"sonar/redundant-type-aliases": [ "error" ], // Não crie tipos redundantes
|
|
71
72
|
"regexp/no-extra-lookaround-assertions": [ "error" ], // Look around invalido em regex
|
|
72
73
|
},
|
|
73
74
|
};
|
|
@@ -455,5 +455,7 @@ module.exports = {
|
|
|
455
455
|
"antfu/generic-spacing": [ "error" ], // String<a,b> => String<a, b>
|
|
456
456
|
"antfu/import-dedupe": [ "error" ], // Auto fix import duplicados
|
|
457
457
|
"antfu/prefer-inline-type-import": [ "error" ], // Prefira type inline
|
|
458
|
+
"antfu/named-tuple-spacing": [ "error" ], // Solicita espaço depois do : no Typescript types
|
|
459
|
+
"antfu/no-import-node-modules-by-path": [ "error" ], // Não importe de dentro da node_modules,
|
|
458
460
|
},
|
|
459
461
|
};
|
|
@@ -477,6 +477,6 @@ module.exports = {
|
|
|
477
477
|
},
|
|
478
478
|
], // Não permite numero mágicos
|
|
479
479
|
"@typescript-eslint/prefer-for-of": "error",
|
|
480
|
-
"@typescript-eslint/restrict-plus-operands": [ "error"
|
|
480
|
+
"@typescript-eslint/restrict-plus-operands": [ "error" ],
|
|
481
481
|
},
|
|
482
482
|
};
|
|
@@ -27,5 +27,6 @@ module.exports = {
|
|
|
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
|
|
30
|
+
"antfu/no-const-enum": [ "error" ], // Não coloque enum em constant
|
|
30
31
|
},
|
|
31
32
|
};
|