eslint-config-webpack 4.14.0 → 5.0.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 +94 -4
- package/configs/browser.js +70 -7
- package/configs/index.js +7 -6
- package/configs/javascript.js +746 -151
- package/configs/json.js +72 -0
- package/configs/markdown.js +111 -6
- package/configs/node.js +78 -23
- package/configs/performance.js +8 -0
- package/configs/react.js +7 -19
- package/configs/stylistic.js +31 -4
- package/configs/{jest.js → test.js} +65 -5
- package/configs/typescript.js +77 -55
- package/configs/utils/code-files.js +20 -0
- package/configs/utils/get-es-version-from-node.js +9 -4
- package/configs/utils/get-json-file.js +1 -5
- package/configs/utils/is-jest-installed.js +20 -0
- package/configs/utils/is-typescript-installed.js +3 -3
- package/configs.js +47 -31
- package/package.json +34 -27
- package/plugins/package-json/index.js +0 -5
- package/plugins/package-json/rules/order-properties.js +8 -18
- package/plugins/performance/index.js +60 -0
- package/plugins/performance/rules/no-case-insensitive-unicode-range.js +214 -0
- package/plugins/performance/rules/require-precompiled-schema.js +414 -0
- package/plugins/webpack/index.js +0 -1
- package/plugins/webpack/rules/comment-length.js +1 -3
- package/plugins/webpack/rules/format-schema.js +18 -16
- package/plugins/webpack/rules/inherit-jsdoc.js +2 -3
- package/plugins/webpack/rules/no-duplicate-import-tag.js +3 -4
- package/plugins/webpack/rules/no-unused-import-tag.js +8 -11
- package/plugins/webpack/rules/prefer-import-tag.js +1 -2
- package/plugins/webpack/rules/require-license-comment.js +3 -5
- package/plugins/webpack/rules/valid-schema.js +9 -13
- package/plugins/webpack/utils/import-tags.js +4 -3
- package/configs/package-json.js +0 -8
package/configs/typescript.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import webpackPlugin from "../plugins/webpack/index.js";
|
|
1
2
|
import {
|
|
2
3
|
javascriptExtensions,
|
|
3
4
|
typescriptExtensions,
|
|
@@ -54,6 +55,10 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
54
55
|
overrideReplacesDocs: false,
|
|
55
56
|
},
|
|
56
57
|
},
|
|
58
|
+
plugins: {
|
|
59
|
+
...jsdocConfig.plugins,
|
|
60
|
+
webpack: webpackPlugin,
|
|
61
|
+
},
|
|
57
62
|
rules: {
|
|
58
63
|
...jsdocConfig.rules,
|
|
59
64
|
|
|
@@ -106,7 +111,8 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
106
111
|
// From recommended
|
|
107
112
|
// "jsdoc/escape-inline-tags": "error",
|
|
108
113
|
|
|
109
|
-
//
|
|
114
|
+
// TypeScript reports `@implements` outside a class itself (TS8022)
|
|
115
|
+
"jsdoc/implements-on-classes": "off",
|
|
110
116
|
|
|
111
117
|
// No need
|
|
112
118
|
// "jsdoc/informative-docs": "error",
|
|
@@ -141,37 +147,23 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
141
147
|
"jsdoc/no-restricted-syntax": [
|
|
142
148
|
"error",
|
|
143
149
|
{
|
|
150
|
+
// One context with one `:has()` instead of one per check: the plugin
|
|
151
|
+
// rebuilds the comment AST per context and `:has()` walks it each time.
|
|
144
152
|
contexts: [
|
|
145
|
-
// Prefer TypeScript syntax for functions
|
|
146
|
-
{
|
|
147
|
-
comment: "JsdocBlock:has(JsdocTypeFunction[arrow=false])",
|
|
148
|
-
message:
|
|
149
|
-
"Please use TypeScript syntax - `(a: string, b: boolean) => number`",
|
|
150
|
-
},
|
|
151
|
-
// Prefer `{string=}` over `{string} [arg]`
|
|
152
|
-
{
|
|
153
|
-
comment:
|
|
154
|
-
"JsdocBlock:has(JsdocTag[tag=/^(property|param)$/][name=/[\\[\\]]/])",
|
|
155
|
-
message:
|
|
156
|
-
"Please use `@property {string=} property`/`@param {string=} arg` instead `[arg]` for optional properties and parameters",
|
|
157
|
-
},
|
|
158
|
-
// No `?` type
|
|
159
|
-
{
|
|
160
|
-
comment: "JsdocBlock:has(JsdocTypeUnknown)",
|
|
161
|
-
message: "Please use `unknown` or `any` (or `EXPECTED_ANY`) type",
|
|
162
|
-
},
|
|
163
|
-
// No `Object`
|
|
164
153
|
{
|
|
165
|
-
comment:
|
|
166
|
-
|
|
154
|
+
comment: `JsdocBlock:has(${[
|
|
155
|
+
// Prefer TypeScript syntax for functions
|
|
156
|
+
"JsdocTypeFunction[arrow=false]",
|
|
157
|
+
// Prefer `{string=}` over `{string} [arg]`
|
|
158
|
+
"JsdocTag[tag=/^(property|param)$/][name=/[\\[\\]]/]",
|
|
159
|
+
// No `?` type
|
|
160
|
+
"JsdocTypeUnknown",
|
|
161
|
+
// No `Object`
|
|
162
|
+
"JsdocTag[tag!=/^(typedef|template|param)$/]:has(JsdocTypeName[value=/^(Object|object)$/])",
|
|
163
|
+
"JsdocTag[tag=typedef][parsedType.type!=JsdocTypeName]:has(JsdocTypeName[value=/^(Object|object)$/])",
|
|
164
|
+
].join(", ")})`,
|
|
167
165
|
message:
|
|
168
|
-
"Please use
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
comment:
|
|
172
|
-
"JsdocBlock:has(JsdocTag[tag=typedef][parsedType.type!=JsdocTypeName]:has(JsdocTypeName[value=/^(Object|object)$/]))",
|
|
173
|
-
message:
|
|
174
|
-
"Please use provide types for object - `{ property: number:, result: () => number}` instead `Object`/`object` or use `EXPECTED_OBJECT` type",
|
|
166
|
+
"Please use TypeScript syntax: `(a: string) => number` for functions, `{string=}` instead of `[arg]` for optional properties and parameters, `unknown`/`any` (or `EXPECTED_ANY`) instead of `?`, and object types such as `{ property: number }` (or `EXPECTED_OBJECT`) instead of `Object`/`object`",
|
|
175
167
|
},
|
|
176
168
|
],
|
|
177
169
|
},
|
|
@@ -180,11 +172,17 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
180
172
|
// No need
|
|
181
173
|
// "jsdoc/no-types": "error",
|
|
182
174
|
|
|
183
|
-
//
|
|
184
|
-
//
|
|
175
|
+
// TypeScript reports an unknown type name itself (TS2304); it ignores the
|
|
176
|
+
// types of `@throws` and `@yields`, so those go unchecked
|
|
177
|
+
"jsdoc/no-undefined-types": "off",
|
|
178
|
+
|
|
179
|
+
// Needs type information (the `typescript-eslint` parser with a project)
|
|
180
|
+
// "jsdoc/no-unnecessary-type-assertion": "error",
|
|
185
181
|
|
|
186
|
-
|
|
187
|
-
|
|
182
|
+
"jsdoc/normalize-see-links": "error",
|
|
183
|
+
|
|
184
|
+
// We have own rule
|
|
185
|
+
"jsdoc/prefer-import-tag": "off",
|
|
188
186
|
|
|
189
187
|
"jsdoc/reject-any-type": "error",
|
|
190
188
|
|
|
@@ -213,8 +211,9 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
213
211
|
// No need
|
|
214
212
|
// "jsdoc/require-next-description":"error",
|
|
215
213
|
|
|
216
|
-
//
|
|
217
|
-
//
|
|
214
|
+
// TypeScript ignores the type of `@next`; type a generator with
|
|
215
|
+
// `@returns {Generator<…>}` instead
|
|
216
|
+
"jsdoc/require-next-type": "off",
|
|
218
217
|
|
|
219
218
|
// From recommended
|
|
220
219
|
// "jsdoc/require-param": "error",
|
|
@@ -222,11 +221,12 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
222
221
|
// From recommended
|
|
223
222
|
// "jsdoc/require-param-description": "error",
|
|
224
223
|
|
|
225
|
-
//
|
|
226
|
-
|
|
224
|
+
// TypeScript fails to parse a `@param` without a name (TS1003)
|
|
225
|
+
"jsdoc/require-param-name": "off",
|
|
227
226
|
|
|
228
|
-
//
|
|
229
|
-
//
|
|
227
|
+
// `tsc` with `noImplicitAny` already reports an untyped parameter, and
|
|
228
|
+
// accepts one typed by its default value
|
|
229
|
+
"jsdoc/require-param-type": "off",
|
|
230
230
|
|
|
231
231
|
// From recommended
|
|
232
232
|
// "jsdoc/require-property": "error",
|
|
@@ -234,11 +234,13 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
234
234
|
// From recommended
|
|
235
235
|
// "jsdoc/require-property-description": "error",
|
|
236
236
|
|
|
237
|
-
//
|
|
238
|
-
//
|
|
237
|
+
// TypeScript fails to parse a `@typedef` `@property` without a name
|
|
238
|
+
// (TS1003); it ignores `@property` anywhere else
|
|
239
|
+
"jsdoc/require-property-name": "off",
|
|
239
240
|
|
|
240
|
-
//
|
|
241
|
-
//
|
|
241
|
+
// Kept: `tsc` reports an untyped `@property` (TS7005) only once the typedef
|
|
242
|
+
// is used, so an exported-only typedef would silently get `any`
|
|
243
|
+
"jsdoc/require-property-type": "error",
|
|
242
244
|
|
|
243
245
|
// A lot of false positive with loops/`switch`/`if`/etc
|
|
244
246
|
"jsdoc/require-returns-check": "off",
|
|
@@ -263,8 +265,8 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
263
265
|
// No need
|
|
264
266
|
// "jsdoc/require-throws-description": "error",
|
|
265
267
|
|
|
266
|
-
//
|
|
267
|
-
|
|
268
|
+
// TypeScript ignores the type of `@throws`
|
|
269
|
+
"jsdoc/require-throws-type": "off",
|
|
268
270
|
|
|
269
271
|
// From recommended
|
|
270
272
|
// "jsdoc/require-yields": "error",
|
|
@@ -272,8 +274,9 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
272
274
|
// No need
|
|
273
275
|
// "jsdoc/require-yields-description": "error",
|
|
274
276
|
|
|
275
|
-
//
|
|
276
|
-
//
|
|
277
|
+
// TypeScript ignores the type of `@yields`; type a generator with
|
|
278
|
+
// `@returns {Generator<…>}` instead
|
|
279
|
+
"jsdoc/require-yields-type": "off",
|
|
277
280
|
|
|
278
281
|
// From recommended
|
|
279
282
|
// "jsdoc/require-yields-check": "error",
|
|
@@ -287,6 +290,9 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
287
290
|
// No need
|
|
288
291
|
// "jsdoc/text-escaping": "error",
|
|
289
292
|
|
|
293
|
+
// From recommended
|
|
294
|
+
// "jsdoc/ts-ban-ts-comment": "error",
|
|
295
|
+
|
|
290
296
|
"jsdoc/type-formatting": [
|
|
291
297
|
"error",
|
|
292
298
|
{
|
|
@@ -300,6 +306,14 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
300
306
|
// Doesn't support function overloading/tuples/`readonly`/module keyword/etc
|
|
301
307
|
// Also `typescript` reports this itself
|
|
302
308
|
"jsdoc/valid-types": "off",
|
|
309
|
+
|
|
310
|
+
// `@import` tags, see `plugins/webpack`
|
|
311
|
+
|
|
312
|
+
"webpack/prefer-import-tag": "error",
|
|
313
|
+
|
|
314
|
+
"webpack/no-duplicate-import-tag": "error",
|
|
315
|
+
|
|
316
|
+
"webpack/no-unused-import-tag": "error",
|
|
303
317
|
},
|
|
304
318
|
};
|
|
305
319
|
}
|
|
@@ -330,8 +344,7 @@ async function getTypescriptRecommendedConfig() {
|
|
|
330
344
|
tsconfigJson.compilerOptions.strict) ||
|
|
331
345
|
true;
|
|
332
346
|
|
|
333
|
-
const
|
|
334
|
-
const { configs } = typescriptPlugin;
|
|
347
|
+
const { configs } = (await import("typescript-eslint")).default;
|
|
335
348
|
/** @type {import("eslint").Linter.Config} */
|
|
336
349
|
const baseConfig = configs.base;
|
|
337
350
|
/** @type {import("eslint").Linter.Config} */
|
|
@@ -370,15 +383,15 @@ async function getTypescriptRecommendedConfig() {
|
|
|
370
383
|
...baseConfig.plugins,
|
|
371
384
|
},
|
|
372
385
|
settings: {
|
|
373
|
-
"import/extensions": allExtensions,
|
|
374
|
-
"import/external-module-folders": [
|
|
386
|
+
"import-x/extensions": allExtensions,
|
|
387
|
+
"import-x/external-module-folders": [
|
|
375
388
|
"node_modules",
|
|
376
389
|
"node_modules/@types",
|
|
377
390
|
],
|
|
378
|
-
"import/parsers": {
|
|
391
|
+
"import-x/parsers": {
|
|
379
392
|
"@typescript-eslint/parser": typescriptExtensions,
|
|
380
393
|
},
|
|
381
|
-
"import/resolver": {
|
|
394
|
+
"import-x/resolver": {
|
|
382
395
|
node: {
|
|
383
396
|
extensions: allExtensions,
|
|
384
397
|
},
|
|
@@ -514,6 +527,9 @@ async function getTypescriptRecommendedConfig() {
|
|
|
514
527
|
// No need
|
|
515
528
|
// "@typescript-eslint/no-for-in-array": "error",
|
|
516
529
|
|
|
530
|
+
// No need
|
|
531
|
+
// "@typescript-eslint/no-generated-empty-object-type": "error",
|
|
532
|
+
|
|
517
533
|
// No need
|
|
518
534
|
// "@typescript-eslint/no-implied-eval": "error",
|
|
519
535
|
|
|
@@ -545,6 +561,9 @@ async function getTypescriptRecommendedConfig() {
|
|
|
545
561
|
// No need
|
|
546
562
|
// "@typescript-eslint/no-misused-promises": "error",
|
|
547
563
|
|
|
564
|
+
// No need
|
|
565
|
+
// "@typescript-eslint/no-misused-promises": "error",
|
|
566
|
+
|
|
548
567
|
// No need
|
|
549
568
|
// "@typescript-eslint/no-misused-spread": "error",
|
|
550
569
|
|
|
@@ -628,6 +647,9 @@ async function getTypescriptRecommendedConfig() {
|
|
|
628
647
|
// From recommended
|
|
629
648
|
// "@typescript-eslint/no-unsafe-declaration-merging": "error",
|
|
630
649
|
|
|
650
|
+
// No need
|
|
651
|
+
// "@typescript-eslint/no-unsafe-enum-assignment": "error",
|
|
652
|
+
|
|
631
653
|
// No need
|
|
632
654
|
// "@typescript-eslint/no-unsafe-enum-comparison": "error",
|
|
633
655
|
|
|
@@ -798,10 +820,10 @@ async function getTypescriptRecommendedConfig() {
|
|
|
798
820
|
// "use-unknown-in-catch-callback-variable": "error",
|
|
799
821
|
|
|
800
822
|
// TypeScript compilation already ensures that named imports exist in the referenced module
|
|
801
|
-
"import/named": "off",
|
|
823
|
+
"import-x/named": "off",
|
|
802
824
|
|
|
803
825
|
// TypeScript handles this for us
|
|
804
|
-
"import/no-unresolved": "off",
|
|
826
|
+
"import-x/no-unresolved": "off",
|
|
805
827
|
},
|
|
806
828
|
},
|
|
807
829
|
isStrict
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { allExtensions, javascriptExtensions } from "./extensions.js";
|
|
2
|
+
import isTypescriptInstalled from "./is-typescript-installed.js";
|
|
3
|
+
|
|
4
|
+
const extensions = isTypescriptInstalled()
|
|
5
|
+
? allExtensions
|
|
6
|
+
: javascriptExtensions;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The files the JavaScript config lints. Configs with JavaScript rules or
|
|
10
|
+
* language options use it as `files` (with `codeIgnores`), so they apply to
|
|
11
|
+
* the same files and not to other languages linted in the same run, such as
|
|
12
|
+
* Markdown.
|
|
13
|
+
*/
|
|
14
|
+
const codeFiles = [
|
|
15
|
+
`**/*.{${extensions.map((extension) => extension.slice(1)).join(",")}}`,
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const codeIgnores = ["**/*.d.ts"];
|
|
19
|
+
|
|
20
|
+
export { codeFiles, codeIgnores, extensions as codeExtensions };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import semver from "semver";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @typedef {2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025} EsVersion
|
|
4
|
+
* @typedef {2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026} EsVersion
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -18,11 +18,16 @@ import semver from "semver";
|
|
|
18
18
|
* @type {ReadonlyArray<{ range: string, esVersion: EsVersion }>}
|
|
19
19
|
*/
|
|
20
20
|
const ranges = [
|
|
21
|
+
// ECMAScript 2026 (ES17): Node 25.0 introduces practical built-in utilities to replace common boilerplate,
|
|
22
|
+
// including native Base64/Hex conversion for Uint8Array, Array.fromAsync(), and Map.prototype.getOrInsert().
|
|
23
|
+
// It also adds Math.sumPrecise() for accurate floating-point addition, Error.isError() for cross-realm checks, Iterator.concat(),
|
|
24
|
+
// and raw source text access in JSON.
|
|
25
|
+
{ range: ">=25.0.0", esVersion: 2026 },
|
|
21
26
|
// ES2025: Node 22.0 ships all ES2025 syntax — import attributes
|
|
22
27
|
// (`with { type: "json" }`), the RegExp `/v` flag, and duplicate named
|
|
23
|
-
// capturing groups.
|
|
24
|
-
//
|
|
25
|
-
//
|
|
28
|
+
// capturing groups. Its standard library has a gap: no Node 22 release has
|
|
29
|
+
// `Promise.try`, and no `eslint-plugin-n` rule reports it, so
|
|
30
|
+
// `unicorn/prefer-promise-try` is gated at ES2026 in `configs/javascript.js`.
|
|
26
31
|
{ range: ">=22.0.0", esVersion: 2025 },
|
|
27
32
|
// ES2023: Array-by-copy (toSorted/toReversed/toSpliced/with), findLast/findLastIndex.
|
|
28
33
|
{ range: ">=20.0.0", esVersion: 2023 },
|
|
@@ -70,11 +70,7 @@ function readJsonFile(dir, filename) {
|
|
|
70
70
|
const text = fs.readFileSync(filePath, "utf8");
|
|
71
71
|
const data = JSON.parse(text);
|
|
72
72
|
|
|
73
|
-
if (
|
|
74
|
-
data !== null &&
|
|
75
|
-
typeof data === "object" &&
|
|
76
|
-
Array.isArray(data) === false
|
|
77
|
-
) {
|
|
73
|
+
if (data !== null && typeof data === "object" && !Array.isArray(data)) {
|
|
78
74
|
data.filePath = filePath;
|
|
79
75
|
return data;
|
|
80
76
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import getJsonFile from "./get-json-file.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @returns {boolean} true when jest is supported by project, otherwise false
|
|
5
|
+
*/
|
|
6
|
+
function isTypescriptInstalled() {
|
|
7
|
+
/** @type {import("type-fest").PackageJson | null} */
|
|
8
|
+
const packageJson = getJsonFile("package.json");
|
|
9
|
+
|
|
10
|
+
if (packageJson === null) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const dependencies = packageJson.dependencies || {};
|
|
15
|
+
const devDependencies = packageJson.devDependencies || {};
|
|
16
|
+
|
|
17
|
+
return dependencies.jest !== undefined || devDependencies.jest !== undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default isTypescriptInstalled;
|
|
@@ -14,9 +14,9 @@ function isTypescriptInstalled() {
|
|
|
14
14
|
const dependencies = packageJson.dependencies || {};
|
|
15
15
|
const devDependencies = packageJson.devDependencies || {};
|
|
16
16
|
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
return (
|
|
18
|
+
dependencies.typescript !== undefined ||
|
|
19
|
+
devDependencies.typescript !== undefined
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
package/configs.js
CHANGED
|
@@ -3,6 +3,7 @@ import semver from "semver";
|
|
|
3
3
|
import configs from "./configs/index.js";
|
|
4
4
|
import getEsVersionFromNode from "./configs/utils/get-es-version-from-node.js";
|
|
5
5
|
import getJsonFile from "./configs/utils/get-json-file.js";
|
|
6
|
+
import isJestInstalled from "./configs/utils/is-jest-installed.js";
|
|
6
7
|
import ignorePaths from "./ignore-paths.js";
|
|
7
8
|
|
|
8
9
|
const packageJson = getJsonFile("package.json");
|
|
@@ -69,6 +70,7 @@ function getJavascriptConfig() {
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
const javascriptConfig = getJavascriptConfig();
|
|
73
|
+
const isJestIntalled = isJestInstalled();
|
|
72
74
|
|
|
73
75
|
const recommended = [
|
|
74
76
|
globalIgnores(ignorePaths),
|
|
@@ -79,15 +81,16 @@ const recommended = [
|
|
|
79
81
|
configs["typescript/jsdoc"],
|
|
80
82
|
configs["typescript/recommended"],
|
|
81
83
|
configs["react/recommended"],
|
|
82
|
-
|
|
84
|
+
isJestIntalled
|
|
85
|
+
? configs["jest/recommended"]
|
|
86
|
+
: configs["node-test/recommended"],
|
|
87
|
+
configs["json/recommended"],
|
|
83
88
|
configs["markdown/recommended"],
|
|
84
89
|
configs["stylistic/recommended"],
|
|
85
|
-
configs["
|
|
90
|
+
configs["performance/recommended"],
|
|
86
91
|
];
|
|
87
92
|
|
|
88
|
-
// TODO remove me in the next major release
|
|
89
93
|
configs.recommended = recommended;
|
|
90
|
-
|
|
91
94
|
configs["node-recommended"] = recommended;
|
|
92
95
|
|
|
93
96
|
const nodeRecommendedModule = [
|
|
@@ -97,15 +100,15 @@ const nodeRecommendedModule = [
|
|
|
97
100
|
configs["typescript/jsdoc"],
|
|
98
101
|
configs["typescript/recommended"],
|
|
99
102
|
configs["react/recommended"],
|
|
100
|
-
|
|
103
|
+
isJestIntalled
|
|
104
|
+
? configs["jest/recommended"]
|
|
105
|
+
: configs["node-test/recommended"],
|
|
106
|
+
configs["json/recommended"],
|
|
101
107
|
configs["markdown/recommended"],
|
|
102
108
|
configs["stylistic/recommended"],
|
|
103
|
-
configs["
|
|
109
|
+
configs["performance/recommended"],
|
|
104
110
|
];
|
|
105
111
|
|
|
106
|
-
// TODO remove me in the next major release
|
|
107
|
-
configs["recommended-module"] = nodeRecommendedModule;
|
|
108
|
-
|
|
109
112
|
configs["node-recommended-module"] = nodeRecommendedModule;
|
|
110
113
|
|
|
111
114
|
const nodeRecommendedCommonJS = [
|
|
@@ -115,15 +118,15 @@ const nodeRecommendedCommonJS = [
|
|
|
115
118
|
configs["typescript/jsdoc"],
|
|
116
119
|
configs["typescript/recommended"],
|
|
117
120
|
configs["react/recommended"],
|
|
118
|
-
|
|
121
|
+
isJestIntalled
|
|
122
|
+
? configs["jest/recommended"]
|
|
123
|
+
: configs["node-test/recommended"],
|
|
124
|
+
configs["json/recommended"],
|
|
119
125
|
configs["markdown/recommended"],
|
|
120
126
|
configs["stylistic/recommended"],
|
|
121
|
-
configs["
|
|
127
|
+
configs["performance/recommended"],
|
|
122
128
|
];
|
|
123
129
|
|
|
124
|
-
// TODO remove me in the next major release
|
|
125
|
-
configs["recommended-commonjs"] = nodeRecommendedCommonJS;
|
|
126
|
-
|
|
127
130
|
configs["node-recommended-commonjs"] = nodeRecommendedCommonJS;
|
|
128
131
|
|
|
129
132
|
const nodeRecommendedDirty = [
|
|
@@ -133,13 +136,14 @@ const nodeRecommendedDirty = [
|
|
|
133
136
|
configs["typescript/jsdoc"],
|
|
134
137
|
configs["typescript/recommended"],
|
|
135
138
|
configs["react/recommended"],
|
|
136
|
-
|
|
139
|
+
isJestIntalled
|
|
140
|
+
? configs["jest/recommended"]
|
|
141
|
+
: configs["node-test/recommended"],
|
|
142
|
+
configs["json/recommended"],
|
|
137
143
|
configs["markdown/recommended"],
|
|
138
144
|
configs["stylistic/recommended"],
|
|
139
|
-
configs["
|
|
145
|
+
configs["performance/recommended"],
|
|
140
146
|
];
|
|
141
|
-
// TODO remove me in the next major release
|
|
142
|
-
configs["recommended-dirty"] = nodeRecommendedDirty;
|
|
143
147
|
|
|
144
148
|
configs["node-recommended-dirty"] = nodeRecommendedDirty;
|
|
145
149
|
|
|
@@ -150,10 +154,13 @@ const browserRecommended = [
|
|
|
150
154
|
configs["typescript/jsdoc"],
|
|
151
155
|
configs["typescript/recommended"],
|
|
152
156
|
configs["react/recommended"],
|
|
153
|
-
|
|
157
|
+
isJestIntalled
|
|
158
|
+
? configs["jest/recommended"]
|
|
159
|
+
: configs["node-test/recommended"],
|
|
160
|
+
configs["json/recommended"],
|
|
154
161
|
configs["markdown/recommended"],
|
|
155
162
|
configs["stylistic/recommended"],
|
|
156
|
-
configs["
|
|
163
|
+
configs["performance/recommended"],
|
|
157
164
|
];
|
|
158
165
|
|
|
159
166
|
configs["browser-recommended"] = browserRecommended;
|
|
@@ -165,10 +172,13 @@ const browserOutdatedRecommendedScript = [
|
|
|
165
172
|
configs["typescript/jsdoc"],
|
|
166
173
|
configs["typescript/recommended"],
|
|
167
174
|
configs["react/recommended"],
|
|
168
|
-
|
|
175
|
+
isJestIntalled
|
|
176
|
+
? configs["jest/recommended"]
|
|
177
|
+
: configs["node-test/recommended"],
|
|
178
|
+
configs["json/recommended"],
|
|
169
179
|
configs["markdown/recommended"],
|
|
170
180
|
configs["stylistic/recommended"],
|
|
171
|
-
configs["
|
|
181
|
+
configs["performance/recommended"],
|
|
172
182
|
];
|
|
173
183
|
|
|
174
184
|
configs["browser-outdated-recommended-script"] =
|
|
@@ -181,10 +191,13 @@ const browserOutdatedRecommendedCommonjs = [
|
|
|
181
191
|
configs["typescript/jsdoc"],
|
|
182
192
|
configs["typescript/recommended"],
|
|
183
193
|
configs["react/recommended"],
|
|
184
|
-
|
|
194
|
+
isJestIntalled
|
|
195
|
+
? configs["jest/recommended"]
|
|
196
|
+
: configs["node-test/recommended"],
|
|
197
|
+
configs["json/recommended"],
|
|
185
198
|
configs["markdown/recommended"],
|
|
186
199
|
configs["stylistic/recommended"],
|
|
187
|
-
configs["
|
|
200
|
+
configs["performance/recommended"],
|
|
188
201
|
];
|
|
189
202
|
|
|
190
203
|
configs["browser-outdated-recommended-commonjs"] =
|
|
@@ -202,15 +215,15 @@ const browserOutdatedRecommendedModule = [
|
|
|
202
215
|
configs["typescript/jsdoc"],
|
|
203
216
|
configs["typescript/recommended"],
|
|
204
217
|
configs["react/recommended"],
|
|
205
|
-
|
|
218
|
+
isJestIntalled
|
|
219
|
+
? configs["jest/recommended"]
|
|
220
|
+
: configs["node-test/recommended"],
|
|
221
|
+
configs["json/recommended"],
|
|
206
222
|
configs["markdown/recommended"],
|
|
207
223
|
configs["stylistic/recommended"],
|
|
208
|
-
configs["
|
|
224
|
+
configs["performance/recommended"],
|
|
209
225
|
];
|
|
210
226
|
|
|
211
|
-
// TODO remove in the next major release
|
|
212
|
-
configs["browser-outdated-recommended"] = browserOutdatedRecommendedModule;
|
|
213
|
-
|
|
214
227
|
configs["browser-outdated-recommended-module"] =
|
|
215
228
|
browserOutdatedRecommendedModule;
|
|
216
229
|
|
|
@@ -224,10 +237,13 @@ const universalRecommended = [
|
|
|
224
237
|
configs["typescript/jsdoc"],
|
|
225
238
|
configs["typescript/recommended"],
|
|
226
239
|
configs["react/recommended"],
|
|
227
|
-
|
|
240
|
+
isJestIntalled
|
|
241
|
+
? configs["jest/recommended"]
|
|
242
|
+
: configs["node-test/recommended"],
|
|
243
|
+
configs["json/recommended"],
|
|
228
244
|
configs["markdown/recommended"],
|
|
229
245
|
configs["stylistic/recommended"],
|
|
230
|
-
configs["
|
|
246
|
+
configs["performance/recommended"],
|
|
231
247
|
];
|
|
232
248
|
|
|
233
249
|
configs["universal-recommended"] = universalRecommended;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-webpack",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Provides Webpack's eslint rules as an extensible shared config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -32,49 +32,56 @@
|
|
|
32
32
|
"configs"
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
|
-
"lint": "npm run lint:code && npm run lint:types",
|
|
35
|
+
"lint": "npm run lint:code && npm run lint:types && npm run fmt:check",
|
|
36
36
|
"lint:code": "eslint --cache .",
|
|
37
37
|
"lint:types": "tsc -p tsconfig.internal.json",
|
|
38
|
+
"fmt": "prettier --cache --write .",
|
|
39
|
+
"fmt:check": "prettier --cache --check .",
|
|
38
40
|
"test": "cd test && node --test",
|
|
41
|
+
"rules:not-enabled": "node scripts/find-not-enabled-rules.js",
|
|
42
|
+
"test:webpack": "node scripts/test-on-webpack.js",
|
|
39
43
|
"version": "changeset version",
|
|
40
44
|
"release": "changeset publish"
|
|
41
45
|
},
|
|
42
46
|
"dependencies": {
|
|
43
|
-
"@eslint/
|
|
44
|
-
"@eslint/
|
|
45
|
-
"@
|
|
47
|
+
"@eslint-community/eslint-utils": "^4.10.1",
|
|
48
|
+
"@eslint-community/regexpp": "^4.12.2",
|
|
49
|
+
"@eslint-react/eslint-plugin": "^5.30.5",
|
|
50
|
+
"@eslint/js": "^10.0.1",
|
|
51
|
+
"@eslint/json": "^2.1.1",
|
|
52
|
+
"@eslint/markdown": "^9.0.0",
|
|
53
|
+
"@stylistic/eslint-plugin": "^6.0.1",
|
|
46
54
|
"detect-indent": "^7.0.2",
|
|
47
55
|
"eslint-config-prettier": "^10.1.8",
|
|
48
|
-
"eslint-
|
|
49
|
-
"eslint-plugin-
|
|
50
|
-
"eslint-plugin-
|
|
51
|
-
"eslint-plugin-
|
|
52
|
-
"eslint-plugin-
|
|
53
|
-
"eslint-plugin-
|
|
56
|
+
"eslint-node-test": "^1.0.1",
|
|
57
|
+
"eslint-plugin-import-x": "^4.18.1",
|
|
58
|
+
"eslint-plugin-jest": "^29.17.0",
|
|
59
|
+
"eslint-plugin-jsdoc": "^65.5.0",
|
|
60
|
+
"eslint-plugin-n": "^18.3.0",
|
|
61
|
+
"eslint-plugin-prettier": "^5.5.7",
|
|
54
62
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
55
|
-
"eslint-plugin-unicorn": "^
|
|
56
|
-
"globals": "^17.
|
|
57
|
-
"jsonc-eslint-parser": "^3.
|
|
63
|
+
"eslint-plugin-unicorn": "^80.0.0",
|
|
64
|
+
"globals": "^17.14.0",
|
|
65
|
+
"jsonc-eslint-parser": "^3.3.0",
|
|
58
66
|
"semver": "^7.8.0",
|
|
59
67
|
"sort-package-json": "^4.0.0",
|
|
60
|
-
"typescript-eslint": "^8.
|
|
68
|
+
"typescript-eslint": "^8.72.1"
|
|
61
69
|
},
|
|
62
70
|
"devDependencies": {
|
|
63
71
|
"@changesets/cli": "^3.0.2",
|
|
64
|
-
"@changesets/get-github-info": "^0.
|
|
65
|
-
"@types/semver": "^7.
|
|
66
|
-
"eslint": "^
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"react": "^19.
|
|
71
|
-
"
|
|
72
|
-
"type-fest": "^5.6.0",
|
|
72
|
+
"@changesets/get-github-info": "^1.0.1",
|
|
73
|
+
"@types/semver": "^7.8.0",
|
|
74
|
+
"eslint": "^10.15.0",
|
|
75
|
+
"jest": "^30.5.2",
|
|
76
|
+
"prettier": "^3.9.10",
|
|
77
|
+
"react": "^19.3.1",
|
|
78
|
+
"react-dom": "^19.3.1",
|
|
79
|
+
"type-fest": "^6.0.3",
|
|
73
80
|
"typescript": "^6.0.3"
|
|
74
81
|
},
|
|
75
82
|
"peerDependencies": {
|
|
76
|
-
"eslint": ">=
|
|
77
|
-
"typescript": ">=
|
|
83
|
+
"eslint": ">= 10.15.0",
|
|
84
|
+
"typescript": ">=5.0.0 <8.0.0"
|
|
78
85
|
},
|
|
79
86
|
"peerDependenciesMeta": {
|
|
80
87
|
"typescript": {
|
|
@@ -82,6 +89,6 @@
|
|
|
82
89
|
}
|
|
83
90
|
},
|
|
84
91
|
"engines": {
|
|
85
|
-
"node": ">=
|
|
92
|
+
"node": "^22.11.0 || >=24.0.0"
|
|
86
93
|
}
|
|
87
94
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
// eslint-disable-next-line import/no-unresolved
|
|
3
|
-
import * as parserJsonc from "jsonc-eslint-parser";
|
|
4
2
|
import { rule as orderProperties } from "./rules/order-properties.js";
|
|
5
3
|
|
|
6
4
|
const require = createRequire(import.meta.url);
|
|
@@ -25,9 +23,6 @@ const configs = {
|
|
|
25
23
|
recommended: {
|
|
26
24
|
name: "package-json/recommended",
|
|
27
25
|
files: ["**/package.json"],
|
|
28
|
-
languageOptions: {
|
|
29
|
-
parser: parserJsonc,
|
|
30
|
-
},
|
|
31
26
|
plugins: {
|
|
32
27
|
get "package-json"() {
|
|
33
28
|
// eslint-disable-next-line no-use-before-define
|