@perfective/eslint-config 0.17.0-beta → 0.18.0-beta
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.adoc +2 -2
- package/README.md +2 -2
- package/package.json +13 -13
- package/rules/eslint/possible-problems.js +10 -1
- package/rules/eslint/suggestions.js +2 -0
- package/rules/import/static-analysis.js +2 -2
- package/rules/jest/index.js +1 -0
- package/rules/jsdoc/index.js +1 -0
- package/rules/sonarjs/code-smell-detection.js +1 -1
- package/rules/testing-library/index.js +5 -1
- package/rules/typescript-eslint/extension-rules.js +7 -1
- package/rules/typescript-eslint/rules/typescript-eslint-naming-convention.d.ts +1 -1
- package/rules/typescript-eslint/rules/typescript-eslint-naming-convention.js +4 -0
- package/rules/typescript-eslint/supported-rules.js +14 -2
- package/rules/unicorn/index.js +8 -4
package/README.adoc
CHANGED
|
@@ -7,7 +7,7 @@ As the `@perfective` library itself,
|
|
|
7
7
|
these rules are configured for the TypeScript projects only.
|
|
8
8
|
|
|
9
9
|
In addition to the core https://eslint.org/docs/rules/[ESLint rules]
|
|
10
|
-
and the `link:https://
|
|
10
|
+
and the `link:https://typescript-eslint.io/rules/[@typescript-eslint]` plugin rules,
|
|
11
11
|
`@perfective/eslint-config` configures:
|
|
12
12
|
|
|
13
13
|
* `link:https://github.com/freaktechnik/eslint-plugin-array-func[eslint-plugin-array-func]`;
|
|
@@ -131,7 +131,7 @@ and override `options` for the `unicorn/prevent-abbreviation` rule.
|
|
|
131
131
|
ESLint and its plugins replace most of the https://palantir.github.io/tslint/[TSLint] rules.
|
|
132
132
|
Yet, there are few rules that still need to be supported.
|
|
133
133
|
TSLint rules are executed using the
|
|
134
|
-
https://github.com/typescript-eslint/typescript-eslint/tree/
|
|
134
|
+
https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin-tslint[ESLint Plugin TSLint].
|
|
135
135
|
|
|
136
136
|
`eslint-plugin-tslint` provides only one rule `@typescript-eslint/tslint/config`
|
|
137
137
|
that configures all the remaining TSLint rules,
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ As the `@perfective` library itself,
|
|
|
7
7
|
these rules are configured for the TypeScript projects only.
|
|
8
8
|
|
|
9
9
|
In addition to the core [ESLint rules](https://eslint.org/docs/rules/)
|
|
10
|
-
and the [`@typescript-eslint`](https://
|
|
10
|
+
and the [`@typescript-eslint`](https://typescript-eslint.io/rules/) plugin rules,
|
|
11
11
|
`@perfective/eslint-config` configures:
|
|
12
12
|
|
|
13
13
|
- [`eslint-plugin-array-func`](https://github.com/freaktechnik/eslint-plugin-array-func);
|
|
@@ -79,7 +79,7 @@ Require the configuration in your root `.eslintrc.js` or `.eslintrc.json`.
|
|
|
79
79
|
ESLint and its plugins replace most of the [TSLint](https://palantir.github.io/tslint/) rules.
|
|
80
80
|
Yet, there are few rules that still need to be supported.
|
|
81
81
|
TSLint rules are executed using the
|
|
82
|
-
[ESLint Plugin TSLint](https://github.com/typescript-eslint/typescript-eslint/tree/
|
|
82
|
+
[ESLint Plugin TSLint](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin-tslint).
|
|
83
83
|
|
|
84
84
|
Read the [full documentation](https://github.com/perfective/eslint-config/blob/main/README.adoc)
|
|
85
85
|
in the repository.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perfective/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0-beta",
|
|
4
4
|
"description": "ESLint shareable rules configuration",
|
|
5
5
|
"keywords": ["code quality", "code standard", "code style", "eslint", "eslint-config", "lint", "perfective", "tslint", "tslint-config", "typescript"],
|
|
6
6
|
"author": "Andrey Mikheychik <a.mikheychik@gmail.com>",
|
|
@@ -12,28 +12,28 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"peerDependencies": {
|
|
14
14
|
"@babel/eslint-parser": "^7.17.0",
|
|
15
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
16
|
-
"@typescript-eslint/eslint-plugin-tslint": "^5.
|
|
17
|
-
"@typescript-eslint/parser": "^5.
|
|
18
|
-
"eslint": "^8.
|
|
19
|
-
"eslint-import-resolver-typescript": "^2.
|
|
15
|
+
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
16
|
+
"@typescript-eslint/eslint-plugin-tslint": "^5.30.5",
|
|
17
|
+
"@typescript-eslint/parser": "^5.30.5",
|
|
18
|
+
"eslint": "^8.19.0",
|
|
19
|
+
"eslint-import-resolver-typescript": "^3.2.4",
|
|
20
20
|
"eslint-plugin-array-func": "^3.1.7",
|
|
21
21
|
"eslint-plugin-cypress": "^2.12.1",
|
|
22
22
|
"eslint-plugin-deprecation": "^1.3.2",
|
|
23
23
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
24
|
-
"eslint-plugin-import": "^2.
|
|
25
|
-
"eslint-plugin-jest": "^26.
|
|
26
|
-
"eslint-plugin-jest-dom": "^4.0.
|
|
24
|
+
"eslint-plugin-import": "^2.26.0",
|
|
25
|
+
"eslint-plugin-jest": "^26.5.3",
|
|
26
|
+
"eslint-plugin-jest-dom": "^4.0.2",
|
|
27
27
|
"eslint-plugin-jest-formatting": "^3.1.0",
|
|
28
|
-
"eslint-plugin-jsdoc": "^
|
|
28
|
+
"eslint-plugin-jsdoc": "^39.3.3",
|
|
29
29
|
"eslint-plugin-node": "^11.1.0",
|
|
30
30
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
31
31
|
"eslint-plugin-promise": "^6.0.0",
|
|
32
32
|
"eslint-plugin-rxjs": "^5.0.2",
|
|
33
33
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
34
|
-
"eslint-plugin-sonarjs": "^0.
|
|
35
|
-
"eslint-plugin-testing-library": "^5.
|
|
36
|
-
"eslint-plugin-unicorn": "^
|
|
34
|
+
"eslint-plugin-sonarjs": "^0.13.0",
|
|
35
|
+
"eslint-plugin-testing-library": "^5.5.1",
|
|
36
|
+
"eslint-plugin-unicorn": "^43.0.0",
|
|
37
37
|
"tslint": "^6.1.3"
|
|
38
38
|
},
|
|
39
39
|
"main": "./index.js",
|
|
@@ -13,6 +13,7 @@ module.exports = {
|
|
|
13
13
|
'no-compare-neg-zero': 'error',
|
|
14
14
|
'no-cond-assign': ['error', 'always'],
|
|
15
15
|
'no-const-assign': 'error',
|
|
16
|
+
'no-constant-binary-expression': 'error',
|
|
16
17
|
'no-constant-condition': 'error',
|
|
17
18
|
'no-constructor-return': 'error',
|
|
18
19
|
'no-control-regex': 'error',
|
|
@@ -58,16 +59,24 @@ module.exports = {
|
|
|
58
59
|
'no-unused-vars': ['error', {
|
|
59
60
|
args: 'after-used',
|
|
60
61
|
argsIgnorePattern: '^_',
|
|
62
|
+
caughtErrors: 'all',
|
|
63
|
+
destructuredArrayIgnorePattern: '^_',
|
|
64
|
+
ignoreRestSiblings: false,
|
|
65
|
+
vars: 'all',
|
|
61
66
|
}],
|
|
62
67
|
'no-use-before-define': ['error', {
|
|
63
68
|
functions: false,
|
|
64
69
|
classes: false,
|
|
70
|
+
variables: false,
|
|
71
|
+
allowNamedExports: false,
|
|
65
72
|
}],
|
|
66
73
|
'no-useless-backreference': 'error',
|
|
67
74
|
'require-atomic-updates': ['error', {
|
|
68
75
|
allowProperties: false,
|
|
69
76
|
}],
|
|
70
77
|
'use-isnan': 'error',
|
|
71
|
-
'valid-typeof': 'error',
|
|
78
|
+
'valid-typeof': ['error', {
|
|
79
|
+
requireStringLiterals: true,
|
|
80
|
+
}],
|
|
72
81
|
},
|
|
73
82
|
};
|
|
@@ -54,6 +54,7 @@ module.exports = {
|
|
|
54
54
|
'no-case-declarations': 'error',
|
|
55
55
|
'no-confusing-arrow': ['warn', {
|
|
56
56
|
allowParens: true,
|
|
57
|
+
onlyOneSimpleParam: false,
|
|
57
58
|
}],
|
|
58
59
|
'no-console': 'error',
|
|
59
60
|
'no-continue': 'error',
|
|
@@ -137,6 +138,7 @@ module.exports = {
|
|
|
137
138
|
allowAfterThisConstructor: false,
|
|
138
139
|
allowFunctionParams: true,
|
|
139
140
|
enforceInMethodNames: true,
|
|
141
|
+
enforceInClassFields: true,
|
|
140
142
|
}],
|
|
141
143
|
'no-unneeded-ternary': 'warn',
|
|
142
144
|
'no-unused-expressions': 'error',
|
|
@@ -6,7 +6,7 @@ module.exports = {
|
|
|
6
6
|
caseSensitiveStrict: true,
|
|
7
7
|
}],
|
|
8
8
|
'import/named': ['error', {
|
|
9
|
-
commonjs:
|
|
9
|
+
commonjs: false,
|
|
10
10
|
}],
|
|
11
11
|
'import/default': 'error',
|
|
12
12
|
'import/namespace': 'error',
|
|
@@ -23,6 +23,6 @@ module.exports = {
|
|
|
23
23
|
}],
|
|
24
24
|
'import/no-useless-path-segments': 'warn',
|
|
25
25
|
'import/no-relative-parent-imports': 'off',
|
|
26
|
-
'import/no-relative-packages': '
|
|
26
|
+
'import/no-relative-packages': 'warn',
|
|
27
27
|
},
|
|
28
28
|
};
|
package/rules/jest/index.js
CHANGED
|
@@ -51,6 +51,7 @@ module.exports = {
|
|
|
51
51
|
'jest/prefer-equality-matcher': 'error',
|
|
52
52
|
'jest/prefer-expect-assertions': 'off',
|
|
53
53
|
'jest/prefer-expect-resolves': 'warn',
|
|
54
|
+
'jest/prefer-hooks-in-order': 'error',
|
|
54
55
|
'jest/prefer-hooks-on-top': 'error',
|
|
55
56
|
'jest/prefer-lowercase-title': ['error', {
|
|
56
57
|
allowedPrefixes: [],
|
package/rules/jsdoc/index.js
CHANGED
|
@@ -9,7 +9,7 @@ module.exports = {
|
|
|
9
9
|
'sonarjs/no-duplicate-string': 'off',
|
|
10
10
|
'sonarjs/no-duplicated-branches': 'error',
|
|
11
11
|
'sonarjs/no-gratuitous-expressions': 'error',
|
|
12
|
-
'sonarjs/no-identical-functions': 'error',
|
|
12
|
+
'sonarjs/no-identical-functions': ['error', 3],
|
|
13
13
|
'sonarjs/no-inverted-boolean-check': 'warn',
|
|
14
14
|
'sonarjs/no-nested-switch': 'error',
|
|
15
15
|
'sonarjs/no-nested-template-literals': 'error',
|
|
@@ -16,6 +16,7 @@ module.exports = {
|
|
|
16
16
|
'testing-library/no-container': 'error',
|
|
17
17
|
'testing-library/no-debugging-utils': 'error',
|
|
18
18
|
'testing-library/no-dom-import': 'warn',
|
|
19
|
+
'testing-library/no-global-regexp-flag-in-query': 'warn',
|
|
19
20
|
'testing-library/no-manual-cleanup': 'error',
|
|
20
21
|
'testing-library/no-node-access': 'error',
|
|
21
22
|
'testing-library/no-promise-in-fire-event': 'error',
|
|
@@ -27,7 +28,10 @@ module.exports = {
|
|
|
27
28
|
'testing-library/no-wait-for-snapshot': 'error',
|
|
28
29
|
'testing-library/prefer-explicit-assert': 'error',
|
|
29
30
|
'testing-library/prefer-find-by': 'warn',
|
|
30
|
-
'testing-library/prefer-presence-queries': 'error',
|
|
31
|
+
'testing-library/prefer-presence-queries': ['error', {
|
|
32
|
+
presence: true,
|
|
33
|
+
absence: true,
|
|
34
|
+
}],
|
|
31
35
|
'testing-library/prefer-query-by-disappearance': 'error',
|
|
32
36
|
'testing-library/prefer-user-event': 'error',
|
|
33
37
|
'testing-library/prefer-screen-queries': 'error',
|
|
@@ -55,7 +55,7 @@ module.exports = {
|
|
|
55
55
|
'no-dupe-class-members': 'off',
|
|
56
56
|
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
57
57
|
'no-duplicate-imports': 'off',
|
|
58
|
-
'@typescript-eslint/no-duplicate-imports': ['
|
|
58
|
+
'@typescript-eslint/no-duplicate-imports': ['off', {
|
|
59
59
|
includeExports: true,
|
|
60
60
|
}],
|
|
61
61
|
'no-empty-function': 'off',
|
|
@@ -99,6 +99,10 @@ module.exports = {
|
|
|
99
99
|
'@typescript-eslint/no-unused-vars': ['error', {
|
|
100
100
|
args: 'after-used',
|
|
101
101
|
argsIgnorePattern: '^_',
|
|
102
|
+
caughtErrors: 'all',
|
|
103
|
+
destructuredArrayIgnorePattern: '^_',
|
|
104
|
+
ignoreRestSiblings: false,
|
|
105
|
+
vars: 'all',
|
|
102
106
|
}],
|
|
103
107
|
'no-use-before-define': 'off',
|
|
104
108
|
'@typescript-eslint/no-use-before-define': ['error', {
|
|
@@ -126,6 +130,8 @@ module.exports = {
|
|
|
126
130
|
'@typescript-eslint/return-await': ['warn', 'never'],
|
|
127
131
|
'semi': 'off',
|
|
128
132
|
'@typescript-eslint/semi': ['warn', 'always'],
|
|
133
|
+
'space-before-blocks': 'off',
|
|
134
|
+
'@typescript-eslint/space-before-blocks': ['warn', 'always'],
|
|
129
135
|
'space-before-function-paren': 'off',
|
|
130
136
|
'@typescript-eslint/space-before-function-paren': ['warn', {
|
|
131
137
|
anonymous: 'always',
|
|
@@ -5,7 +5,7 @@ export declare type TypescriptEslintNamingConventionSelector = TypescriptEslintN
|
|
|
5
5
|
export declare type TypescriptEslintNamingConventionUnderscore = 'forbid' | 'require' | 'requireDouble' | 'allow' | 'allowDouble' | 'allowSingleOrDouble';
|
|
6
6
|
export interface TypescriptEslintNamingConvention {
|
|
7
7
|
selector: TypescriptEslintNamingConventionSelector | TypescriptEslintNamingConventionSelector[];
|
|
8
|
-
format
|
|
8
|
+
format: TypescriptEslintNamingConventionFormat[] | null;
|
|
9
9
|
modifiers?: string[];
|
|
10
10
|
leadingUnderscore?: TypescriptEslintNamingConventionUnderscore;
|
|
11
11
|
trailingUnderscore?: TypescriptEslintNamingConventionUnderscore;
|
|
@@ -14,6 +14,10 @@ function typescriptEslintNamingConventionDefaults() {
|
|
|
14
14
|
}, {
|
|
15
15
|
selector: ['memberLike', 'variableLike'],
|
|
16
16
|
format: ['strictCamelCase'],
|
|
17
|
+
}, {
|
|
18
|
+
selector: ['objectLiteralProperty'],
|
|
19
|
+
modifiers: ['requiresQuotes'],
|
|
20
|
+
format: null,
|
|
17
21
|
}, {
|
|
18
22
|
selector: ['parameter'],
|
|
19
23
|
modifiers: ['unused'],
|
|
@@ -24,6 +24,7 @@ module.exports = {
|
|
|
24
24
|
extendDefaults: true,
|
|
25
25
|
}],
|
|
26
26
|
'@typescript-eslint/class-literal-property-style': 'off',
|
|
27
|
+
'@typescript-eslint/consistent-generic-constructors': ['warn', 'type-annotation'],
|
|
27
28
|
'@typescript-eslint/consistent-indexed-object-style': ['warn', 'record'],
|
|
28
29
|
'@typescript-eslint/consistent-type-assertions': ['error', {
|
|
29
30
|
assertionStyle: 'as',
|
|
@@ -117,6 +118,7 @@ module.exports = {
|
|
|
117
118
|
ignoreArrowShorthand: true,
|
|
118
119
|
ignoreVoidOperator: false,
|
|
119
120
|
}],
|
|
121
|
+
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
|
120
122
|
'@typescript-eslint/no-dynamic-delete': 'warn',
|
|
121
123
|
'@typescript-eslint/no-empty-interface': ['off', {
|
|
122
124
|
allowSingleExtends: true,
|
|
@@ -145,12 +147,16 @@ module.exports = {
|
|
|
145
147
|
checkNever: true,
|
|
146
148
|
}],
|
|
147
149
|
'@typescript-eslint/no-misused-new': 'error',
|
|
148
|
-
'@typescript-eslint/no-misused-promises': 'error',
|
|
150
|
+
'@typescript-eslint/no-misused-promises': ['error', {
|
|
151
|
+
checksConditionals: true,
|
|
152
|
+
checksVoidReturn: true,
|
|
153
|
+
}],
|
|
149
154
|
'@typescript-eslint/no-namespace': 'error',
|
|
150
155
|
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
|
|
151
156
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
152
157
|
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
153
158
|
'@typescript-eslint/no-parameter-properties': 'off',
|
|
159
|
+
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
|
154
160
|
'@typescript-eslint/no-require-imports': 'error',
|
|
155
161
|
'@typescript-eslint/no-this-alias': 'error',
|
|
156
162
|
'@typescript-eslint/no-type-alias': 'off',
|
|
@@ -170,6 +176,9 @@ module.exports = {
|
|
|
170
176
|
'@typescript-eslint/no-unsafe-return': 'error',
|
|
171
177
|
'@typescript-eslint/no-var-requires': 'error',
|
|
172
178
|
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
|
|
179
|
+
'@typescript-eslint/parameter-properties': ['error', {
|
|
180
|
+
prefer: 'parameter-property',
|
|
181
|
+
}],
|
|
173
182
|
'@typescript-eslint/prefer-as-const': 'warn',
|
|
174
183
|
'@typescript-eslint/prefer-enum-initializers': 'error',
|
|
175
184
|
'@typescript-eslint/prefer-for-of': 'error',
|
|
@@ -252,6 +261,9 @@ module.exports = {
|
|
|
252
261
|
'@typescript-eslint/unbound-method': ['error', {
|
|
253
262
|
ignoreStatic: true,
|
|
254
263
|
}],
|
|
255
|
-
'@typescript-eslint/unified-signatures': 'error',
|
|
264
|
+
'@typescript-eslint/unified-signatures': ['error', {
|
|
265
|
+
ignoreDifferentlyNamedParameters: true,
|
|
266
|
+
}],
|
|
267
|
+
'@typescript-eslint/no-useless-empty-export': 'warn',
|
|
256
268
|
},
|
|
257
269
|
};
|
package/rules/unicorn/index.js
CHANGED
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
|
20
20
|
'unicorn/filename-case': ['error', {
|
|
21
21
|
case: 'kebabCase',
|
|
22
22
|
}],
|
|
23
|
-
'unicorn/import-index': '
|
|
23
|
+
'unicorn/import-index': 'off',
|
|
24
24
|
'unicorn/import-style': 'off',
|
|
25
25
|
'unicorn/new-for-builtins': 'warn',
|
|
26
26
|
'unicorn/no-abusive-eslint-disable': 'error',
|
|
@@ -55,12 +55,14 @@ module.exports = {
|
|
|
55
55
|
'unicorn/no-thenable': 'error',
|
|
56
56
|
'unicorn/no-this-assignment': 'error',
|
|
57
57
|
'unicorn/no-unreadable-array-destructuring': 'error',
|
|
58
|
+
'unicorn/no-unreadable-iife': 'error',
|
|
58
59
|
'unicorn/no-unsafe-regex': 'error',
|
|
59
60
|
'unicorn/no-unused-properties': 'off',
|
|
60
61
|
'unicorn/no-useless-fallback-in-spread': 'warn',
|
|
61
62
|
'unicorn/no-useless-length-check': 'warn',
|
|
62
63
|
'unicorn/no-useless-promise-resolve-reject': 'warn',
|
|
63
64
|
'unicorn/no-useless-spread': 'warn',
|
|
65
|
+
'unicorn/no-useless-switch-case': 'error',
|
|
64
66
|
'unicorn/no-useless-undefined': 'off',
|
|
65
67
|
'unicorn/no-zero-fractions': 'off',
|
|
66
68
|
'unicorn/number-literal-case': 'warn',
|
|
@@ -96,17 +98,19 @@ module.exports = {
|
|
|
96
98
|
'unicorn/prefer-dom-node-dataset': 'warn',
|
|
97
99
|
'unicorn/prefer-dom-node-remove': 'warn',
|
|
98
100
|
'unicorn/prefer-dom-node-text-content': 'warn',
|
|
101
|
+
'unicorn/prefer-event-target': 'error',
|
|
99
102
|
'unicorn/prefer-export-from': 'warn',
|
|
100
103
|
'unicorn/prefer-includes': 'warn',
|
|
101
104
|
'unicorn/prefer-json-parse-buffer': 'warn',
|
|
102
105
|
'unicorn/prefer-keyboard-event-key': 'warn',
|
|
106
|
+
'unicorn/prefer-logical-operator-over-ternary': 'error',
|
|
103
107
|
'unicorn/prefer-math-trunc': 'warn',
|
|
104
108
|
'unicorn/prefer-modern-dom-apis': 'warn',
|
|
109
|
+
'unicorn/prefer-modern-math-apis': 'warn',
|
|
105
110
|
'unicorn/prefer-module': 'off',
|
|
111
|
+
'unicorn/prefer-native-coercion-functions': 'warn',
|
|
106
112
|
'unicorn/prefer-negative-index': 'warn',
|
|
107
|
-
'unicorn/prefer-node-protocol':
|
|
108
|
-
checkRequire: false,
|
|
109
|
-
}],
|
|
113
|
+
'unicorn/prefer-node-protocol': 'warn',
|
|
110
114
|
'unicorn/prefer-number-properties': ['warn', {
|
|
111
115
|
checkInfinity: true,
|
|
112
116
|
}],
|