eslint-config-webpack 4.6.2 → 4.7.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/configs/browser.js +2 -0
- package/configs/javascript.js +27 -6
- package/configs/jest.js +9 -0
- package/configs/markdown.js +1 -1
- package/configs/node.js +20 -9
- package/configs/typescript.js +45 -19
- package/configs/utils/is-typescript-installed.js +1 -1
- package/package.json +22 -22
- package/plugins/package-json/rules/order-properties.js +4 -3
package/configs/browser.js
CHANGED
package/configs/javascript.js
CHANGED
|
@@ -2,7 +2,8 @@ import javascriptConfig from "@eslint/js";
|
|
|
2
2
|
import importPlugin from "eslint-plugin-import";
|
|
3
3
|
import unicornPlugin from "eslint-plugin-unicorn";
|
|
4
4
|
import globals from "globals";
|
|
5
|
-
import { allExtensions } from "./utils/extensions.js";
|
|
5
|
+
import { allExtensions, javascriptExtensions } from "./utils/extensions.js";
|
|
6
|
+
import isTypescriptInstalled from "./utils/is-typescript-installed.js";
|
|
6
7
|
|
|
7
8
|
const possibleProblems = {
|
|
8
9
|
"array-callback-return": [
|
|
@@ -625,6 +626,8 @@ const suggestions = {
|
|
|
625
626
|
|
|
626
627
|
"prefer-template": "error",
|
|
627
628
|
|
|
629
|
+
"preserve-caught-error": "error",
|
|
630
|
+
|
|
628
631
|
radix: ["error", "always"],
|
|
629
632
|
|
|
630
633
|
// `require-await` doesn't work when the function returns Promise<any>
|
|
@@ -749,6 +752,8 @@ const unicornRules = {
|
|
|
749
752
|
// No need
|
|
750
753
|
// "unicorn/no-array-reverse": "off",
|
|
751
754
|
|
|
755
|
+
"unicorn/no-array-sort": "error",
|
|
756
|
+
|
|
752
757
|
// No need
|
|
753
758
|
// "unicorn/no-await-expression-member": "off",
|
|
754
759
|
|
|
@@ -767,6 +772,9 @@ const unicornRules = {
|
|
|
767
772
|
|
|
768
773
|
"unicorn/no-hex-escape": "error",
|
|
769
774
|
|
|
775
|
+
// No need
|
|
776
|
+
// "unicorn/no-immediate-mutation": "error",
|
|
777
|
+
|
|
770
778
|
"unicorn/no-instanceof-builtins": "error",
|
|
771
779
|
|
|
772
780
|
"unicorn/no-invalid-fetch-options": "error",
|
|
@@ -840,6 +848,8 @@ const unicornRules = {
|
|
|
840
848
|
// No need
|
|
841
849
|
// "unicorn/no-unused-properties": "off",
|
|
842
850
|
|
|
851
|
+
"unicorn/no-useless-collection-argument": "error",
|
|
852
|
+
|
|
843
853
|
"unicorn/no-useless-error-capture-stack-trace": "error",
|
|
844
854
|
|
|
845
855
|
"unicorn/no-useless-fallback-in-spread": "error",
|
|
@@ -881,10 +891,15 @@ const unicornRules = {
|
|
|
881
891
|
// No need
|
|
882
892
|
// "unicorn/prefer-at": "off",
|
|
883
893
|
|
|
894
|
+
"unicorn/prefer-bigint-literals": "error",
|
|
895
|
+
|
|
884
896
|
"unicorn/prefer-blob-reading-methods": "error",
|
|
885
897
|
|
|
886
898
|
"unicorn/prefer-class-fields": "error",
|
|
887
899
|
|
|
900
|
+
// Not here, define only for `browsers`
|
|
901
|
+
// "unicorn/prefer-classlist-toggle": "error",
|
|
902
|
+
|
|
888
903
|
// No need
|
|
889
904
|
// "unicorn/prefer-code-point": "error",
|
|
890
905
|
|
|
@@ -962,6 +977,8 @@ const unicornRules = {
|
|
|
962
977
|
|
|
963
978
|
"unicorn/prefer-regexp-test": "error",
|
|
964
979
|
|
|
980
|
+
"unicorn/prefer-response-static-json": "error",
|
|
981
|
+
|
|
965
982
|
// No need
|
|
966
983
|
// "unicorn/prefer-set-has": "off",
|
|
967
984
|
|
|
@@ -1004,6 +1021,8 @@ const unicornRules = {
|
|
|
1004
1021
|
// No need
|
|
1005
1022
|
// "unicorn/require-array-join-separator": "error",
|
|
1006
1023
|
|
|
1024
|
+
"unicorn/require-module-attributes": "error",
|
|
1025
|
+
|
|
1007
1026
|
"unicorn/require-module-specifiers": "error",
|
|
1008
1027
|
|
|
1009
1028
|
// No need
|
|
@@ -1182,20 +1201,23 @@ const importRules = {
|
|
|
1182
1201
|
* @returns {Record<string, string | number>} config
|
|
1183
1202
|
*/
|
|
1184
1203
|
function getConfig(esVersion) {
|
|
1204
|
+
const extensions = isTypescriptInstalled()
|
|
1205
|
+
? allExtensions
|
|
1206
|
+
: javascriptExtensions;
|
|
1185
1207
|
const config = {
|
|
1186
1208
|
...javascriptConfig.configs.recommended,
|
|
1187
1209
|
name: `javascript/es${esVersion}`,
|
|
1188
|
-
files: [`**/*.{${
|
|
1210
|
+
files: [`**/*.{${extensions.map((item) => item.slice(1)).join(",")}}`],
|
|
1189
1211
|
ignores: ["**/*.d.ts"],
|
|
1190
1212
|
settings: {
|
|
1191
|
-
"import/extensions":
|
|
1213
|
+
"import/extensions": extensions,
|
|
1192
1214
|
"import/ignore": [
|
|
1193
1215
|
"eslint-plugin-.*",
|
|
1194
1216
|
"\\.(coffee|scss|css|less|hbs|svg|md|jpg|jpeg|png|gif|webp|avif)$",
|
|
1195
1217
|
],
|
|
1196
1218
|
"import/resolver": {
|
|
1197
1219
|
node: {
|
|
1198
|
-
extensions: [...
|
|
1220
|
+
extensions: [...extensions],
|
|
1199
1221
|
},
|
|
1200
1222
|
},
|
|
1201
1223
|
},
|
|
@@ -1245,8 +1267,6 @@ function getConfig(esVersion) {
|
|
|
1245
1267
|
config.rules["prefer-object-spread"] = "off";
|
|
1246
1268
|
}
|
|
1247
1269
|
|
|
1248
|
-
// unicorn/prefer-class-fields
|
|
1249
|
-
|
|
1250
1270
|
if (esVersion < 2019) {
|
|
1251
1271
|
config.rules["unicorn/prefer-object-from-entries"] = "off";
|
|
1252
1272
|
config.rules["unicorn/prefer-array-flat"] = "off";
|
|
@@ -1256,6 +1276,7 @@ function getConfig(esVersion) {
|
|
|
1256
1276
|
}
|
|
1257
1277
|
|
|
1258
1278
|
if (esVersion < 2020) {
|
|
1279
|
+
config.rules["unicorn/prefer-bigint-literals"] = "off";
|
|
1259
1280
|
config.rules["unicorn/prefer-global-this"] = "off";
|
|
1260
1281
|
config.rules["unicorn/prefer-logical-operator-over-ternary"] = "off";
|
|
1261
1282
|
}
|
package/configs/jest.js
CHANGED
|
@@ -102,6 +102,8 @@ async function getJestRecommendedConfig() {
|
|
|
102
102
|
// No need
|
|
103
103
|
// "jest/no-test-return-statement": "error",
|
|
104
104
|
|
|
105
|
+
"jest/no-unneeded-async-expect-function": "error",
|
|
106
|
+
|
|
105
107
|
// No need
|
|
106
108
|
// "jest/no-untyped-mock-factory": "error",
|
|
107
109
|
|
|
@@ -164,6 +166,10 @@ async function getJestRecommendedConfig() {
|
|
|
164
166
|
|
|
165
167
|
"jest/prefer-to-contain": "error",
|
|
166
168
|
|
|
169
|
+
"jest/prefer-to-have-been-called": "error",
|
|
170
|
+
|
|
171
|
+
"jest/prefer-to-have-been-called-times": "error",
|
|
172
|
+
|
|
167
173
|
"jest/prefer-to-have-length": "error",
|
|
168
174
|
|
|
169
175
|
// No need
|
|
@@ -186,6 +192,9 @@ async function getJestRecommendedConfig() {
|
|
|
186
192
|
// From recommended
|
|
187
193
|
// "jest/valid-expect-in-promise": "error",
|
|
188
194
|
|
|
195
|
+
// No need
|
|
196
|
+
// "valid-mock-module-path": "off",
|
|
197
|
+
|
|
189
198
|
// From recommended
|
|
190
199
|
"jest/valid-title": [
|
|
191
200
|
"error",
|
package/configs/markdown.js
CHANGED
package/configs/node.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import importPlugin from "eslint-plugin-import";
|
|
2
2
|
import globals from "globals";
|
|
3
|
+
import isTypescriptInstalled from "./utils/is-typescript-installed.js";
|
|
3
4
|
|
|
4
5
|
const commonRules = {
|
|
5
6
|
// No need
|
|
@@ -263,6 +264,16 @@ async function getDirtyConfig() {
|
|
|
263
264
|
|
|
264
265
|
const dirtyConfig = await getDirtyConfig();
|
|
265
266
|
|
|
267
|
+
const jsExtensions = isTypescriptInstalled()
|
|
268
|
+
? ["**/*.{js,jsx,ts,tsx}"]
|
|
269
|
+
: ["**/*.{js,jsx}"];
|
|
270
|
+
const cjsExtensions = isTypescriptInstalled()
|
|
271
|
+
? ["**/*.{cjs,cts}"]
|
|
272
|
+
: ["**/*.{cjs}"];
|
|
273
|
+
const mjsExtensions = isTypescriptInstalled()
|
|
274
|
+
? ["**/*.{mjs,mts}"]
|
|
275
|
+
: ["**/*.{mjs}"];
|
|
276
|
+
|
|
266
277
|
export default {
|
|
267
278
|
"node/dirty": dirtyConfig,
|
|
268
279
|
"node/commonjs": commonjsConfig,
|
|
@@ -270,43 +281,43 @@ export default {
|
|
|
270
281
|
"node/recommended": moduleConfig,
|
|
271
282
|
"node/mixed-dirty": [
|
|
272
283
|
{
|
|
273
|
-
files:
|
|
284
|
+
files: jsExtensions,
|
|
274
285
|
...dirtyConfig,
|
|
275
286
|
},
|
|
276
287
|
{
|
|
277
|
-
files:
|
|
288
|
+
files: cjsExtensions,
|
|
278
289
|
...commonjsConfig,
|
|
279
290
|
},
|
|
280
291
|
{
|
|
281
|
-
files:
|
|
292
|
+
files: mjsExtensions,
|
|
282
293
|
...moduleConfig,
|
|
283
294
|
},
|
|
284
295
|
],
|
|
285
296
|
"node/mixed-module-and-commonjs": [
|
|
286
297
|
{
|
|
287
|
-
files:
|
|
298
|
+
files: jsExtensions,
|
|
288
299
|
...moduleConfig,
|
|
289
300
|
},
|
|
290
301
|
{
|
|
291
|
-
files:
|
|
302
|
+
files: cjsExtensions,
|
|
292
303
|
...commonjsConfig,
|
|
293
304
|
},
|
|
294
305
|
{
|
|
295
|
-
files:
|
|
306
|
+
files: mjsExtensions,
|
|
296
307
|
...moduleConfig,
|
|
297
308
|
},
|
|
298
309
|
],
|
|
299
310
|
"node/mixed-commonjs-and-module": [
|
|
300
311
|
{
|
|
301
|
-
files:
|
|
312
|
+
files: jsExtensions,
|
|
302
313
|
...commonjsConfig,
|
|
303
314
|
},
|
|
304
315
|
{
|
|
305
|
-
files:
|
|
316
|
+
files: cjsExtensions,
|
|
306
317
|
...commonjsConfig,
|
|
307
318
|
},
|
|
308
319
|
{
|
|
309
|
-
files:
|
|
320
|
+
files: mjsExtensions,
|
|
310
321
|
...moduleConfig,
|
|
311
322
|
},
|
|
312
323
|
],
|
package/configs/typescript.js
CHANGED
|
@@ -105,6 +105,9 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
105
105
|
// From recommended
|
|
106
106
|
// "jsdoc/empty-tags": "error",
|
|
107
107
|
|
|
108
|
+
// From recommended
|
|
109
|
+
// "jsdoc/escape-inline-tags": "error",
|
|
110
|
+
|
|
108
111
|
// "jsdoc/implements-on-classes": "error",
|
|
109
112
|
|
|
110
113
|
// No need
|
|
@@ -154,28 +157,11 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
154
157
|
message:
|
|
155
158
|
"Please use `@property {string=} property`/`@param {string=} arg` instead `[arg]` for optional properties and parameters",
|
|
156
159
|
},
|
|
157
|
-
// No `*` type
|
|
158
|
-
{
|
|
159
|
-
comment: "JsdocBlock:has(JsdocTypeAny)",
|
|
160
|
-
message: "Please use `any` or `EXPECTED_ANY` type.",
|
|
161
|
-
},
|
|
162
160
|
// No `?` type
|
|
163
161
|
{
|
|
164
162
|
comment: "JsdocBlock:has(JsdocTypeUnknown)",
|
|
165
163
|
message: "Please use `unknown` or `any` (or `EXPECTED_ANY`) type",
|
|
166
164
|
},
|
|
167
|
-
// No `any` type
|
|
168
|
-
{
|
|
169
|
-
comment: "JsdocBlock:has(JsdocTypeName[value=/^any$/])",
|
|
170
|
-
message: "Please use provide types instead `any`",
|
|
171
|
-
},
|
|
172
|
-
// No `Function` type
|
|
173
|
-
{
|
|
174
|
-
comment:
|
|
175
|
-
"JsdocBlock:has(JsdocTypeName[value=/^(function|Function)$/])",
|
|
176
|
-
message:
|
|
177
|
-
"Please use provide types for function - `(a: number, b: number) -> number` instead `Function`/`function` or use `EXPECTED_FUNCTION` type",
|
|
178
|
-
},
|
|
179
165
|
// No `Object`
|
|
180
166
|
{
|
|
181
167
|
comment:
|
|
@@ -199,6 +185,13 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
199
185
|
// No need
|
|
200
186
|
// "jsdoc/no-undefined-types": "error",
|
|
201
187
|
|
|
188
|
+
// TODO enable me in future
|
|
189
|
+
// "jsdoc/prefer-import-tag": "error",
|
|
190
|
+
|
|
191
|
+
"jsdoc/reject-any-type": "error",
|
|
192
|
+
|
|
193
|
+
"jsdoc/reject-function-type": "error",
|
|
194
|
+
|
|
202
195
|
"jsdoc/require-asterisk-prefix": "error",
|
|
203
196
|
|
|
204
197
|
// No need
|
|
@@ -219,6 +212,12 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
219
212
|
// From recommended
|
|
220
213
|
// "jsdoc/require-jsdoc": "error",
|
|
221
214
|
|
|
215
|
+
// No need
|
|
216
|
+
// "jsdoc/require-next-description":"error",
|
|
217
|
+
|
|
218
|
+
// No need
|
|
219
|
+
// "jsdoc/require-next-type": "error",
|
|
220
|
+
|
|
222
221
|
// From recommended
|
|
223
222
|
// "jsdoc/require-param": "error",
|
|
224
223
|
|
|
@@ -252,14 +251,32 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
252
251
|
// From recommended
|
|
253
252
|
// "jsdoc/require-returns-type": "error",
|
|
254
253
|
|
|
254
|
+
// No need
|
|
255
|
+
// "jsdoc/require-tags": "error",
|
|
256
|
+
|
|
255
257
|
"jsdoc/require-template": "error",
|
|
256
258
|
|
|
259
|
+
// No need
|
|
260
|
+
// "jsdoc/require-template-description": "error",
|
|
261
|
+
|
|
257
262
|
// No need
|
|
258
263
|
// "jsdoc/require-throws": "error",
|
|
259
264
|
|
|
265
|
+
// No need
|
|
266
|
+
// "jsdoc/require-throws-description": "error",
|
|
267
|
+
|
|
268
|
+
// No need
|
|
269
|
+
// "jsdoc/require-throws-type": "error",
|
|
270
|
+
|
|
260
271
|
// From recommended
|
|
261
272
|
// "jsdoc/require-yields": "error",
|
|
262
273
|
|
|
274
|
+
// No need
|
|
275
|
+
// "jsdoc/require-yields-description": "error",
|
|
276
|
+
|
|
277
|
+
// No need
|
|
278
|
+
// "jsdoc/require-yields-type": "error",
|
|
279
|
+
|
|
263
280
|
// From recommended
|
|
264
281
|
// "jsdoc/require-yields-check": "error",
|
|
265
282
|
|
|
@@ -272,6 +289,9 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
272
289
|
// No need
|
|
273
290
|
// "jsdoc/text-escaping": "error",
|
|
274
291
|
|
|
292
|
+
// TODO enable after https://github.com/gajus/eslint-plugin-jsdoc/issues/1615
|
|
293
|
+
// "jsdoc/type-formatting": "error",
|
|
294
|
+
|
|
275
295
|
// Doesn't support function overloading/tuples/`readonly`/module keyword/etc
|
|
276
296
|
// Also `typescript` reports this itself
|
|
277
297
|
"jsdoc/valid-types": "off",
|
|
@@ -279,8 +299,6 @@ async function getTypescriptJSDocRecommendedConfig() {
|
|
|
279
299
|
};
|
|
280
300
|
}
|
|
281
301
|
|
|
282
|
-
const allExtensions = [...typescriptExtensions, ...javascriptExtensions];
|
|
283
|
-
|
|
284
302
|
/**
|
|
285
303
|
* @returns {Promise<Record<string, string>>} config
|
|
286
304
|
*/
|
|
@@ -311,6 +329,8 @@ async function getTypescriptRecommendedConfig() {
|
|
|
311
329
|
(item) => item.name === "typescript-eslint/stylistic",
|
|
312
330
|
);
|
|
313
331
|
|
|
332
|
+
const allExtensions = [...typescriptExtensions, ...javascriptExtensions];
|
|
333
|
+
|
|
314
334
|
return {
|
|
315
335
|
...baseConfig,
|
|
316
336
|
name: "typescript/recommended",
|
|
@@ -598,6 +618,9 @@ async function getTypescriptRecommendedConfig() {
|
|
|
598
618
|
// From recommended
|
|
599
619
|
// "@typescript-eslint/no-unused-expressions": "error",
|
|
600
620
|
|
|
621
|
+
"no-unused-private-class-members": "off",
|
|
622
|
+
"@typescript-eslint/no-unused-private-class-members": "error",
|
|
623
|
+
|
|
601
624
|
// Provide better options
|
|
602
625
|
"no-unused-vars": "off",
|
|
603
626
|
"@typescript-eslint/no-unused-vars": [
|
|
@@ -633,6 +656,9 @@ async function getTypescriptRecommendedConfig() {
|
|
|
633
656
|
// No need
|
|
634
657
|
// "@typescript-eslint/no-useless-constructor": "error",
|
|
635
658
|
|
|
659
|
+
// No need
|
|
660
|
+
// "@typescript-eslint/no-useless-default-assignment": "error",
|
|
661
|
+
|
|
636
662
|
"@typescript-eslint/no-useless-empty-export": "error",
|
|
637
663
|
|
|
638
664
|
// From recommended
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-webpack",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "Provides Webpack's eslint rules as an extensible shared config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -37,32 +37,32 @@
|
|
|
37
37
|
"release": "standard-version"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"detect-indent": "^7.0.
|
|
41
|
-
"jsonc-eslint-parser": "^2.4.
|
|
42
|
-
"semver": "^7.7.
|
|
43
|
-
"sort-package-json": "^3.
|
|
40
|
+
"detect-indent": "^7.0.2",
|
|
41
|
+
"jsonc-eslint-parser": "^2.4.2",
|
|
42
|
+
"semver": "^7.7.3",
|
|
43
|
+
"sort-package-json": "^3.6.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@eslint/js": "^9.
|
|
47
|
-
"@eslint/markdown": "^7.1
|
|
48
|
-
"@stylistic/eslint-plugin": "^5.
|
|
49
|
-
"eslint": "^9.
|
|
46
|
+
"@eslint/js": "^9.39.2",
|
|
47
|
+
"@eslint/markdown": "^7.5.1",
|
|
48
|
+
"@stylistic/eslint-plugin": "^5.6.1",
|
|
49
|
+
"eslint": "^9.39.2",
|
|
50
50
|
"eslint-find-rules": "^5.0.0",
|
|
51
51
|
"eslint-plugin-import": "^2.32.0",
|
|
52
|
-
"eslint-plugin-jest": "^29.0
|
|
53
|
-
"eslint-plugin-jsdoc": "^
|
|
54
|
-
"eslint-plugin-n": "^17.
|
|
52
|
+
"eslint-plugin-jest": "^29.5.0",
|
|
53
|
+
"eslint-plugin-jsdoc": "^61.5.0",
|
|
54
|
+
"eslint-plugin-n": "^17.23.1",
|
|
55
55
|
"eslint-plugin-prettier": "^5.5.3",
|
|
56
56
|
"eslint-plugin-react": "^7.37.5",
|
|
57
|
-
"eslint-plugin-unicorn": "^
|
|
58
|
-
"globals": "^16.
|
|
59
|
-
"jest": "^30.0
|
|
60
|
-
"prettier": "^3.
|
|
61
|
-
"react": "^19.
|
|
62
|
-
"react-dom": "^19.
|
|
57
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
58
|
+
"globals": "^16.5.0",
|
|
59
|
+
"jest": "^30.2.0",
|
|
60
|
+
"prettier": "^3.7.4",
|
|
61
|
+
"react": "^19.2.3",
|
|
62
|
+
"react-dom": "^19.2.3",
|
|
63
63
|
"standard-version": "^9.5.0",
|
|
64
|
-
"typescript": "^5.
|
|
65
|
-
"typescript-eslint": "^8.
|
|
64
|
+
"typescript": "^5.9.3",
|
|
65
|
+
"typescript-eslint": "^8.50.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@eslint/js": ">= 9.28.0",
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
"eslint-plugin-prettier": ">= 5.5.3",
|
|
78
78
|
"eslint-plugin-react": ">= 7.37.5",
|
|
79
79
|
"eslint-plugin-unicorn": ">= 60.0.0",
|
|
80
|
-
"globals": ">= 16.
|
|
80
|
+
"globals": ">= 16.5.0",
|
|
81
81
|
"prettier": ">= 3.5.3",
|
|
82
82
|
"typescript": ">= 5.0.0",
|
|
83
|
-
"typescript-eslint": ">= 8.
|
|
83
|
+
"typescript-eslint": ">= 8.50.0"
|
|
84
84
|
},
|
|
85
85
|
"peerDependenciesMeta": {
|
|
86
86
|
"@eslint/markdown": {
|
|
@@ -30,7 +30,7 @@ function detectNewlineGraceful(string) {
|
|
|
30
30
|
return detectNewline(string) || "\n";
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
// eslint-disable-next-line jsdoc/
|
|
33
|
+
// eslint-disable-next-line jsdoc/reject-any-type
|
|
34
34
|
/** @typedef {Record<string, any>} ObjectToSort */
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -50,7 +50,7 @@ function sortObjectKeys(object, sortWith) {
|
|
|
50
50
|
|
|
51
51
|
const objectKeys = Object.keys(object);
|
|
52
52
|
|
|
53
|
-
return (keys ||
|
|
53
|
+
return (keys || objectKeys.toSorted(sortFn)).reduce((total, key) => {
|
|
54
54
|
if (Object.hasOwn(object, key)) {
|
|
55
55
|
total[key] = object[key];
|
|
56
56
|
}
|
|
@@ -66,11 +66,12 @@ function sortObjectKeys(object, sortWith) {
|
|
|
66
66
|
export const isPackageJson = (filePath) =>
|
|
67
67
|
/(?:^|[/\\])package.json$/.test(filePath);
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
/* eslint-disable jsdoc/reject-any-type */
|
|
70
70
|
/**
|
|
71
71
|
* @typedef {import("eslint").AST.Program} PackageJsonAst
|
|
72
72
|
* @property {[any]} body body
|
|
73
73
|
*/
|
|
74
|
+
/* eslint-enable jsdoc/reject-any-type */
|
|
74
75
|
|
|
75
76
|
/**
|
|
76
77
|
* @typedef {import("eslint").SourceCode} PackageJsonSourceCode
|