@debbl/eslint-config 3.8.0 → 3.8.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/dist/index.cjs +121 -35
- package/dist/index.js +121 -35
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -248,7 +248,10 @@ async function imports() {
|
|
|
248
248
|
"import/no-named-default": "error",
|
|
249
249
|
"import/no-self-import": "error",
|
|
250
250
|
"import/no-webpack-loader-syntax": "error",
|
|
251
|
-
"import/newline-after-import": [
|
|
251
|
+
"import/newline-after-import": [
|
|
252
|
+
"error",
|
|
253
|
+
{ considerComments: true, count: 1 }
|
|
254
|
+
],
|
|
252
255
|
"import/consistent-type-specifier-style": ["error", "prefer-top-level"]
|
|
253
256
|
}
|
|
254
257
|
}
|
|
@@ -259,7 +262,9 @@ async function imports() {
|
|
|
259
262
|
var import_globals = __toESM(require("globals"), 1);
|
|
260
263
|
var javascript = async (options) => {
|
|
261
264
|
const { overrides = {} } = options;
|
|
262
|
-
const pluginUnusedImports = await interopDefault(
|
|
265
|
+
const pluginUnusedImports = await interopDefault(
|
|
266
|
+
import("eslint-plugin-unused-imports")
|
|
267
|
+
);
|
|
263
268
|
return [
|
|
264
269
|
{
|
|
265
270
|
name: "eslint/javascript/rules",
|
|
@@ -289,14 +294,20 @@ var javascript = async (options) => {
|
|
|
289
294
|
"unused-imports": pluginUnusedImports
|
|
290
295
|
},
|
|
291
296
|
rules: {
|
|
292
|
-
"accessor-pairs": [
|
|
297
|
+
"accessor-pairs": [
|
|
298
|
+
"error",
|
|
299
|
+
{ enforceForClassMembers: true, setWithoutGet: true }
|
|
300
|
+
],
|
|
293
301
|
"array-callback-return": "error",
|
|
294
302
|
"block-scoped-var": "error",
|
|
295
303
|
"constructor-super": "error",
|
|
296
304
|
"default-case-last": "error",
|
|
297
305
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
298
306
|
"eqeqeq": ["error", "smart"],
|
|
299
|
-
"new-cap": [
|
|
307
|
+
"new-cap": [
|
|
308
|
+
"error",
|
|
309
|
+
{ capIsNew: false, newIsCap: true, properties: true }
|
|
310
|
+
],
|
|
300
311
|
"no-alert": "error",
|
|
301
312
|
"no-array-constructor": "error",
|
|
302
313
|
"no-async-promise-executor": "error",
|
|
@@ -375,7 +386,11 @@ var javascript = async (options) => {
|
|
|
375
386
|
property: "__lookupSetter__"
|
|
376
387
|
}
|
|
377
388
|
],
|
|
378
|
-
"no-restricted-syntax": [
|
|
389
|
+
"no-restricted-syntax": [
|
|
390
|
+
"error",
|
|
391
|
+
"TSEnumDeclaration[const=true]",
|
|
392
|
+
"TSExportAssignment"
|
|
393
|
+
],
|
|
379
394
|
"no-self-assign": ["error", { props: true }],
|
|
380
395
|
"no-self-compare": "error",
|
|
381
396
|
"no-sequences": "error",
|
|
@@ -410,7 +425,10 @@ var javascript = async (options) => {
|
|
|
410
425
|
vars: "all"
|
|
411
426
|
}
|
|
412
427
|
],
|
|
413
|
-
"no-use-before-define": [
|
|
428
|
+
"no-use-before-define": [
|
|
429
|
+
"error",
|
|
430
|
+
{ classes: false, functions: false, variables: true }
|
|
431
|
+
],
|
|
414
432
|
"no-useless-backreference": "error",
|
|
415
433
|
"no-useless-call": "error",
|
|
416
434
|
"no-useless-catch": "error",
|
|
@@ -461,7 +479,10 @@ var javascript = async (options) => {
|
|
|
461
479
|
varsIgnorePattern: "^_"
|
|
462
480
|
}
|
|
463
481
|
],
|
|
464
|
-
"use-isnan": [
|
|
482
|
+
"use-isnan": [
|
|
483
|
+
"error",
|
|
484
|
+
{ enforceForIndexOf: true, enforceForSwitchCase: true }
|
|
485
|
+
],
|
|
465
486
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
466
487
|
"vars-on-top": "error",
|
|
467
488
|
"yoda": ["error", "never"],
|
|
@@ -558,10 +579,19 @@ var jsonc = async (options) => {
|
|
|
558
579
|
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
559
580
|
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
560
581
|
"jsonc/comma-style": ["error", "last"],
|
|
561
|
-
"jsonc/key-spacing": [
|
|
562
|
-
|
|
582
|
+
"jsonc/key-spacing": [
|
|
583
|
+
"error",
|
|
584
|
+
{ afterColon: true, beforeColon: false }
|
|
585
|
+
],
|
|
586
|
+
"jsonc/object-curly-newline": [
|
|
587
|
+
"error",
|
|
588
|
+
{ consistent: true, multiline: true }
|
|
589
|
+
],
|
|
563
590
|
"jsonc/object-curly-spacing": ["error", "always"],
|
|
564
|
-
"jsonc/object-property-newline": [
|
|
591
|
+
"jsonc/object-property-newline": [
|
|
592
|
+
"error",
|
|
593
|
+
{ allowMultiplePropertiesPerLine: true }
|
|
594
|
+
],
|
|
565
595
|
"jsonc/quote-props": "error",
|
|
566
596
|
"jsonc/quotes": "error",
|
|
567
597
|
...overrides
|
|
@@ -600,7 +630,10 @@ var markdown = async (options) => {
|
|
|
600
630
|
},
|
|
601
631
|
{
|
|
602
632
|
name: "eslint/markdown/rules",
|
|
603
|
-
files: [
|
|
633
|
+
files: [
|
|
634
|
+
GLOB_MARKDOWN_CODE,
|
|
635
|
+
...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
636
|
+
],
|
|
604
637
|
languageOptions: {
|
|
605
638
|
parserOptions: {
|
|
606
639
|
ecmaFeatures: {
|
|
@@ -675,7 +708,9 @@ async function node() {
|
|
|
675
708
|
|
|
676
709
|
// src/configs/perfectionist.ts
|
|
677
710
|
async function perfectionist() {
|
|
678
|
-
const pluginPerfectionist = await interopDefault(
|
|
711
|
+
const pluginPerfectionist = await interopDefault(
|
|
712
|
+
import("eslint-plugin-perfectionist")
|
|
713
|
+
);
|
|
679
714
|
return [
|
|
680
715
|
{
|
|
681
716
|
name: "eslint/perfectionist/setup",
|
|
@@ -683,7 +718,10 @@ async function perfectionist() {
|
|
|
683
718
|
perfectionist: pluginPerfectionist
|
|
684
719
|
},
|
|
685
720
|
rules: {
|
|
686
|
-
"perfectionist/sort-exports": [
|
|
721
|
+
"perfectionist/sort-exports": [
|
|
722
|
+
"error",
|
|
723
|
+
{ order: "asc", type: "natural" }
|
|
724
|
+
],
|
|
687
725
|
"perfectionist/sort-imports": [
|
|
688
726
|
"error",
|
|
689
727
|
{
|
|
@@ -712,8 +750,14 @@ async function perfectionist() {
|
|
|
712
750
|
type: "natural"
|
|
713
751
|
}
|
|
714
752
|
],
|
|
715
|
-
"perfectionist/sort-named-exports": [
|
|
716
|
-
|
|
753
|
+
"perfectionist/sort-named-exports": [
|
|
754
|
+
"error",
|
|
755
|
+
{ order: "asc", type: "natural" }
|
|
756
|
+
],
|
|
757
|
+
"perfectionist/sort-named-imports": [
|
|
758
|
+
"error",
|
|
759
|
+
{ order: "asc", type: "natural" }
|
|
760
|
+
]
|
|
717
761
|
}
|
|
718
762
|
}
|
|
719
763
|
];
|
|
@@ -727,7 +771,6 @@ var prettier = async ({ tailwindcss: tailwindcss2, ...options }) => {
|
|
|
727
771
|
interopDefault(import("eslint-config-prettier"))
|
|
728
772
|
]);
|
|
729
773
|
const defaultPrettierOptions = {
|
|
730
|
-
printWidth: 100,
|
|
731
774
|
quoteProps: "consistent"
|
|
732
775
|
};
|
|
733
776
|
const plainFileRules = [
|
|
@@ -911,7 +954,14 @@ async function sortTsconfig() {
|
|
|
911
954
|
"jsonc/sort-keys": [
|
|
912
955
|
"error",
|
|
913
956
|
{
|
|
914
|
-
order: [
|
|
957
|
+
order: [
|
|
958
|
+
"extends",
|
|
959
|
+
"compilerOptions",
|
|
960
|
+
"references",
|
|
961
|
+
"files",
|
|
962
|
+
"include",
|
|
963
|
+
"exclude"
|
|
964
|
+
],
|
|
915
965
|
pathPattern: "^$"
|
|
916
966
|
},
|
|
917
967
|
{
|
|
@@ -1048,7 +1098,10 @@ var test = async (options) => {
|
|
|
1048
1098
|
files: GLOB_TESTS,
|
|
1049
1099
|
rules: {
|
|
1050
1100
|
"node/prefer-global/process": "off",
|
|
1051
|
-
"test/consistent-test-it": [
|
|
1101
|
+
"test/consistent-test-it": [
|
|
1102
|
+
"error",
|
|
1103
|
+
{ fn: "it", withinDescribe: "it" }
|
|
1104
|
+
],
|
|
1052
1105
|
"test/no-identical-title": "error",
|
|
1053
1106
|
"test/no-import-node-test": "error",
|
|
1054
1107
|
"test/no-only-tests": "error",
|
|
@@ -1189,7 +1242,10 @@ var typescript = async (options) => {
|
|
|
1189
1242
|
"error",
|
|
1190
1243
|
{ "ts-expect-error": "allow-with-description" }
|
|
1191
1244
|
],
|
|
1192
|
-
"@typescript-eslint/consistent-type-definitions": [
|
|
1245
|
+
"@typescript-eslint/consistent-type-definitions": [
|
|
1246
|
+
"error",
|
|
1247
|
+
"interface"
|
|
1248
|
+
],
|
|
1193
1249
|
"@typescript-eslint/consistent-type-imports": [
|
|
1194
1250
|
"error",
|
|
1195
1251
|
{
|
|
@@ -1202,7 +1258,10 @@ var typescript = async (options) => {
|
|
|
1202
1258
|
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
1203
1259
|
"@typescript-eslint/no-dupe-class-members": "error",
|
|
1204
1260
|
"@typescript-eslint/no-dynamic-delete": "off",
|
|
1205
|
-
"@typescript-eslint/no-empty-object-type": [
|
|
1261
|
+
"@typescript-eslint/no-empty-object-type": [
|
|
1262
|
+
"error",
|
|
1263
|
+
{ allowInterfaces: "always" }
|
|
1264
|
+
],
|
|
1206
1265
|
"@typescript-eslint/no-explicit-any": "off",
|
|
1207
1266
|
"@typescript-eslint/no-extraneous-class": "off",
|
|
1208
1267
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
@@ -1265,7 +1324,10 @@ async function unicorn() {
|
|
|
1265
1324
|
// Pass error message when throwing errors
|
|
1266
1325
|
"unicorn/error-message": "error",
|
|
1267
1326
|
// Uppercase regex escapes
|
|
1268
|
-
"unicorn/consistent-function-scoping": [
|
|
1327
|
+
"unicorn/consistent-function-scoping": [
|
|
1328
|
+
"error",
|
|
1329
|
+
{ checkArrowFunctions: false }
|
|
1330
|
+
],
|
|
1269
1331
|
// Array.isArray instead of instanceof
|
|
1270
1332
|
"unicorn/no-instanceof-array": "error",
|
|
1271
1333
|
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
@@ -1318,7 +1380,9 @@ var vue = async (options = {}) => {
|
|
|
1318
1380
|
jsx: true
|
|
1319
1381
|
},
|
|
1320
1382
|
extraFileExtensions: [".vue"],
|
|
1321
|
-
parser: isTypescript ? await interopDefault(
|
|
1383
|
+
parser: isTypescript ? await interopDefault(
|
|
1384
|
+
import("@typescript-eslint/parser")
|
|
1385
|
+
) : null,
|
|
1322
1386
|
sourceType: "module"
|
|
1323
1387
|
}
|
|
1324
1388
|
},
|
|
@@ -1347,7 +1411,12 @@ var vue = async (options = {}) => {
|
|
|
1347
1411
|
"vue/define-macros-order": [
|
|
1348
1412
|
"error",
|
|
1349
1413
|
{
|
|
1350
|
-
order: [
|
|
1414
|
+
order: [
|
|
1415
|
+
"defineOptions",
|
|
1416
|
+
"defineProps",
|
|
1417
|
+
"defineEmits",
|
|
1418
|
+
"defineSlots"
|
|
1419
|
+
]
|
|
1351
1420
|
}
|
|
1352
1421
|
],
|
|
1353
1422
|
"vue/dot-location": ["error", "property"],
|
|
@@ -1412,7 +1481,10 @@ var vue = async (options = {}) => {
|
|
|
1412
1481
|
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1413
1482
|
"vue/object-curly-newline": "off",
|
|
1414
1483
|
"vue/object-curly-spacing": ["error", "always"],
|
|
1415
|
-
"vue/object-property-newline": [
|
|
1484
|
+
"vue/object-property-newline": [
|
|
1485
|
+
"error",
|
|
1486
|
+
{ allowMultiplePropertiesPerLine: true }
|
|
1487
|
+
],
|
|
1416
1488
|
"vue/operator-linebreak": ["error", "before"],
|
|
1417
1489
|
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1418
1490
|
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
@@ -1493,7 +1565,11 @@ async function next() {
|
|
|
1493
1565
|
"react-refresh/only-export-components": [
|
|
1494
1566
|
"warn",
|
|
1495
1567
|
{
|
|
1496
|
-
allowExportNames: [
|
|
1568
|
+
allowExportNames: [
|
|
1569
|
+
"metadata",
|
|
1570
|
+
"generateMetadata",
|
|
1571
|
+
"generateStaticParams"
|
|
1572
|
+
]
|
|
1497
1573
|
}
|
|
1498
1574
|
]
|
|
1499
1575
|
}
|
|
@@ -1501,15 +1577,21 @@ async function next() {
|
|
|
1501
1577
|
];
|
|
1502
1578
|
}
|
|
1503
1579
|
var react = async (options) => {
|
|
1504
|
-
const {
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1580
|
+
const {
|
|
1581
|
+
next: enableNext = false,
|
|
1582
|
+
compiler: enableCompiler = false,
|
|
1583
|
+
overrides = {}
|
|
1584
|
+
} = options;
|
|
1585
|
+
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
|
|
1586
|
+
[
|
|
1587
|
+
// @ts-expect-error missing types
|
|
1588
|
+
interopDefault(import("eslint-plugin-react")),
|
|
1589
|
+
// @ts-expect-error missing types
|
|
1590
|
+
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1591
|
+
// @ts-expect-error missing types
|
|
1592
|
+
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1593
|
+
]
|
|
1594
|
+
);
|
|
1513
1595
|
const _react = [
|
|
1514
1596
|
{
|
|
1515
1597
|
name: "eslint/react/setup",
|
|
@@ -1634,7 +1716,11 @@ function defineConfig(options = {}) {
|
|
|
1634
1716
|
configs.push(react(getConfigOption(enableReact)));
|
|
1635
1717
|
}
|
|
1636
1718
|
if (options.jsonc ?? true) {
|
|
1637
|
-
configs.push(
|
|
1719
|
+
configs.push(
|
|
1720
|
+
jsonc(getConfigOption(options.jsonc)),
|
|
1721
|
+
sortPackageJson(),
|
|
1722
|
+
sortTsconfig()
|
|
1723
|
+
);
|
|
1638
1724
|
}
|
|
1639
1725
|
if (options.yml ?? true) {
|
|
1640
1726
|
configs.push(yml(getConfigOption(options.yml)));
|
package/dist/index.js
CHANGED
|
@@ -165,7 +165,10 @@ async function imports() {
|
|
|
165
165
|
"import/no-named-default": "error",
|
|
166
166
|
"import/no-self-import": "error",
|
|
167
167
|
"import/no-webpack-loader-syntax": "error",
|
|
168
|
-
"import/newline-after-import": [
|
|
168
|
+
"import/newline-after-import": [
|
|
169
|
+
"error",
|
|
170
|
+
{ considerComments: true, count: 1 }
|
|
171
|
+
],
|
|
169
172
|
"import/consistent-type-specifier-style": ["error", "prefer-top-level"]
|
|
170
173
|
}
|
|
171
174
|
}
|
|
@@ -176,7 +179,9 @@ async function imports() {
|
|
|
176
179
|
import globals from "globals";
|
|
177
180
|
var javascript = async (options) => {
|
|
178
181
|
const { overrides = {} } = options;
|
|
179
|
-
const pluginUnusedImports = await interopDefault(
|
|
182
|
+
const pluginUnusedImports = await interopDefault(
|
|
183
|
+
import("eslint-plugin-unused-imports")
|
|
184
|
+
);
|
|
180
185
|
return [
|
|
181
186
|
{
|
|
182
187
|
name: "eslint/javascript/rules",
|
|
@@ -206,14 +211,20 @@ var javascript = async (options) => {
|
|
|
206
211
|
"unused-imports": pluginUnusedImports
|
|
207
212
|
},
|
|
208
213
|
rules: {
|
|
209
|
-
"accessor-pairs": [
|
|
214
|
+
"accessor-pairs": [
|
|
215
|
+
"error",
|
|
216
|
+
{ enforceForClassMembers: true, setWithoutGet: true }
|
|
217
|
+
],
|
|
210
218
|
"array-callback-return": "error",
|
|
211
219
|
"block-scoped-var": "error",
|
|
212
220
|
"constructor-super": "error",
|
|
213
221
|
"default-case-last": "error",
|
|
214
222
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
215
223
|
"eqeqeq": ["error", "smart"],
|
|
216
|
-
"new-cap": [
|
|
224
|
+
"new-cap": [
|
|
225
|
+
"error",
|
|
226
|
+
{ capIsNew: false, newIsCap: true, properties: true }
|
|
227
|
+
],
|
|
217
228
|
"no-alert": "error",
|
|
218
229
|
"no-array-constructor": "error",
|
|
219
230
|
"no-async-promise-executor": "error",
|
|
@@ -292,7 +303,11 @@ var javascript = async (options) => {
|
|
|
292
303
|
property: "__lookupSetter__"
|
|
293
304
|
}
|
|
294
305
|
],
|
|
295
|
-
"no-restricted-syntax": [
|
|
306
|
+
"no-restricted-syntax": [
|
|
307
|
+
"error",
|
|
308
|
+
"TSEnumDeclaration[const=true]",
|
|
309
|
+
"TSExportAssignment"
|
|
310
|
+
],
|
|
296
311
|
"no-self-assign": ["error", { props: true }],
|
|
297
312
|
"no-self-compare": "error",
|
|
298
313
|
"no-sequences": "error",
|
|
@@ -327,7 +342,10 @@ var javascript = async (options) => {
|
|
|
327
342
|
vars: "all"
|
|
328
343
|
}
|
|
329
344
|
],
|
|
330
|
-
"no-use-before-define": [
|
|
345
|
+
"no-use-before-define": [
|
|
346
|
+
"error",
|
|
347
|
+
{ classes: false, functions: false, variables: true }
|
|
348
|
+
],
|
|
331
349
|
"no-useless-backreference": "error",
|
|
332
350
|
"no-useless-call": "error",
|
|
333
351
|
"no-useless-catch": "error",
|
|
@@ -378,7 +396,10 @@ var javascript = async (options) => {
|
|
|
378
396
|
varsIgnorePattern: "^_"
|
|
379
397
|
}
|
|
380
398
|
],
|
|
381
|
-
"use-isnan": [
|
|
399
|
+
"use-isnan": [
|
|
400
|
+
"error",
|
|
401
|
+
{ enforceForIndexOf: true, enforceForSwitchCase: true }
|
|
402
|
+
],
|
|
382
403
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
383
404
|
"vars-on-top": "error",
|
|
384
405
|
"yoda": ["error", "never"],
|
|
@@ -475,10 +496,19 @@ var jsonc = async (options) => {
|
|
|
475
496
|
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
476
497
|
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
477
498
|
"jsonc/comma-style": ["error", "last"],
|
|
478
|
-
"jsonc/key-spacing": [
|
|
479
|
-
|
|
499
|
+
"jsonc/key-spacing": [
|
|
500
|
+
"error",
|
|
501
|
+
{ afterColon: true, beforeColon: false }
|
|
502
|
+
],
|
|
503
|
+
"jsonc/object-curly-newline": [
|
|
504
|
+
"error",
|
|
505
|
+
{ consistent: true, multiline: true }
|
|
506
|
+
],
|
|
480
507
|
"jsonc/object-curly-spacing": ["error", "always"],
|
|
481
|
-
"jsonc/object-property-newline": [
|
|
508
|
+
"jsonc/object-property-newline": [
|
|
509
|
+
"error",
|
|
510
|
+
{ allowMultiplePropertiesPerLine: true }
|
|
511
|
+
],
|
|
482
512
|
"jsonc/quote-props": "error",
|
|
483
513
|
"jsonc/quotes": "error",
|
|
484
514
|
...overrides
|
|
@@ -517,7 +547,10 @@ var markdown = async (options) => {
|
|
|
517
547
|
},
|
|
518
548
|
{
|
|
519
549
|
name: "eslint/markdown/rules",
|
|
520
|
-
files: [
|
|
550
|
+
files: [
|
|
551
|
+
GLOB_MARKDOWN_CODE,
|
|
552
|
+
...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
553
|
+
],
|
|
521
554
|
languageOptions: {
|
|
522
555
|
parserOptions: {
|
|
523
556
|
ecmaFeatures: {
|
|
@@ -592,7 +625,9 @@ async function node() {
|
|
|
592
625
|
|
|
593
626
|
// src/configs/perfectionist.ts
|
|
594
627
|
async function perfectionist() {
|
|
595
|
-
const pluginPerfectionist = await interopDefault(
|
|
628
|
+
const pluginPerfectionist = await interopDefault(
|
|
629
|
+
import("eslint-plugin-perfectionist")
|
|
630
|
+
);
|
|
596
631
|
return [
|
|
597
632
|
{
|
|
598
633
|
name: "eslint/perfectionist/setup",
|
|
@@ -600,7 +635,10 @@ async function perfectionist() {
|
|
|
600
635
|
perfectionist: pluginPerfectionist
|
|
601
636
|
},
|
|
602
637
|
rules: {
|
|
603
|
-
"perfectionist/sort-exports": [
|
|
638
|
+
"perfectionist/sort-exports": [
|
|
639
|
+
"error",
|
|
640
|
+
{ order: "asc", type: "natural" }
|
|
641
|
+
],
|
|
604
642
|
"perfectionist/sort-imports": [
|
|
605
643
|
"error",
|
|
606
644
|
{
|
|
@@ -629,8 +667,14 @@ async function perfectionist() {
|
|
|
629
667
|
type: "natural"
|
|
630
668
|
}
|
|
631
669
|
],
|
|
632
|
-
"perfectionist/sort-named-exports": [
|
|
633
|
-
|
|
670
|
+
"perfectionist/sort-named-exports": [
|
|
671
|
+
"error",
|
|
672
|
+
{ order: "asc", type: "natural" }
|
|
673
|
+
],
|
|
674
|
+
"perfectionist/sort-named-imports": [
|
|
675
|
+
"error",
|
|
676
|
+
{ order: "asc", type: "natural" }
|
|
677
|
+
]
|
|
634
678
|
}
|
|
635
679
|
}
|
|
636
680
|
];
|
|
@@ -644,7 +688,6 @@ var prettier = async ({ tailwindcss: tailwindcss2, ...options }) => {
|
|
|
644
688
|
interopDefault(import("eslint-config-prettier"))
|
|
645
689
|
]);
|
|
646
690
|
const defaultPrettierOptions = {
|
|
647
|
-
printWidth: 100,
|
|
648
691
|
quoteProps: "consistent"
|
|
649
692
|
};
|
|
650
693
|
const plainFileRules = [
|
|
@@ -828,7 +871,14 @@ async function sortTsconfig() {
|
|
|
828
871
|
"jsonc/sort-keys": [
|
|
829
872
|
"error",
|
|
830
873
|
{
|
|
831
|
-
order: [
|
|
874
|
+
order: [
|
|
875
|
+
"extends",
|
|
876
|
+
"compilerOptions",
|
|
877
|
+
"references",
|
|
878
|
+
"files",
|
|
879
|
+
"include",
|
|
880
|
+
"exclude"
|
|
881
|
+
],
|
|
832
882
|
pathPattern: "^$"
|
|
833
883
|
},
|
|
834
884
|
{
|
|
@@ -965,7 +1015,10 @@ var test = async (options) => {
|
|
|
965
1015
|
files: GLOB_TESTS,
|
|
966
1016
|
rules: {
|
|
967
1017
|
"node/prefer-global/process": "off",
|
|
968
|
-
"test/consistent-test-it": [
|
|
1018
|
+
"test/consistent-test-it": [
|
|
1019
|
+
"error",
|
|
1020
|
+
{ fn: "it", withinDescribe: "it" }
|
|
1021
|
+
],
|
|
969
1022
|
"test/no-identical-title": "error",
|
|
970
1023
|
"test/no-import-node-test": "error",
|
|
971
1024
|
"test/no-only-tests": "error",
|
|
@@ -1106,7 +1159,10 @@ var typescript = async (options) => {
|
|
|
1106
1159
|
"error",
|
|
1107
1160
|
{ "ts-expect-error": "allow-with-description" }
|
|
1108
1161
|
],
|
|
1109
|
-
"@typescript-eslint/consistent-type-definitions": [
|
|
1162
|
+
"@typescript-eslint/consistent-type-definitions": [
|
|
1163
|
+
"error",
|
|
1164
|
+
"interface"
|
|
1165
|
+
],
|
|
1110
1166
|
"@typescript-eslint/consistent-type-imports": [
|
|
1111
1167
|
"error",
|
|
1112
1168
|
{
|
|
@@ -1119,7 +1175,10 @@ var typescript = async (options) => {
|
|
|
1119
1175
|
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
1120
1176
|
"@typescript-eslint/no-dupe-class-members": "error",
|
|
1121
1177
|
"@typescript-eslint/no-dynamic-delete": "off",
|
|
1122
|
-
"@typescript-eslint/no-empty-object-type": [
|
|
1178
|
+
"@typescript-eslint/no-empty-object-type": [
|
|
1179
|
+
"error",
|
|
1180
|
+
{ allowInterfaces: "always" }
|
|
1181
|
+
],
|
|
1123
1182
|
"@typescript-eslint/no-explicit-any": "off",
|
|
1124
1183
|
"@typescript-eslint/no-extraneous-class": "off",
|
|
1125
1184
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
@@ -1182,7 +1241,10 @@ async function unicorn() {
|
|
|
1182
1241
|
// Pass error message when throwing errors
|
|
1183
1242
|
"unicorn/error-message": "error",
|
|
1184
1243
|
// Uppercase regex escapes
|
|
1185
|
-
"unicorn/consistent-function-scoping": [
|
|
1244
|
+
"unicorn/consistent-function-scoping": [
|
|
1245
|
+
"error",
|
|
1246
|
+
{ checkArrowFunctions: false }
|
|
1247
|
+
],
|
|
1186
1248
|
// Array.isArray instead of instanceof
|
|
1187
1249
|
"unicorn/no-instanceof-array": "error",
|
|
1188
1250
|
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
@@ -1235,7 +1297,9 @@ var vue = async (options = {}) => {
|
|
|
1235
1297
|
jsx: true
|
|
1236
1298
|
},
|
|
1237
1299
|
extraFileExtensions: [".vue"],
|
|
1238
|
-
parser: isTypescript ? await interopDefault(
|
|
1300
|
+
parser: isTypescript ? await interopDefault(
|
|
1301
|
+
import("@typescript-eslint/parser")
|
|
1302
|
+
) : null,
|
|
1239
1303
|
sourceType: "module"
|
|
1240
1304
|
}
|
|
1241
1305
|
},
|
|
@@ -1264,7 +1328,12 @@ var vue = async (options = {}) => {
|
|
|
1264
1328
|
"vue/define-macros-order": [
|
|
1265
1329
|
"error",
|
|
1266
1330
|
{
|
|
1267
|
-
order: [
|
|
1331
|
+
order: [
|
|
1332
|
+
"defineOptions",
|
|
1333
|
+
"defineProps",
|
|
1334
|
+
"defineEmits",
|
|
1335
|
+
"defineSlots"
|
|
1336
|
+
]
|
|
1268
1337
|
}
|
|
1269
1338
|
],
|
|
1270
1339
|
"vue/dot-location": ["error", "property"],
|
|
@@ -1329,7 +1398,10 @@ var vue = async (options = {}) => {
|
|
|
1329
1398
|
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1330
1399
|
"vue/object-curly-newline": "off",
|
|
1331
1400
|
"vue/object-curly-spacing": ["error", "always"],
|
|
1332
|
-
"vue/object-property-newline": [
|
|
1401
|
+
"vue/object-property-newline": [
|
|
1402
|
+
"error",
|
|
1403
|
+
{ allowMultiplePropertiesPerLine: true }
|
|
1404
|
+
],
|
|
1333
1405
|
"vue/operator-linebreak": ["error", "before"],
|
|
1334
1406
|
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1335
1407
|
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
@@ -1410,7 +1482,11 @@ async function next() {
|
|
|
1410
1482
|
"react-refresh/only-export-components": [
|
|
1411
1483
|
"warn",
|
|
1412
1484
|
{
|
|
1413
|
-
allowExportNames: [
|
|
1485
|
+
allowExportNames: [
|
|
1486
|
+
"metadata",
|
|
1487
|
+
"generateMetadata",
|
|
1488
|
+
"generateStaticParams"
|
|
1489
|
+
]
|
|
1414
1490
|
}
|
|
1415
1491
|
]
|
|
1416
1492
|
}
|
|
@@ -1418,15 +1494,21 @@ async function next() {
|
|
|
1418
1494
|
];
|
|
1419
1495
|
}
|
|
1420
1496
|
var react = async (options) => {
|
|
1421
|
-
const {
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1497
|
+
const {
|
|
1498
|
+
next: enableNext = false,
|
|
1499
|
+
compiler: enableCompiler = false,
|
|
1500
|
+
overrides = {}
|
|
1501
|
+
} = options;
|
|
1502
|
+
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
|
|
1503
|
+
[
|
|
1504
|
+
// @ts-expect-error missing types
|
|
1505
|
+
interopDefault(import("eslint-plugin-react")),
|
|
1506
|
+
// @ts-expect-error missing types
|
|
1507
|
+
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1508
|
+
// @ts-expect-error missing types
|
|
1509
|
+
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1510
|
+
]
|
|
1511
|
+
);
|
|
1430
1512
|
const _react = [
|
|
1431
1513
|
{
|
|
1432
1514
|
name: "eslint/react/setup",
|
|
@@ -1551,7 +1633,11 @@ function defineConfig(options = {}) {
|
|
|
1551
1633
|
configs.push(react(getConfigOption(enableReact)));
|
|
1552
1634
|
}
|
|
1553
1635
|
if (options.jsonc ?? true) {
|
|
1554
|
-
configs.push(
|
|
1636
|
+
configs.push(
|
|
1637
|
+
jsonc(getConfigOption(options.jsonc)),
|
|
1638
|
+
sortPackageJson(),
|
|
1639
|
+
sortTsconfig()
|
|
1640
|
+
);
|
|
1555
1641
|
}
|
|
1556
1642
|
if (options.yml ?? true) {
|
|
1557
1643
|
configs.push(yml(getConfigOption(options.yml)));
|