@perfective/eslint-config 0.26.1 → 0.27.1
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 +5 -46
- package/README.md +5 -21
- package/index.js +0 -3
- package/package.json +21 -27
- package/rules/cypress/index.js +1 -0
- package/rules/import/style-guide.js +3 -1
- package/rules/jest/index.js +8 -0
- package/rules/jest/typescript-eslint.js +1 -1
- package/rules/jsdoc/index.js +7 -1
- package/rules/promise/index.js +3 -0
- package/rules/stylistic/jsx/index.js +1 -1
- package/rules/stylistic/plus/index.js +3 -0
- package/rules/typescript-eslint/extension-rules.js +2 -4
- package/rules/typescript-eslint/supported-rules.js +35 -16
- package/rules/unicorn/index.js +4 -0
- package/rules.d.ts +0 -1
- package/rules.js +1 -3
- package/rules/deprecation/index.js +0 -9
- package/rules/jest-formatting/index.js +0 -16
- package/rules/typescript-eslint/rules/typescript-eslint-tslint-config.d.ts +0 -7
- package/rules/typescript-eslint/rules/typescript-eslint-tslint-config.js +0 -34
- package/rules/typescript-eslint/tslint.js +0 -10
package/README.adoc
CHANGED
|
@@ -12,13 +12,10 @@ and https://eslint.style[ESLint Stylistic] plugin rules,
|
|
|
12
12
|
|
|
13
13
|
* `link:https://github.com/freaktechnik/eslint-plugin-array-func[eslint-plugin-array-func]`;
|
|
14
14
|
* `link:https://github.com/cypress-io/eslint-plugin-cypress[eslint-plugin-cypress]` _(optional)_;
|
|
15
|
-
* `link:https://github.com/gund/eslint-plugin-deprecation[eslint-plugin-deprecation]`;
|
|
16
15
|
* `link:https://mysticatea.github.io/eslint-plugin-eslint-comments/[eslint-plugin-eslint-comments]`;
|
|
17
16
|
* `link:https://github.com/import-js/eslint-plugin-import[eslint-plugin-import]`;
|
|
18
17
|
* `link:https://github.com/jest-community/eslint-plugin-jest[eslint-plugin-jest]` _(optional)_;
|
|
19
18
|
* `link:https://github.com/testing-library/eslint-plugin-jest-dom[eslint-plugin-jest-dom]` _(optional)_;
|
|
20
|
-
* `link:https://github.com/dangreenisrael/eslint-plugin-jest-formatting[eslint-plugin-jest-formatting]`
|
|
21
|
-
_(optional, required if `eslint-plugin-jest` is installed)_;
|
|
22
19
|
* `link:https://github.com/gajus/eslint-plugin-jsdoc[eslint-plugin-jsdoc]`;
|
|
23
20
|
* `link:https://github.com/eslint-community/eslint-plugin-n[eslint-plugin-n]`;
|
|
24
21
|
* `link:https://github.com/TristonJ/eslint-plugin-prefer-arrow[eslint-plugin-prefer-arrow]`;
|
|
@@ -46,13 +43,15 @@ npm install --save-dev \
|
|
|
46
43
|
@perfective/eslint-config \
|
|
47
44
|
@babel/eslint-parser \
|
|
48
45
|
@stylistic/eslint-plugin \
|
|
46
|
+
@stylistic/eslint-plugin-js \
|
|
47
|
+
@stylistic/eslint-plugin-jsx \
|
|
48
|
+
@stylistic/eslint-plugin-ts \
|
|
49
|
+
@stylistic/eslint-plugin-plus \
|
|
49
50
|
@typescript-eslint/eslint-plugin \
|
|
50
|
-
@typescript-eslint/eslint-plugin-tslint \
|
|
51
51
|
@typescript-eslint/parser \
|
|
52
52
|
eslint \
|
|
53
53
|
eslint-import-resolver-typescript \
|
|
54
54
|
eslint-plugin-array-func \
|
|
55
|
-
eslint-plugin-deprecation \
|
|
56
55
|
eslint-plugin-eslint-comments \
|
|
57
56
|
eslint-plugin-import \
|
|
58
57
|
eslint-plugin-jsdoc \
|
|
@@ -62,8 +61,7 @@ npm install --save-dev \
|
|
|
62
61
|
eslint-plugin-security \
|
|
63
62
|
eslint-plugin-simple-import-sort \
|
|
64
63
|
eslint-plugin-sonarjs \
|
|
65
|
-
eslint-plugin-unicorn
|
|
66
|
-
tslint
|
|
64
|
+
eslint-plugin-unicorn
|
|
67
65
|
----
|
|
68
66
|
+
|
|
69
67
|
. Install optional peer dependencies that add linting rules for the tools you use.
|
|
@@ -74,17 +72,10 @@ npm install --save-dev \
|
|
|
74
72
|
eslint-plugin-cypress \
|
|
75
73
|
eslint-plugin-jest \
|
|
76
74
|
eslint-plugin-jest-dom \
|
|
77
|
-
eslint-plugin-jest-formatting \
|
|
78
75
|
eslint-plugin-rxjs \
|
|
79
76
|
eslint-plugin-testing-library
|
|
80
77
|
----
|
|
81
78
|
+
|
|
82
|
-
[WARNING]
|
|
83
|
-
====
|
|
84
|
-
The `eslint-plugin-jest-formatting` module is required,
|
|
85
|
-
if the `eslint-plugin-jest` module is installed.
|
|
86
|
-
====
|
|
87
|
-
+
|
|
88
79
|
The `@perfective/eslint-config` automatically includes rules for these plugins,
|
|
89
80
|
if the dependency is installed.
|
|
90
81
|
+
|
|
@@ -142,42 +133,11 @@ So rules should be required from those packages for correct `node_modules` resol
|
|
|
142
133
|
for the `simple-import-sort/imports` rule.
|
|
143
134
|
* `typescriptEslintNamingConvention(extensions)`
|
|
144
135
|
— extends configuration for the `@typescript-eslint/naming-convention` rule.
|
|
145
|
-
* `typescriptEslintTslintConfig(rules, directories)`
|
|
146
|
-
— overrides `rules` and provides custom `directories`
|
|
147
|
-
for the `@typescript-eslint/tslint/config` rule.
|
|
148
136
|
* `unicornPreventAbbreviations(replacements, options)`
|
|
149
137
|
— extends and overrides the list of `replacements`
|
|
150
138
|
and `options` for the `unicorn/prevent-abbreviation` rule.
|
|
151
139
|
|
|
152
140
|
|
|
153
|
-
== TSLint
|
|
154
|
-
|
|
155
|
-
ESLint and its plugins replace most of the https://palantir.github.io/tslint/[TSLint] rules.
|
|
156
|
-
Yet, a few rules still need to be supported.
|
|
157
|
-
TSLint rules are executed using the
|
|
158
|
-
https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin-tslint[ESLint Plugin TSLint].
|
|
159
|
-
|
|
160
|
-
`eslint-plugin-tslint` provides only one rule `@typescript-eslint/tslint/config`
|
|
161
|
-
that configures all the remaining TSLint rules,
|
|
162
|
-
so in order to override some of them,
|
|
163
|
-
use the `typescriptEslintTslintConfig()` config function from the '@perfective/eslint-config/rules':
|
|
164
|
-
|
|
165
|
-
[source,typescript]
|
|
166
|
-
----
|
|
167
|
-
import { typescriptEslintTslintConfig } from '@perfective/eslint-config/rules';
|
|
168
|
-
|
|
169
|
-
export = {
|
|
170
|
-
rules: {
|
|
171
|
-
'@typescript-eslint/tslint/config': ['error', typescriptEslintTslintConfig({
|
|
172
|
-
'no-default-import': false, // <.>
|
|
173
|
-
})],
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
----
|
|
177
|
-
<1> Overrides only one of the rules
|
|
178
|
-
while keeping all others set by default.
|
|
179
|
-
|
|
180
|
-
|
|
181
141
|
== Internals
|
|
182
142
|
|
|
183
143
|
The rules for each plugin are described in the `./src/rules/{plugin}` subdirectories,
|
|
@@ -195,4 +155,3 @@ The final configuration extends each plugin configuration on a file-type basis.
|
|
|
195
155
|
== Roadmap
|
|
196
156
|
|
|
197
157
|
* Add the `@perfective/eslint-plugin` with the rules for working with the `@perfective` packages.
|
|
198
|
-
* Replace all TSLint rules with ESLint rules.
|
package/README.md
CHANGED
|
@@ -12,13 +12,10 @@ and [ESlint Stylistic](https://eslint.style) plugin rules,
|
|
|
12
12
|
|
|
13
13
|
- [`eslint-plugin-array-func`](https://github.com/freaktechnik/eslint-plugin-array-func);
|
|
14
14
|
- [`eslint-plugin-cypress`](https://github.com/cypress-io/eslint-plugin-cypress) _(optional)_;
|
|
15
|
-
- [`eslint-plugin-deprecation`](https://github.com/gund/eslint-plugin-deprecation);
|
|
16
15
|
- [`eslint-plugin-eslint-comments`](https://mysticatea.github.io/eslint-plugin-eslint-comments/);
|
|
17
16
|
- [`eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import);
|
|
18
17
|
- [`eslint-plugin-jest`](https://github.com/jest-community/eslint-plugin-jest) _(optional)_;
|
|
19
18
|
- [`eslint-plugin-jest-dom`](https://github.com/testing-library/eslint-plugin-jest-dom) _(optional)_;
|
|
20
|
-
- [`eslint-plugin-jest-formatting`](https://github.com/dangreenisrael/eslint-plugin-jest-formatting)
|
|
21
|
-
_(optional, required if `eslint-plugin-jest` is installed)_;
|
|
22
19
|
- [`eslint-plugin-jsdoc`](https://github.com/gajus/eslint-plugin-jsdoc);
|
|
23
20
|
- [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n);
|
|
24
21
|
- [`eslint-plugin-prefer-arrow`](https://github.com/TristonJ/eslint-plugin-prefer-arrow);
|
|
@@ -44,13 +41,15 @@ from issues that will be fixed automatically.
|
|
|
44
41
|
@perfective/eslint-config \
|
|
45
42
|
@babel/eslint-parser \
|
|
46
43
|
@stylistic/eslint-plugin \
|
|
44
|
+
@stylistic/eslint-plugin-js \
|
|
45
|
+
@stylistic/eslint-plugin-jsx \
|
|
46
|
+
@stylistic/eslint-plugin-ts \
|
|
47
|
+
@stylistic/eslint-plugin-plus \
|
|
47
48
|
@typescript-eslint/eslint-plugin \
|
|
48
|
-
@typescript-eslint/eslint-plugin-tslint \
|
|
49
49
|
@typescript-eslint/parser \
|
|
50
50
|
eslint \
|
|
51
51
|
eslint-import-resolver-typescript \
|
|
52
52
|
eslint-plugin-array-func \
|
|
53
|
-
eslint-plugin-deprecation \
|
|
54
53
|
eslint-plugin-eslint-comments \
|
|
55
54
|
eslint-plugin-import \
|
|
56
55
|
eslint-plugin-jsdoc \
|
|
@@ -60,8 +59,7 @@ from issues that will be fixed automatically.
|
|
|
60
59
|
eslint-plugin-security \
|
|
61
60
|
eslint-plugin-simple-import-sort \
|
|
62
61
|
eslint-plugin-sonarjs \
|
|
63
|
-
eslint-plugin-unicorn
|
|
64
|
-
tslint
|
|
62
|
+
eslint-plugin-unicorn
|
|
65
63
|
```
|
|
66
64
|
|
|
67
65
|
2. Install optional peer dependencies that add linting rules for the tools you use.
|
|
@@ -71,14 +69,10 @@ from issues that will be fixed automatically.
|
|
|
71
69
|
eslint-plugin-cypress \
|
|
72
70
|
eslint-plugin-jest \
|
|
73
71
|
eslint-plugin-jest-dom \
|
|
74
|
-
eslint-plugin-jest-formatting \
|
|
75
72
|
eslint-plugin-rxjs \
|
|
76
73
|
eslint-plugin-testing-library
|
|
77
74
|
```
|
|
78
75
|
|
|
79
|
-
The `eslint-plugin-jest-formatting` module is required,
|
|
80
|
-
if the `eslint-plugin-jest` module is installed.
|
|
81
|
-
|
|
82
76
|
The `@perfective/eslint-config` automatically includes rules for these plugins,
|
|
83
77
|
if the dependency is installed.
|
|
84
78
|
|
|
@@ -89,13 +83,3 @@ from issues that will be fixed automatically.
|
|
|
89
83
|
extends: ['@perfective/eslint-config'],
|
|
90
84
|
};
|
|
91
85
|
```
|
|
92
|
-
|
|
93
|
-
## TSLint
|
|
94
|
-
|
|
95
|
-
ESLint and its plugins replace most of the [TSLint](https://palantir.github.io/tslint/) rules.
|
|
96
|
-
Yet, a few rules still need to be supported.
|
|
97
|
-
TSLint rules are executed using the
|
|
98
|
-
[ESLint Plugin TSLint](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin-tslint).
|
|
99
|
-
|
|
100
|
-
Read the [full documentation](https://github.com/perfective/eslint-config/blob/main/README.adoc)
|
|
101
|
-
in the repository.
|
package/index.js
CHANGED
|
@@ -68,8 +68,6 @@ module.exports = {
|
|
|
68
68
|
},
|
|
69
69
|
extends: [
|
|
70
70
|
'./rules/typescript-eslint',
|
|
71
|
-
'./rules/typescript-eslint/tslint',
|
|
72
|
-
'./rules/deprecation',
|
|
73
71
|
'./rules/stylistic/ts',
|
|
74
72
|
(0, plugin_1.optionalRules)('rxjs'),
|
|
75
73
|
].filter(Boolean),
|
|
@@ -103,7 +101,6 @@ module.exports = {
|
|
|
103
101
|
extends: [
|
|
104
102
|
'./rules/jest',
|
|
105
103
|
(0, plugin_1.optionalRules)('jest-dom'),
|
|
106
|
-
'./rules/jest-formatting',
|
|
107
104
|
(0, plugin_1.optionalRules)('testing-library'),
|
|
108
105
|
].filter(Boolean),
|
|
109
106
|
rules: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perfective/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.1",
|
|
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>",
|
|
@@ -11,32 +11,32 @@
|
|
|
11
11
|
},
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@babel/eslint-parser": "^7.
|
|
15
|
-
"@stylistic/eslint-plugin": "^2.
|
|
16
|
-
"@
|
|
17
|
-
"@
|
|
18
|
-
"@
|
|
19
|
-
"eslint": "^
|
|
20
|
-
"eslint-
|
|
14
|
+
"@babel/eslint-parser": "^7.25.9",
|
|
15
|
+
"@stylistic/eslint-plugin": "^2.10.1",
|
|
16
|
+
"@stylistic/eslint-plugin-js": "^2.10.1",
|
|
17
|
+
"@stylistic/eslint-plugin-jsx": "^2.10.1",
|
|
18
|
+
"@stylistic/eslint-plugin-plus": "^2.10.1",
|
|
19
|
+
"@stylistic/eslint-plugin-ts": "^2.10.1",
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^8.14.0",
|
|
21
|
+
"@typescript-eslint/parser": "^8.14.0",
|
|
22
|
+
"eslint": "^8.57.1",
|
|
23
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
|
21
24
|
"eslint-plugin-array-func": "^4.0.0",
|
|
22
|
-
"eslint-plugin-cypress": "^3.
|
|
23
|
-
"eslint-plugin-deprecation": "^3.0.0",
|
|
25
|
+
"eslint-plugin-cypress": "^3.6.0",
|
|
24
26
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
25
|
-
"eslint-plugin-import": "^2.
|
|
26
|
-
"eslint-plugin-jest": "^28.
|
|
27
|
+
"eslint-plugin-import": "^2.31.0",
|
|
28
|
+
"eslint-plugin-jest": "^28.9.0",
|
|
27
29
|
"eslint-plugin-jest-dom": "^5.4.0",
|
|
28
|
-
"eslint-plugin-
|
|
29
|
-
"eslint-plugin-
|
|
30
|
-
"eslint-plugin-n": "^17.9.0",
|
|
30
|
+
"eslint-plugin-jsdoc": "^50.5.0",
|
|
31
|
+
"eslint-plugin-n": "^17.13.1",
|
|
31
32
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
32
|
-
"eslint-plugin-promise": "^
|
|
33
|
+
"eslint-plugin-promise": "^7.1.0",
|
|
33
34
|
"eslint-plugin-rxjs": "^5.0.3",
|
|
34
35
|
"eslint-plugin-security": "^3.0.1",
|
|
35
|
-
"eslint-plugin-simple-import-sort": "^12.1.
|
|
36
|
-
"eslint-plugin-sonarjs": "^1.0.
|
|
37
|
-
"eslint-plugin-testing-library": "^6.
|
|
38
|
-
"eslint-plugin-unicorn": "^
|
|
39
|
-
"tslint": "^6.1.3"
|
|
36
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
37
|
+
"eslint-plugin-sonarjs": "^1.0.4",
|
|
38
|
+
"eslint-plugin-testing-library": "^6.4.0",
|
|
39
|
+
"eslint-plugin-unicorn": "^56.0.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
42
|
"eslint-plugin-cypress": {
|
|
@@ -48,9 +48,6 @@
|
|
|
48
48
|
"eslint-plugin-jest-dom": {
|
|
49
49
|
"optional": true
|
|
50
50
|
},
|
|
51
|
-
"eslint-plugin-jest-formatting": {
|
|
52
|
-
"optional": true
|
|
53
|
-
},
|
|
54
51
|
"eslint-plugin-rxjs": {
|
|
55
52
|
"optional": true
|
|
56
53
|
},
|
|
@@ -58,9 +55,6 @@
|
|
|
58
55
|
"optional": true
|
|
59
56
|
}
|
|
60
57
|
},
|
|
61
|
-
"overrides": {
|
|
62
|
-
"glob-parent": "^5.1.2"
|
|
63
|
-
},
|
|
64
58
|
"main": "./index.js",
|
|
65
59
|
"directories": {
|
|
66
60
|
"lib": "./"
|
package/rules/cypress/index.js
CHANGED
|
@@ -5,6 +5,7 @@ module.exports = (0, plugin_1.optionalConfig)('cypress', {
|
|
|
5
5
|
'cypress/no-assigning-return-values': 'error',
|
|
6
6
|
'cypress/no-async-before': 'error',
|
|
7
7
|
'cypress/no-async-tests': 'error',
|
|
8
|
+
'cypress/no-debug': 'error',
|
|
8
9
|
'cypress/no-force': 'error',
|
|
9
10
|
'cypress/no-pause': 'error',
|
|
10
11
|
'cypress/no-unnecessary-waiting': 'error',
|
|
@@ -4,7 +4,9 @@ module.exports = {
|
|
|
4
4
|
'import/consistent-type-specifier-style': ['warn', 'prefer-inline'],
|
|
5
5
|
'import/dynamic-import-chunkname': 'off',
|
|
6
6
|
'import/exports-last': 'off',
|
|
7
|
-
'import/extensions': ['error', 'never'
|
|
7
|
+
'import/extensions': ['error', 'never', {
|
|
8
|
+
checkTypeImports: true,
|
|
9
|
+
}],
|
|
8
10
|
'import/first': 'off',
|
|
9
11
|
'import/group-exports': 'off',
|
|
10
12
|
'import/max-dependencies': 'off',
|
package/rules/jest/index.js
CHANGED
|
@@ -49,6 +49,14 @@ module.exports = {
|
|
|
49
49
|
'jest/no-test-prefixes': 'warn',
|
|
50
50
|
'jest/no-test-return-statement': 'error',
|
|
51
51
|
'jest/no-untyped-mock-factory': 'warn',
|
|
52
|
+
'jest/padding-around-after-all-blocks': 'warn',
|
|
53
|
+
'jest/padding-around-after-each-blocks': 'warn',
|
|
54
|
+
'jest/padding-around-all': 'warn',
|
|
55
|
+
'jest/padding-around-before-all-blocks': 'warn',
|
|
56
|
+
'jest/padding-around-before-each-blocks': 'warn',
|
|
57
|
+
'jest/padding-around-describe-blocks': 'warn',
|
|
58
|
+
'jest/padding-around-expect-groups': 'warn',
|
|
59
|
+
'jest/padding-around-test-blocks': 'warn',
|
|
52
60
|
'jest/prefer-called-with': 'error',
|
|
53
61
|
'jest/prefer-comparison-matcher': 'warn',
|
|
54
62
|
'jest/prefer-each': 'error',
|
package/rules/jsdoc/index.js
CHANGED
|
@@ -46,15 +46,18 @@ module.exports = {
|
|
|
46
46
|
definedTags: ['final', 'flags', 'sealed', 'workaround'],
|
|
47
47
|
jsxTags: true,
|
|
48
48
|
}],
|
|
49
|
+
'jsdoc/check-template-names': 'error',
|
|
49
50
|
'jsdoc/check-types': ['error', {
|
|
50
51
|
noDefaults: false,
|
|
51
52
|
}],
|
|
52
53
|
'jsdoc/check-values': 'error',
|
|
54
|
+
'jsdoc/convert-to-jsdoc-comments': 'off',
|
|
53
55
|
'jsdoc/empty-tags': ['error', {
|
|
54
56
|
tags: ['final', 'flags', 'sealed'],
|
|
55
57
|
}],
|
|
56
58
|
'jsdoc/implements-on-classes': 'error',
|
|
57
59
|
'jsdoc/imports-as-dependencies': 'error',
|
|
60
|
+
'jsdoc/lines-before-block': 'off',
|
|
58
61
|
'jsdoc/match-description': 'error',
|
|
59
62
|
'jsdoc/match-name': 'off',
|
|
60
63
|
'jsdoc/multiline-blocks': ['error', {
|
|
@@ -89,7 +92,7 @@ module.exports = {
|
|
|
89
92
|
'jsdoc/require-description-complete-sentence': 'error',
|
|
90
93
|
'jsdoc/require-example': 'off',
|
|
91
94
|
'jsdoc/require-file-overview': 'off',
|
|
92
|
-
'jsdoc/require-hyphen-before-param-description': ['
|
|
95
|
+
'jsdoc/require-hyphen-before-param-description': ['warn', 'always'],
|
|
93
96
|
'jsdoc/require-jsdoc': 'off',
|
|
94
97
|
'jsdoc/require-param': 'off',
|
|
95
98
|
'jsdoc/require-param-description': 'error',
|
|
@@ -103,6 +106,9 @@ module.exports = {
|
|
|
103
106
|
'jsdoc/require-returns-check': 'error',
|
|
104
107
|
'jsdoc/require-returns-description': 'error',
|
|
105
108
|
'jsdoc/require-returns-type': 'off',
|
|
109
|
+
'jsdoc/require-template': ['off', {
|
|
110
|
+
requireSeparateTemplates: false,
|
|
111
|
+
}],
|
|
106
112
|
'jsdoc/require-throws': 'error',
|
|
107
113
|
'jsdoc/require-yields': 'error',
|
|
108
114
|
'jsdoc/require-yields-check': 'error',
|
package/rules/promise/index.js
CHANGED
|
@@ -16,6 +16,9 @@ module.exports = {
|
|
|
16
16
|
'promise/avoid-new': 'off',
|
|
17
17
|
'promise/no-new-statics': 'warn',
|
|
18
18
|
'promise/no-return-in-finally': 'error',
|
|
19
|
+
'promise/spec-only': ['error', {
|
|
20
|
+
allowedMethods: [],
|
|
21
|
+
}],
|
|
19
22
|
'promise/valid-params': 'error',
|
|
20
23
|
'promise/prefer-await-to-then': 'off',
|
|
21
24
|
'promise/prefer-await-to-callbacks': 'off',
|
|
@@ -9,7 +9,7 @@ module.exports = {
|
|
|
9
9
|
selfClosing: 'after-props',
|
|
10
10
|
nonEmpty: 'after-props',
|
|
11
11
|
}],
|
|
12
|
-
'@stylistic/jsx/jsx-closing-tag-location': 'warn',
|
|
12
|
+
'@stylistic/jsx/jsx-closing-tag-location': ['warn', 'tag-aligned'],
|
|
13
13
|
'@stylistic/jsx/jsx-curly-brace-presence': ['warn', {
|
|
14
14
|
props: 'never',
|
|
15
15
|
children: 'always',
|
|
@@ -4,6 +4,9 @@ module.exports = {
|
|
|
4
4
|
'@stylistic/plus',
|
|
5
5
|
],
|
|
6
6
|
rules: {
|
|
7
|
+
'@stylistic/plus/curly-newline': ['warn', {
|
|
8
|
+
minElements: 1,
|
|
9
|
+
}],
|
|
7
10
|
'@stylistic/plus/indent-binary-ops': ['warn', 4],
|
|
8
11
|
'@stylistic/plus/type-generic-spacing': 'warn',
|
|
9
12
|
'@stylistic/plus/type-named-tuple-spacing': 'warn',
|
|
@@ -53,8 +53,7 @@ module.exports = {
|
|
|
53
53
|
'@typescript-eslint/no-invalid-this': 'error',
|
|
54
54
|
'no-loop-func': 'off',
|
|
55
55
|
'@typescript-eslint/no-loop-func': 'error',
|
|
56
|
-
'no-loss-of-precision': 'off',
|
|
57
|
-
'@typescript-eslint/no-loss-of-precision': 'error',
|
|
56
|
+
'@typescript-eslint/no-loss-of-precision': 'off',
|
|
58
57
|
'no-magic-numbers': 'off',
|
|
59
58
|
'@typescript-eslint/no-magic-numbers': 'off',
|
|
60
59
|
'no-redeclare': 'off',
|
|
@@ -64,7 +63,6 @@ module.exports = {
|
|
|
64
63
|
'no-shadow': 'off',
|
|
65
64
|
'@typescript-eslint/no-shadow': 'off',
|
|
66
65
|
'no-throw-literal': 'off',
|
|
67
|
-
'@typescript-eslint/no-throw-literal': 'off',
|
|
68
66
|
'@typescript-eslint/only-throw-error': ['error', {
|
|
69
67
|
allowThrowingAny: false,
|
|
70
68
|
allowThrowingUnknown: false,
|
|
@@ -105,7 +103,7 @@ module.exports = {
|
|
|
105
103
|
'require-await': 'off',
|
|
106
104
|
'@typescript-eslint/require-await': 'error',
|
|
107
105
|
'no-return-await': 'off',
|
|
108
|
-
'@typescript-eslint/return-await': ['warn', '
|
|
106
|
+
'@typescript-eslint/return-await': ['warn', 'error-handling-correctness-only'],
|
|
109
107
|
'semi': 'off',
|
|
110
108
|
'@typescript-eslint/semi': 'off',
|
|
111
109
|
'space-before-blocks': 'off',
|
|
@@ -10,19 +10,7 @@ module.exports = {
|
|
|
10
10
|
'@typescript-eslint/await-thenable': 'error',
|
|
11
11
|
'@typescript-eslint/ban-ts-comment': 'error',
|
|
12
12
|
'@typescript-eslint/ban-tslint-comment': 'warn',
|
|
13
|
-
'@typescript-eslint/ban-types':
|
|
14
|
-
types: {
|
|
15
|
-
object: {
|
|
16
|
-
message: [
|
|
17
|
-
'The `object` type is currently hard to use',
|
|
18
|
-
'([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).',
|
|
19
|
-
'Consider using `Record<string, unknown>` instead,',
|
|
20
|
-
'as it allows you to more easily inspect and use the keys.',
|
|
21
|
-
].join('\n'),
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
extendDefaults: true,
|
|
25
|
-
}],
|
|
13
|
+
'@typescript-eslint/ban-types': 'off',
|
|
26
14
|
'@typescript-eslint/class-literal-property-style': 'off',
|
|
27
15
|
'@typescript-eslint/consistent-generic-constructors': ['warn', 'type-annotation'],
|
|
28
16
|
'@typescript-eslint/consistent-indexed-object-style': ['warn', 'record'],
|
|
@@ -122,6 +110,7 @@ module.exports = {
|
|
|
122
110
|
ignoreArrowShorthand: true,
|
|
123
111
|
ignoreVoidOperator: false,
|
|
124
112
|
}],
|
|
113
|
+
'@typescript-eslint/no-deprecated': 'error',
|
|
125
114
|
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
|
126
115
|
'@typescript-eslint/no-duplicate-type-constituents': ['error', {
|
|
127
116
|
ignoreIntersections: false,
|
|
@@ -131,6 +120,10 @@ module.exports = {
|
|
|
131
120
|
'@typescript-eslint/no-empty-interface': ['off', {
|
|
132
121
|
allowSingleExtends: true,
|
|
133
122
|
}],
|
|
123
|
+
'@typescript-eslint/no-empty-object-type': ['error', {
|
|
124
|
+
allowInterfaces: 'always',
|
|
125
|
+
allowObjectTypes: 'never',
|
|
126
|
+
}],
|
|
134
127
|
'@typescript-eslint/no-explicit-any': ['error', {
|
|
135
128
|
fixToUnknown: false,
|
|
136
129
|
ignoreRestArgs: false,
|
|
@@ -142,7 +135,13 @@ module.exports = {
|
|
|
142
135
|
allowStaticOnly: false,
|
|
143
136
|
allowWithDecorator: true,
|
|
144
137
|
}],
|
|
145
|
-
'@typescript-eslint/no-floating-promises': 'error',
|
|
138
|
+
'@typescript-eslint/no-floating-promises': ['error', {
|
|
139
|
+
allowForKnownSafeCalls: [],
|
|
140
|
+
allowForKnownSafePromises: [],
|
|
141
|
+
checkThenables: true,
|
|
142
|
+
ignoreIIFE: false,
|
|
143
|
+
ignoreVoid: true,
|
|
144
|
+
}],
|
|
146
145
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
147
146
|
'@typescript-eslint/no-import-type-side-effects': 'warn',
|
|
148
147
|
'@typescript-eslint/no-inferrable-types': 'off',
|
|
@@ -163,16 +162,33 @@ module.exports = {
|
|
|
163
162
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
164
163
|
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
165
164
|
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
|
165
|
+
'@typescript-eslint/no-unnecessary-type-parameters': 'error',
|
|
166
166
|
'@typescript-eslint/no-require-imports': ['error', {
|
|
167
167
|
allow: [],
|
|
168
168
|
}],
|
|
169
|
+
'@typescript-eslint/no-restricted-types': ['error', {
|
|
170
|
+
types: {
|
|
171
|
+
object: {
|
|
172
|
+
message: [
|
|
173
|
+
'The `object` type is currently hard to use',
|
|
174
|
+
'(https://github.com/microsoft/TypeScript/issues/21732).',
|
|
175
|
+
].join(' '),
|
|
176
|
+
suggest: ['Record<string, unknown>'],
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
}],
|
|
169
180
|
'@typescript-eslint/no-this-alias': 'error',
|
|
170
181
|
'@typescript-eslint/no-type-alias': 'off',
|
|
171
182
|
'@typescript-eslint/no-unnecessary-boolean-literal-compare': ['warn', {
|
|
172
183
|
allowComparingNullableBooleansToTrue: true,
|
|
173
184
|
allowComparingNullableBooleansToFalse: true,
|
|
174
185
|
}],
|
|
175
|
-
'@typescript-eslint/no-unnecessary-condition': 'warn',
|
|
186
|
+
'@typescript-eslint/no-unnecessary-condition': ['warn', {
|
|
187
|
+
allowConstantLoopConditions: false,
|
|
188
|
+
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
189
|
+
checkTypePredicates: true,
|
|
190
|
+
}],
|
|
191
|
+
'@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
|
|
176
192
|
'@typescript-eslint/no-unnecessary-qualifier': 'warn',
|
|
177
193
|
'@typescript-eslint/no-unnecessary-template-expression': 'error',
|
|
178
194
|
'@typescript-eslint/no-unnecessary-type-arguments': 'warn',
|
|
@@ -183,6 +199,7 @@ module.exports = {
|
|
|
183
199
|
'@typescript-eslint/no-unsafe-call': 'error',
|
|
184
200
|
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
185
201
|
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
|
202
|
+
'@typescript-eslint/no-unsafe-function-type': 'warn',
|
|
186
203
|
'@typescript-eslint/no-unsafe-member-access': 'error',
|
|
187
204
|
'@typescript-eslint/no-unsafe-return': 'error',
|
|
188
205
|
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
|
@@ -191,6 +208,7 @@ module.exports = {
|
|
|
191
208
|
'@typescript-eslint/no-var-requires': ['error', {
|
|
192
209
|
allow: [],
|
|
193
210
|
}],
|
|
211
|
+
'@typescript-eslint/no-wrapper-object-types': 'warn',
|
|
194
212
|
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
|
|
195
213
|
'@typescript-eslint/parameter-properties': ['error', {
|
|
196
214
|
prefer: 'parameter-property',
|
|
@@ -206,6 +224,7 @@ module.exports = {
|
|
|
206
224
|
}],
|
|
207
225
|
'@typescript-eslint/prefer-namespace-keyword': 'warn',
|
|
208
226
|
'@typescript-eslint/prefer-nullish-coalescing': ['error', {
|
|
227
|
+
ignoreBooleanCoercion: false,
|
|
209
228
|
ignoreTernaryTests: false,
|
|
210
229
|
ignoreConditionalTests: true,
|
|
211
230
|
ignoreMixedLogicalExpressions: true,
|
|
@@ -289,7 +308,7 @@ module.exports = {
|
|
|
289
308
|
variableDeclarationIgnoreFunction: false,
|
|
290
309
|
}],
|
|
291
310
|
'@typescript-eslint/unbound-method': ['error', {
|
|
292
|
-
ignoreStatic:
|
|
311
|
+
ignoreStatic: false,
|
|
293
312
|
}],
|
|
294
313
|
'@typescript-eslint/unified-signatures': ['error', {
|
|
295
314
|
ignoreDifferentlyNamedParameters: true,
|
package/rules/unicorn/index.js
CHANGED
|
@@ -9,6 +9,7 @@ module.exports = {
|
|
|
9
9
|
'unicorn/catch-error-name': 'warn',
|
|
10
10
|
'unicorn/consistent-destructuring': 'warn',
|
|
11
11
|
'unicorn/consistent-empty-array-spread': 'warn',
|
|
12
|
+
'unicorn/consistent-existence-index-check': 'warn',
|
|
12
13
|
'unicorn/consistent-function-scoping': ['error', {
|
|
13
14
|
checkArrowFunctions: true,
|
|
14
15
|
}],
|
|
@@ -48,6 +49,7 @@ module.exports = {
|
|
|
48
49
|
checkProperties: true,
|
|
49
50
|
onlyCamelCase: false,
|
|
50
51
|
}],
|
|
52
|
+
'unicorn/no-length-as-slice-end': 'warn',
|
|
51
53
|
'unicorn/no-lonely-if': 'warn',
|
|
52
54
|
'unicorn/no-magic-array-flat-depth': 'error',
|
|
53
55
|
'unicorn/no-negated-condition': 'warn',
|
|
@@ -116,10 +118,12 @@ module.exports = {
|
|
|
116
118
|
'unicorn/prefer-dom-node-text-content': 'warn',
|
|
117
119
|
'unicorn/prefer-event-target': 'error',
|
|
118
120
|
'unicorn/prefer-export-from': 'warn',
|
|
121
|
+
'unicorn/prefer-global-this': 'warn',
|
|
119
122
|
'unicorn/prefer-includes': 'warn',
|
|
120
123
|
'unicorn/prefer-json-parse-buffer': 'warn',
|
|
121
124
|
'unicorn/prefer-keyboard-event-key': 'warn',
|
|
122
125
|
'unicorn/prefer-logical-operator-over-ternary': 'error',
|
|
126
|
+
'unicorn/prefer-math-min-max': 'warn',
|
|
123
127
|
'unicorn/prefer-math-trunc': 'warn',
|
|
124
128
|
'unicorn/prefer-modern-dom-apis': 'warn',
|
|
125
129
|
'unicorn/prefer-modern-math-apis': 'warn',
|
package/rules.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { cypressImportNoExtraneousDependencies, ImportNoExtraneousDependencies, importNoExtraneousDependencies, jestImportNoExtraneousDependencies, jsImportNoExtraneousDependencies, } from './rules/import/rules/no-extraneous-dependencies';
|
|
2
2
|
export { SimpleImportSortImports, simpleImportSortImports, } from './rules/simple-import-sort/rules/imports';
|
|
3
3
|
export { TypescriptEslintNamingConvention, typescriptEslintNamingConvention, TypescriptEslintNamingConventionFormat, TypescriptEslintNamingConventionGroupSelector, TypescriptEslintNamingConventionIndividualSelector, TypescriptEslintNamingConventionSelector, TypescriptEslintNamingConventionUnderscore, } from './rules/typescript-eslint/rules/typescript-eslint-naming-convention';
|
|
4
|
-
export { TsLintRule, TsLintRules, TypescriptEslintTslintConfig, typescriptEslintTslintConfig, } from './rules/typescript-eslint/rules/typescript-eslint-tslint-config';
|
|
5
4
|
export { UnicornPreventAbbreviationReplacements, UnicornPreventAbbreviations, unicornPreventAbbreviations, } from './rules/unicorn/rules/prevent-abbreviations';
|
package/rules.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unicornPreventAbbreviations = exports.
|
|
3
|
+
exports.unicornPreventAbbreviations = exports.typescriptEslintNamingConvention = exports.simpleImportSortImports = exports.jsImportNoExtraneousDependencies = exports.jestImportNoExtraneousDependencies = exports.importNoExtraneousDependencies = exports.cypressImportNoExtraneousDependencies = void 0;
|
|
4
4
|
var no_extraneous_dependencies_1 = require("./rules/import/rules/no-extraneous-dependencies");
|
|
5
5
|
Object.defineProperty(exports, "cypressImportNoExtraneousDependencies", { enumerable: true, get: function () { return no_extraneous_dependencies_1.cypressImportNoExtraneousDependencies; } });
|
|
6
6
|
Object.defineProperty(exports, "importNoExtraneousDependencies", { enumerable: true, get: function () { return no_extraneous_dependencies_1.importNoExtraneousDependencies; } });
|
|
@@ -10,7 +10,5 @@ var imports_1 = require("./rules/simple-import-sort/rules/imports");
|
|
|
10
10
|
Object.defineProperty(exports, "simpleImportSortImports", { enumerable: true, get: function () { return imports_1.simpleImportSortImports; } });
|
|
11
11
|
var typescript_eslint_naming_convention_1 = require("./rules/typescript-eslint/rules/typescript-eslint-naming-convention");
|
|
12
12
|
Object.defineProperty(exports, "typescriptEslintNamingConvention", { enumerable: true, get: function () { return typescript_eslint_naming_convention_1.typescriptEslintNamingConvention; } });
|
|
13
|
-
var typescript_eslint_tslint_config_1 = require("./rules/typescript-eslint/rules/typescript-eslint-tslint-config");
|
|
14
|
-
Object.defineProperty(exports, "typescriptEslintTslintConfig", { enumerable: true, get: function () { return typescript_eslint_tslint_config_1.typescriptEslintTslintConfig; } });
|
|
15
13
|
var prevent_abbreviations_1 = require("./rules/unicorn/rules/prevent-abbreviations");
|
|
16
14
|
Object.defineProperty(exports, "unicornPreventAbbreviations", { enumerable: true, get: function () { return prevent_abbreviations_1.unicornPreventAbbreviations; } });
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
module.exports = {
|
|
3
|
-
plugins: [
|
|
4
|
-
'jest-formatting',
|
|
5
|
-
],
|
|
6
|
-
rules: {
|
|
7
|
-
'jest-formatting/padding-around-after-all-blocks': 'warn',
|
|
8
|
-
'jest-formatting/padding-around-after-each-blocks': 'warn',
|
|
9
|
-
'jest-formatting/padding-around-all': 'warn',
|
|
10
|
-
'jest-formatting/padding-around-before-all-blocks': 'warn',
|
|
11
|
-
'jest-formatting/padding-around-before-each-blocks': 'warn',
|
|
12
|
-
'jest-formatting/padding-around-describe-blocks': 'warn',
|
|
13
|
-
'jest-formatting/padding-around-expect-groups': 'warn',
|
|
14
|
-
'jest-formatting/padding-around-test-blocks': 'warn',
|
|
15
|
-
},
|
|
16
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type TsLintRule = boolean | [boolean, unknown];
|
|
2
|
-
export type TsLintRules = Record<string, TsLintRule>;
|
|
3
|
-
export interface TypescriptEslintTslintConfig {
|
|
4
|
-
rules: TsLintRules;
|
|
5
|
-
rulesDirectory?: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare function typescriptEslintTslintConfig(rules?: TsLintRules, directories?: string[]): TypescriptEslintTslintConfig;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typescriptEslintTslintConfig = typescriptEslintTslintConfig;
|
|
4
|
-
const format = {
|
|
5
|
-
'import-spacing': true,
|
|
6
|
-
};
|
|
7
|
-
const functionality = {
|
|
8
|
-
'no-inferred-empty-object-type': true,
|
|
9
|
-
'no-tautology-expression': true,
|
|
10
|
-
'prefer-conditional-expression': [true, 'check-else-if'],
|
|
11
|
-
'static-this': true,
|
|
12
|
-
'strict-comparisons': [true, {
|
|
13
|
-
'allow-object-equal-comparison': true,
|
|
14
|
-
'allow-string-order-comparison': true,
|
|
15
|
-
}],
|
|
16
|
-
};
|
|
17
|
-
const maintainability = {
|
|
18
|
-
'no-default-import': true,
|
|
19
|
-
'no-mergeable-namespace': true,
|
|
20
|
-
};
|
|
21
|
-
const style = {
|
|
22
|
-
'encoding': true,
|
|
23
|
-
'no-unnecessary-callback-wrapper': true,
|
|
24
|
-
'prefer-switch': [true, { 'min-cases': 2 }],
|
|
25
|
-
'prefer-while': true,
|
|
26
|
-
'return-undefined': true,
|
|
27
|
-
'switch-final-break': [true, 'always'],
|
|
28
|
-
};
|
|
29
|
-
function typescriptEslintTslintConfig(rules = {}, directories = []) {
|
|
30
|
-
return {
|
|
31
|
-
rules: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, format), functionality), maintainability), style), rules),
|
|
32
|
-
rulesDirectory: directories,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const typescript_eslint_tslint_config_1 = require("./rules/typescript-eslint-tslint-config");
|
|
3
|
-
module.exports = {
|
|
4
|
-
plugins: [
|
|
5
|
-
'@typescript-eslint/tslint',
|
|
6
|
-
],
|
|
7
|
-
rules: {
|
|
8
|
-
'@typescript-eslint/tslint/config': ['warn', (0, typescript_eslint_tslint_config_1.typescriptEslintTslintConfig)()],
|
|
9
|
-
},
|
|
10
|
-
};
|