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