eslint-config-webpack 4.0.4 → 4.0.6
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/configs/jest.js +152 -136
- package/configs/markdown.js +55 -39
- package/configs/node.js +116 -69
- package/configs/typescript.js +258 -244
- package/configs.js +58 -4
- package/package.json +6 -4
package/configs/jest.js
CHANGED
|
@@ -1,204 +1,220 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @returns {Promise<Record<string, string>>} config
|
|
3
|
+
*/
|
|
4
|
+
async function getJestRecommendedConfig() {
|
|
5
|
+
let jestPlugin;
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
jestPlugin = (await import("eslint-plugin-jest")).default;
|
|
9
|
+
// eslint-disable-next-line unicorn/prefer-optional-catch-binding
|
|
10
|
+
} catch (_err) {
|
|
11
|
+
// Nothing
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const jsdocConfig =
|
|
15
|
+
(jestPlugin && jestPlugin.configs["flat/recommended"]) || {};
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
...jsdocConfig,
|
|
19
|
+
name: "jest/recommended",
|
|
20
|
+
settings: {
|
|
21
|
+
jest: {
|
|
22
|
+
version: 29,
|
|
23
|
+
},
|
|
9
24
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...jestPlugin.configs["flat/recommended"].rules,
|
|
25
|
+
files: [
|
|
26
|
+
"**/{tests,test,__tests__}/**/*.?(c|m)[jt]s?(x)",
|
|
27
|
+
"**/?(*.)+(spec|test).[jt]s?(x)",
|
|
28
|
+
"**/test-*.[jt]s?(x)",
|
|
29
|
+
"setupTest.{js,cjs,mjs,ts,cts,mjs}",
|
|
30
|
+
],
|
|
31
|
+
ignores: [
|
|
32
|
+
"**/{tests,test,__tests__}/**/{helper,helpers,__helper__,__helpers__,fixture,fixtures,__fixture__,__fixtures__}/**/*",
|
|
33
|
+
"**/helper?(s).{js,cjs,mjs}",
|
|
34
|
+
],
|
|
35
|
+
rules: {
|
|
36
|
+
...jsdocConfig.rules,
|
|
23
37
|
|
|
24
|
-
|
|
38
|
+
"jest/consistent-test-it": "error",
|
|
25
39
|
|
|
26
|
-
|
|
40
|
+
"jest/expect-expect": "error",
|
|
27
41
|
|
|
28
|
-
|
|
29
|
-
|
|
42
|
+
// No need
|
|
43
|
+
// "jest/max-expects": "error",
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
// No need
|
|
46
|
+
// "jest/max-nested-describe": "error",
|
|
33
47
|
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
// From recommended
|
|
49
|
+
// "jest/no-alias-methods": "error",
|
|
36
50
|
|
|
37
|
-
|
|
51
|
+
"jest/no-commented-out-tests": "error",
|
|
38
52
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
// No need
|
|
54
|
+
// Makes too much noise, testing conditions can often be different
|
|
55
|
+
"jest/no-conditional-expect": "off",
|
|
42
56
|
|
|
43
|
-
|
|
44
|
-
|
|
57
|
+
// No need
|
|
58
|
+
// "jest/no-conditional-in-test": "off",
|
|
45
59
|
|
|
46
|
-
|
|
60
|
+
"jest/no-confusing-set-timeout": "error",
|
|
47
61
|
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
// From recommended
|
|
63
|
+
// "jest/no-deprecated-functions": "error",
|
|
50
64
|
|
|
51
|
-
|
|
65
|
+
"jest/no-disabled-tests": "error",
|
|
52
66
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
67
|
+
// No need
|
|
68
|
+
// Adding extra `await new Promise(...)` is very inconvenient when you have a lot of callback api
|
|
69
|
+
"jest/no-done-callback": "off",
|
|
56
70
|
|
|
57
|
-
|
|
71
|
+
"jest/no-duplicate-hooks": "error",
|
|
58
72
|
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
// From recommended
|
|
74
|
+
// "jest/no-export": "error",
|
|
61
75
|
|
|
62
|
-
|
|
76
|
+
"jest/no-focused-tests": "error",
|
|
63
77
|
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
// No need
|
|
79
|
+
// "jest/no-hooks": "error",
|
|
66
80
|
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
// From recommended
|
|
82
|
+
// "jest/no-identical-title": "error",
|
|
69
83
|
|
|
70
|
-
|
|
71
|
-
|
|
84
|
+
// From recommended
|
|
85
|
+
// "jest/no-interpolation-in-snapshots": "error",
|
|
72
86
|
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
// From recommended
|
|
88
|
+
// "jest/no-jasmine-globals": "error",
|
|
75
89
|
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
// No need
|
|
91
|
+
// "jest/no-large-snapshots": "error",
|
|
78
92
|
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
// From recommended
|
|
94
|
+
// "jest/no-mocks-import": "error",
|
|
81
95
|
|
|
82
|
-
|
|
83
|
-
|
|
96
|
+
// No need
|
|
97
|
+
// "jest/no-restricted-jest-methods": ["error", {}],
|
|
84
98
|
|
|
85
|
-
|
|
86
|
-
|
|
99
|
+
// No need
|
|
100
|
+
// "jest/no-restricted-matchers": ["error", {}],
|
|
87
101
|
|
|
88
|
-
|
|
89
|
-
|
|
102
|
+
// From recommended
|
|
103
|
+
// "jest/no-standalone-expect": "error",
|
|
90
104
|
|
|
91
|
-
|
|
92
|
-
|
|
105
|
+
// From recommended
|
|
106
|
+
// "jest/no-test-prefixes": "error",
|
|
93
107
|
|
|
94
|
-
|
|
95
|
-
|
|
108
|
+
// No need
|
|
109
|
+
// "jest/no-test-return-statement": "error",
|
|
96
110
|
|
|
97
|
-
|
|
98
|
-
|
|
111
|
+
// No need
|
|
112
|
+
// "jest/no-untyped-mock-factory": "error",
|
|
99
113
|
|
|
100
|
-
|
|
114
|
+
"jest/padding-around-after-all-blocks": "error",
|
|
101
115
|
|
|
102
|
-
|
|
116
|
+
"jest/padding-around-after-each-blocks": "error",
|
|
103
117
|
|
|
104
|
-
|
|
105
|
-
|
|
118
|
+
// Not all padding required
|
|
119
|
+
// "jest/padding-around-all": "off",
|
|
106
120
|
|
|
107
|
-
|
|
121
|
+
"jest/padding-around-before-all-blocks": "error",
|
|
108
122
|
|
|
109
|
-
|
|
123
|
+
"jest/padding-around-before-each-blocks": "error",
|
|
110
124
|
|
|
111
|
-
|
|
125
|
+
"jest/padding-around-describe-blocks": "error",
|
|
112
126
|
|
|
113
|
-
|
|
127
|
+
"jest/padding-around-expect-groups": "off",
|
|
114
128
|
|
|
115
|
-
|
|
129
|
+
"jest/padding-around-test-blocks": "error",
|
|
116
130
|
|
|
117
|
-
|
|
118
|
-
|
|
131
|
+
// No need
|
|
132
|
+
// "jest/prefer-called-with": "error",
|
|
119
133
|
|
|
120
|
-
|
|
134
|
+
"jest/prefer-comparison-matcher": "error",
|
|
121
135
|
|
|
122
|
-
|
|
123
|
-
|
|
136
|
+
// No need
|
|
137
|
+
// "jest/prefer-each": "error",
|
|
124
138
|
|
|
125
|
-
|
|
139
|
+
"jest/prefer-equality-matcher": "error",
|
|
126
140
|
|
|
127
|
-
|
|
128
|
-
|
|
141
|
+
// No need
|
|
142
|
+
// "jest/prefer-expect-assertions": "error",
|
|
129
143
|
|
|
130
|
-
|
|
131
|
-
|
|
144
|
+
// No need
|
|
145
|
+
// "jest/prefer-expect-resolves": "error",
|
|
132
146
|
|
|
133
|
-
|
|
147
|
+
"jest/prefer-hooks-in-order": "error",
|
|
134
148
|
|
|
135
|
-
|
|
149
|
+
"jest/prefer-hooks-on-top": "error",
|
|
136
150
|
|
|
137
|
-
|
|
138
|
-
|
|
151
|
+
// No need
|
|
152
|
+
// "jest/prefer-importing-jest-globals": "error",
|
|
139
153
|
|
|
140
|
-
|
|
154
|
+
"jest/prefer-jest-mocked": "error",
|
|
141
155
|
|
|
142
|
-
|
|
156
|
+
// Allow to use `MyClass` title in describe for class testing
|
|
157
|
+
"jest/prefer-lowercase-title": ["error", { ignore: ["describe"] }],
|
|
143
158
|
|
|
144
|
-
|
|
159
|
+
"jest/prefer-mock-promise-shorthand": "error",
|
|
145
160
|
|
|
146
|
-
|
|
147
|
-
|
|
161
|
+
// No need
|
|
162
|
+
// "jest/prefer-snapshot-hint": "error",
|
|
148
163
|
|
|
149
|
-
|
|
164
|
+
"jest/prefer-spy-on": "error",
|
|
150
165
|
|
|
151
|
-
|
|
152
|
-
|
|
166
|
+
// No need
|
|
167
|
+
// "jest/prefer-strict-equal": "off",
|
|
153
168
|
|
|
154
|
-
|
|
169
|
+
"jest/prefer-to-be": "error",
|
|
155
170
|
|
|
156
|
-
|
|
171
|
+
"jest/prefer-to-contain": "error",
|
|
157
172
|
|
|
158
|
-
|
|
173
|
+
"jest/prefer-to-have-length": "error",
|
|
159
174
|
|
|
160
|
-
|
|
161
|
-
|
|
175
|
+
// No need
|
|
176
|
+
// "jest/prefer-todo": "error"
|
|
162
177
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
178
|
+
// No need
|
|
179
|
+
// Does not allow using the function as test generation
|
|
180
|
+
"jest/require-hook": "off",
|
|
166
181
|
|
|
167
|
-
|
|
182
|
+
"jest/require-to-throw-message": "error",
|
|
168
183
|
|
|
169
|
-
|
|
184
|
+
"jest/require-top-level-describe": "error",
|
|
170
185
|
|
|
171
|
-
|
|
172
|
-
|
|
186
|
+
// From recommended
|
|
187
|
+
// "jest/valid-describe-callback": "error",
|
|
173
188
|
|
|
174
|
-
|
|
175
|
-
|
|
189
|
+
// From recommended
|
|
190
|
+
// "jest/valid-expect": "error",
|
|
176
191
|
|
|
177
|
-
|
|
178
|
-
|
|
192
|
+
// From recommended
|
|
193
|
+
// "jest/valid-expect-in-promise": "error",
|
|
179
194
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
195
|
+
// From recommended
|
|
196
|
+
"jest/valid-title": [
|
|
197
|
+
"error",
|
|
198
|
+
{
|
|
199
|
+
// Allow to use variables in tests
|
|
200
|
+
ignoreTypeOfDescribeName: true,
|
|
201
|
+
// Allow to use variables in tests
|
|
202
|
+
ignoreTypeOfTestName: true,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
190
205
|
|
|
191
|
-
|
|
192
|
-
|
|
206
|
+
// Disable it for tests, because often you can use `a`, `b`, `c` and etc variables
|
|
207
|
+
"id-length": "off",
|
|
193
208
|
|
|
194
|
-
|
|
195
|
-
|
|
209
|
+
// In tests, we can have any names
|
|
210
|
+
camelcase: "off",
|
|
196
211
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
};
|
|
212
|
+
// Doesn't require jsdoc for tests, they are either redundant or we have a separate task for checking types of tests
|
|
213
|
+
"jsdoc/require-jsdoc": "off",
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
}
|
|
201
217
|
|
|
202
218
|
export default {
|
|
203
|
-
"jest/recommended":
|
|
219
|
+
"jest/recommended": await getJestRecommendedConfig(),
|
|
204
220
|
};
|
package/configs/markdown.js
CHANGED
|
@@ -1,61 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @returns {Promise<Record<string, string>>} config
|
|
3
|
+
*/
|
|
4
|
+
async function getMarkdownRecommendedConfig() {
|
|
5
|
+
let markdownPlugin;
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
markdownPlugin = (await import("@eslint/markdown")).default;
|
|
9
|
+
// eslint-disable-next-line unicorn/prefer-optional-catch-binding
|
|
10
|
+
} catch (_err) {
|
|
11
|
+
// Nothing
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (!markdownPlugin) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
name: "markdown/code-blocks",
|
|
21
|
+
files: ["**/*.md"],
|
|
22
|
+
processor: "markdown/markdown",
|
|
23
|
+
plugins: {
|
|
24
|
+
markdown: markdownPlugin,
|
|
25
|
+
},
|
|
10
26
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
{
|
|
28
|
+
name: "markdown/code-blocks/js",
|
|
29
|
+
files: ["**/*.md/*.js"],
|
|
30
|
+
languageOptions: {
|
|
31
|
+
parserOptions: {
|
|
32
|
+
ecmaFeatures: {
|
|
33
|
+
impliedStrict: true,
|
|
34
|
+
},
|
|
19
35
|
},
|
|
20
36
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
strict: "off",
|
|
37
|
+
rules: {
|
|
38
|
+
strict: "off",
|
|
24
39
|
|
|
25
|
-
|
|
26
|
-
|
|
40
|
+
// For different examples
|
|
41
|
+
camelcase: "off",
|
|
27
42
|
|
|
28
|
-
|
|
43
|
+
"unicode-bom": "off",
|
|
29
44
|
|
|
30
|
-
|
|
45
|
+
"eol-last": "off",
|
|
31
46
|
|
|
32
|
-
|
|
47
|
+
"no-undef": "off",
|
|
33
48
|
|
|
34
|
-
|
|
49
|
+
"no-unused-private-class-members": "off",
|
|
35
50
|
|
|
36
|
-
|
|
51
|
+
"no-unused-vars": "off",
|
|
37
52
|
|
|
38
|
-
|
|
53
|
+
"no-unused-expressions": "off",
|
|
39
54
|
|
|
40
|
-
|
|
55
|
+
"no-unused-labels": "off",
|
|
41
56
|
|
|
42
|
-
|
|
57
|
+
"no-console": "off",
|
|
43
58
|
|
|
44
|
-
|
|
59
|
+
"unicorn/no-unused-properties": "off",
|
|
45
60
|
|
|
46
|
-
|
|
61
|
+
"n/no-unpublished-require": "off",
|
|
47
62
|
|
|
48
|
-
|
|
63
|
+
"n/no-unpublished-import": "off",
|
|
49
64
|
|
|
50
|
-
|
|
65
|
+
"import/no-unresolved": "off",
|
|
51
66
|
|
|
52
|
-
|
|
67
|
+
"import/no-extraneous-dependencies": "off",
|
|
53
68
|
|
|
54
|
-
|
|
69
|
+
"jsdoc/require-jsdoc": "off",
|
|
70
|
+
},
|
|
55
71
|
},
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
];
|
|
73
|
+
}
|
|
58
74
|
|
|
59
75
|
export default {
|
|
60
|
-
"markdown/recommended":
|
|
76
|
+
"markdown/recommended": await getMarkdownRecommendedConfig(),
|
|
61
77
|
};
|