@luxass/eslint-config 4.12.0 → 4.13.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 +109 -62
- package/dist/index.d.cts +1078 -562
- package/dist/index.d.ts +1078 -562
- package/dist/index.js +108 -61
- package/package.json +48 -48
package/dist/index.cjs
CHANGED
|
@@ -102,7 +102,7 @@ __export(src_exports, {
|
|
|
102
102
|
});
|
|
103
103
|
module.exports = __toCommonJS(src_exports);
|
|
104
104
|
|
|
105
|
-
// node_modules/.pnpm/tsup@8.
|
|
105
|
+
// node_modules/.pnpm/tsup@8.3.5_jiti@2.4.0_postcss@8.4.47_tsx@4.19.2_typescript@5.7.2_yaml@2.6.0/node_modules/tsup/assets/cjs_shims.js
|
|
106
106
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
107
107
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
108
108
|
|
|
@@ -345,6 +345,7 @@ async function astro(options = {}) {
|
|
|
345
345
|
},
|
|
346
346
|
processor: "astro/client-side-ts",
|
|
347
347
|
rules: {
|
|
348
|
+
// use recommended rules
|
|
348
349
|
"astro/missing-client-only-directive-value": "error",
|
|
349
350
|
"astro/no-conflict-set-directives": "error",
|
|
350
351
|
"astro/no-deprecated-astro-canonicalurl": "error",
|
|
@@ -353,12 +354,11 @@ async function astro(options = {}) {
|
|
|
353
354
|
"astro/no-deprecated-getentrybyslug": "error",
|
|
354
355
|
"astro/no-set-html-directive": "off",
|
|
355
356
|
"astro/no-unused-define-vars-in-style": "error",
|
|
356
|
-
"astro/semi": "
|
|
357
|
+
"astro/semi": "off",
|
|
357
358
|
"astro/valid-compile": "error",
|
|
358
359
|
...stylistic2 ? {
|
|
359
360
|
"style/indent": "off",
|
|
360
361
|
"style/jsx-closing-tag-location": "off",
|
|
361
|
-
"style/jsx-indent": "off",
|
|
362
362
|
"style/jsx-one-expression-per-line": "off",
|
|
363
363
|
"style/no-multiple-empty-lines": "off"
|
|
364
364
|
} : {},
|
|
@@ -384,9 +384,8 @@ async function comments() {
|
|
|
384
384
|
"eslint-comments/no-duplicate-disable": "error",
|
|
385
385
|
// https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-unlimited-disable.md
|
|
386
386
|
"eslint-comments/no-unlimited-disable": "error",
|
|
387
|
-
//
|
|
388
|
-
|
|
389
|
-
"eslint-comments/no-unused-enable": "off"
|
|
387
|
+
// https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-unused-enable.md
|
|
388
|
+
"eslint-comments/no-unused-enable": "error"
|
|
390
389
|
}
|
|
391
390
|
}
|
|
392
391
|
];
|
|
@@ -396,17 +395,19 @@ async function comments() {
|
|
|
396
395
|
async function disables() {
|
|
397
396
|
return [
|
|
398
397
|
{
|
|
399
|
-
files: [
|
|
398
|
+
files: [`**/scripts/${GLOB_SRC}`],
|
|
400
399
|
name: "luxass/disables/scripts",
|
|
401
400
|
rules: {
|
|
401
|
+
"antfu/no-top-level-await": "off",
|
|
402
402
|
"no-console": "off",
|
|
403
403
|
"ts/explicit-function-return-type": "off"
|
|
404
404
|
}
|
|
405
405
|
},
|
|
406
406
|
{
|
|
407
|
-
files: [
|
|
407
|
+
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
408
408
|
name: "luxass/disables/cli",
|
|
409
409
|
rules: {
|
|
410
|
+
"antfu/no-top-level-await": "off",
|
|
410
411
|
"no-console": "off"
|
|
411
412
|
}
|
|
412
413
|
},
|
|
@@ -429,17 +430,27 @@ async function disables() {
|
|
|
429
430
|
}
|
|
430
431
|
},
|
|
431
432
|
{
|
|
432
|
-
files: ["**/*.
|
|
433
|
-
name: "luxass/disables/
|
|
433
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
434
|
+
name: "luxass/disables/cjs",
|
|
434
435
|
rules: {
|
|
435
|
-
"no-
|
|
436
|
+
"ts/no-require-imports": "off"
|
|
436
437
|
}
|
|
437
438
|
},
|
|
438
439
|
{
|
|
439
|
-
|
|
440
|
-
|
|
440
|
+
name: "luxass/disables/github-actions",
|
|
441
|
+
files: ["**/.github/workflows/*.{yml,yaml}"],
|
|
441
442
|
rules: {
|
|
442
|
-
|
|
443
|
+
// GitHub Actions supports empty values to enable features
|
|
444
|
+
"yaml/no-empty-mapping-value": "off"
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
|
|
449
|
+
name: "luxass/disables/config-files",
|
|
450
|
+
rules: {
|
|
451
|
+
"antfu/no-top-level-await": "off",
|
|
452
|
+
"no-console": "off",
|
|
453
|
+
"ts/explicit-function-return-type": "off"
|
|
443
454
|
}
|
|
444
455
|
}
|
|
445
456
|
];
|
|
@@ -495,6 +506,16 @@ async function stylistic(options = {}) {
|
|
|
495
506
|
}
|
|
496
507
|
|
|
497
508
|
// src/configs/formatters.ts
|
|
509
|
+
function mergePrettierOptions(options, overrides = {}) {
|
|
510
|
+
return {
|
|
511
|
+
...options,
|
|
512
|
+
...overrides,
|
|
513
|
+
plugins: [
|
|
514
|
+
...overrides.plugins || [],
|
|
515
|
+
...options.plugins || []
|
|
516
|
+
]
|
|
517
|
+
};
|
|
518
|
+
}
|
|
498
519
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
499
520
|
if (options === true) {
|
|
500
521
|
options = {
|
|
@@ -557,10 +578,9 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
557
578
|
rules: {
|
|
558
579
|
"format/prettier": [
|
|
559
580
|
"error",
|
|
560
|
-
{
|
|
561
|
-
...prettierOptions,
|
|
581
|
+
mergePrettierOptions(prettierOptions, {
|
|
562
582
|
parser: "css"
|
|
563
|
-
}
|
|
583
|
+
})
|
|
564
584
|
]
|
|
565
585
|
}
|
|
566
586
|
},
|
|
@@ -573,10 +593,9 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
573
593
|
rules: {
|
|
574
594
|
"format/prettier": [
|
|
575
595
|
"error",
|
|
576
|
-
{
|
|
577
|
-
...prettierOptions,
|
|
596
|
+
mergePrettierOptions(prettierOptions, {
|
|
578
597
|
parser: "scss"
|
|
579
|
-
}
|
|
598
|
+
})
|
|
580
599
|
]
|
|
581
600
|
}
|
|
582
601
|
},
|
|
@@ -589,10 +608,9 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
589
608
|
rules: {
|
|
590
609
|
"format/prettier": [
|
|
591
610
|
"error",
|
|
592
|
-
{
|
|
593
|
-
...prettierOptions,
|
|
611
|
+
mergePrettierOptions(prettierOptions, {
|
|
594
612
|
parser: "less"
|
|
595
|
-
}
|
|
613
|
+
})
|
|
596
614
|
]
|
|
597
615
|
}
|
|
598
616
|
}
|
|
@@ -608,10 +626,9 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
608
626
|
rules: {
|
|
609
627
|
"format/prettier": [
|
|
610
628
|
"error",
|
|
611
|
-
{
|
|
612
|
-
...prettierOptions,
|
|
629
|
+
mergePrettierOptions(prettierOptions, {
|
|
613
630
|
parser: "html"
|
|
614
|
-
}
|
|
631
|
+
})
|
|
615
632
|
]
|
|
616
633
|
}
|
|
617
634
|
});
|
|
@@ -627,11 +644,10 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
627
644
|
rules: {
|
|
628
645
|
[`format/${formater}`]: [
|
|
629
646
|
"error",
|
|
630
|
-
formater === "prettier" ? {
|
|
631
|
-
...prettierOptions,
|
|
647
|
+
formater === "prettier" ? mergePrettierOptions(prettierOptions, {
|
|
632
648
|
embeddedLanguageFormatting: "off",
|
|
633
649
|
parser: "markdown"
|
|
634
|
-
} : {
|
|
650
|
+
}) : {
|
|
635
651
|
...dprintOptions,
|
|
636
652
|
language: "markdown"
|
|
637
653
|
}
|
|
@@ -649,13 +665,12 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
649
665
|
rules: {
|
|
650
666
|
"format/prettier": [
|
|
651
667
|
"error",
|
|
652
|
-
{
|
|
653
|
-
...prettierOptions,
|
|
668
|
+
mergePrettierOptions(prettierOptions, {
|
|
654
669
|
parser: "astro",
|
|
655
670
|
plugins: [
|
|
656
671
|
"prettier-plugin-astro"
|
|
657
672
|
]
|
|
658
|
-
}
|
|
673
|
+
})
|
|
659
674
|
]
|
|
660
675
|
}
|
|
661
676
|
});
|
|
@@ -670,10 +685,9 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
670
685
|
rules: {
|
|
671
686
|
"format/prettier": [
|
|
672
687
|
"error",
|
|
673
|
-
{
|
|
674
|
-
...prettierOptions,
|
|
688
|
+
mergePrettierOptions(prettierOptions, {
|
|
675
689
|
parser: "graphql"
|
|
676
|
-
}
|
|
690
|
+
})
|
|
677
691
|
]
|
|
678
692
|
}
|
|
679
693
|
});
|
|
@@ -772,6 +786,7 @@ async function javascript(options = {}) {
|
|
|
772
786
|
"error",
|
|
773
787
|
{ enforceForClassMembers: true, setWithoutGet: true }
|
|
774
788
|
],
|
|
789
|
+
"antfu/no-top-level-await": "error",
|
|
775
790
|
"array-callback-return": "error",
|
|
776
791
|
"block-scoped-var": "error",
|
|
777
792
|
"constructor-super": "error",
|
|
@@ -1168,6 +1183,7 @@ async function markdown(options = {}) {
|
|
|
1168
1183
|
}
|
|
1169
1184
|
},
|
|
1170
1185
|
rules: {
|
|
1186
|
+
"antfu/no-top-level-await": "off",
|
|
1171
1187
|
"import/newline-after-import": "off",
|
|
1172
1188
|
"no-alert": "off",
|
|
1173
1189
|
"no-console": "off",
|
|
@@ -1182,6 +1198,7 @@ async function markdown(options = {}) {
|
|
|
1182
1198
|
"style/comma-dangle": "off",
|
|
1183
1199
|
"style/eol-last": "off",
|
|
1184
1200
|
"ts/consistent-type-imports": "off",
|
|
1201
|
+
"ts/explicit-function-return-type": "off",
|
|
1185
1202
|
"ts/no-namespace": "off",
|
|
1186
1203
|
"ts/no-redeclare": "off",
|
|
1187
1204
|
"ts/no-require-imports": "off",
|
|
@@ -1234,12 +1251,12 @@ async function perfectionist() {
|
|
|
1234
1251
|
"perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
|
|
1235
1252
|
"perfectionist/sort-imports": ["error", {
|
|
1236
1253
|
groups: [
|
|
1254
|
+
"type",
|
|
1255
|
+
["parent-type", "sibling-type", "index-type"],
|
|
1237
1256
|
"builtin",
|
|
1238
1257
|
"external",
|
|
1239
|
-
"type",
|
|
1240
1258
|
["internal", "internal-type"],
|
|
1241
1259
|
["parent", "sibling", "index"],
|
|
1242
|
-
["parent-type", "sibling-type", "index-type"],
|
|
1243
1260
|
"side-effect",
|
|
1244
1261
|
"object",
|
|
1245
1262
|
"unknown"
|
|
@@ -1266,34 +1283,41 @@ var RemixPackages = [
|
|
|
1266
1283
|
"@remix-run/serve",
|
|
1267
1284
|
"@remix-run/dev"
|
|
1268
1285
|
];
|
|
1286
|
+
var NextJsPackages = [
|
|
1287
|
+
"next"
|
|
1288
|
+
];
|
|
1269
1289
|
async function react(options = {}) {
|
|
1270
1290
|
const {
|
|
1271
1291
|
files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
|
|
1272
|
-
overrides = {}
|
|
1292
|
+
overrides = {},
|
|
1293
|
+
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
|
1294
|
+
ignoresTypeAware = [
|
|
1295
|
+
`${GLOB_MARKDOWN}/**`,
|
|
1296
|
+
GLOB_ASTRO_TS
|
|
1297
|
+
],
|
|
1298
|
+
tsconfigPath
|
|
1273
1299
|
} = options;
|
|
1274
1300
|
await ensure([
|
|
1275
1301
|
"@eslint-react/eslint-plugin",
|
|
1276
1302
|
"eslint-plugin-react-hooks",
|
|
1277
1303
|
"eslint-plugin-react-refresh"
|
|
1278
1304
|
]);
|
|
1279
|
-
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1280
1305
|
const isTypeAware = !!tsconfigPath;
|
|
1306
|
+
const typeAwareRules = {
|
|
1307
|
+
"react/no-leaked-conditional-rendering": "warn"
|
|
1308
|
+
};
|
|
1281
1309
|
const [
|
|
1282
1310
|
pluginReact,
|
|
1283
1311
|
pluginReactHooks,
|
|
1284
|
-
pluginReactRefresh
|
|
1285
|
-
parserTs
|
|
1312
|
+
pluginReactRefresh
|
|
1286
1313
|
] = await Promise.all([
|
|
1287
1314
|
interop(import("@eslint-react/eslint-plugin")),
|
|
1288
1315
|
interop(import("eslint-plugin-react-hooks")),
|
|
1289
|
-
interop(import("eslint-plugin-react-refresh"))
|
|
1290
|
-
interop(import("@typescript-eslint/parser"))
|
|
1316
|
+
interop(import("eslint-plugin-react-refresh"))
|
|
1291
1317
|
]);
|
|
1292
|
-
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1293
|
-
(i) => (0, import_local_pkg2.isPackageExists)(i)
|
|
1294
|
-
);
|
|
1318
|
+
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => (0, import_local_pkg2.isPackageExists)(i));
|
|
1295
1319
|
const isUsingRemix = RemixPackages.some((i) => (0, import_local_pkg2.isPackageExists)(i));
|
|
1296
|
-
const isUsingNext = (0, import_local_pkg2.isPackageExists)(
|
|
1320
|
+
const isUsingNext = NextJsPackages.some((i) => (0, import_local_pkg2.isPackageExists)(i));
|
|
1297
1321
|
const plugins = pluginReact.configs.all.plugins;
|
|
1298
1322
|
return [
|
|
1299
1323
|
{
|
|
@@ -1311,12 +1335,10 @@ async function react(options = {}) {
|
|
|
1311
1335
|
name: "luxass/react/rules",
|
|
1312
1336
|
files,
|
|
1313
1337
|
languageOptions: {
|
|
1314
|
-
parser: parserTs,
|
|
1315
1338
|
parserOptions: {
|
|
1316
1339
|
ecmaFeatures: {
|
|
1317
1340
|
jsx: true
|
|
1318
|
-
}
|
|
1319
|
-
...isTypeAware ? { project: tsconfigPath } : {}
|
|
1341
|
+
}
|
|
1320
1342
|
},
|
|
1321
1343
|
sourceType: "module"
|
|
1322
1344
|
},
|
|
@@ -1343,6 +1365,13 @@ async function react(options = {}) {
|
|
|
1343
1365
|
allowConstantExport: isAllowConstantExport,
|
|
1344
1366
|
allowExportNames: [
|
|
1345
1367
|
...isUsingNext ? [
|
|
1368
|
+
"dynamic",
|
|
1369
|
+
"dynamicParams",
|
|
1370
|
+
"revalidate",
|
|
1371
|
+
"fetchCache",
|
|
1372
|
+
"runtime",
|
|
1373
|
+
"preferredRegion",
|
|
1374
|
+
"maxDuration",
|
|
1346
1375
|
"config",
|
|
1347
1376
|
"runtime",
|
|
1348
1377
|
"generateStaticParams",
|
|
@@ -1398,13 +1427,18 @@ async function react(options = {}) {
|
|
|
1398
1427
|
"react/prefer-destructuring-assignment": "warn",
|
|
1399
1428
|
"react/prefer-shorthand-boolean": "warn",
|
|
1400
1429
|
"react/prefer-shorthand-fragment": "warn",
|
|
1401
|
-
...isTypeAware ? {
|
|
1402
|
-
"react/no-leaked-conditional-rendering": "warn"
|
|
1403
|
-
} : {},
|
|
1404
1430
|
// overrides
|
|
1405
1431
|
...overrides
|
|
1406
1432
|
}
|
|
1407
|
-
}
|
|
1433
|
+
},
|
|
1434
|
+
...isTypeAware ? [{
|
|
1435
|
+
files: filesTypeAware,
|
|
1436
|
+
ignores: ignoresTypeAware,
|
|
1437
|
+
name: "antfu/react/type-aware-rules",
|
|
1438
|
+
rules: {
|
|
1439
|
+
...typeAwareRules
|
|
1440
|
+
}
|
|
1441
|
+
}] : []
|
|
1408
1442
|
];
|
|
1409
1443
|
}
|
|
1410
1444
|
|
|
@@ -1743,7 +1777,6 @@ async function test(options = {}) {
|
|
|
1743
1777
|
name: "luxass/test/rules",
|
|
1744
1778
|
files,
|
|
1745
1779
|
rules: {
|
|
1746
|
-
"node/prefer-global/process": "off",
|
|
1747
1780
|
"test/consistent-test-it": [
|
|
1748
1781
|
"error",
|
|
1749
1782
|
{ fn: "it", withinDescribe: "it" }
|
|
@@ -1753,7 +1786,13 @@ async function test(options = {}) {
|
|
|
1753
1786
|
"test/no-focused-tests": isInEditor ? "off" : ["error", { fixable: true }],
|
|
1754
1787
|
"test/prefer-hooks-in-order": "error",
|
|
1755
1788
|
"test/prefer-lowercase-title": "error",
|
|
1756
|
-
|
|
1789
|
+
// Disables
|
|
1790
|
+
...{
|
|
1791
|
+
"antfu/no-top-level-await": "off",
|
|
1792
|
+
"no-unused-expressions": "off",
|
|
1793
|
+
"node/prefer-global/process": "off",
|
|
1794
|
+
"ts/explicit-function-return-type": "off"
|
|
1795
|
+
},
|
|
1757
1796
|
...overrides
|
|
1758
1797
|
}
|
|
1759
1798
|
}
|
|
@@ -1827,6 +1866,7 @@ async function typescript(options = {}) {
|
|
|
1827
1866
|
exts = [],
|
|
1828
1867
|
overrides = {},
|
|
1829
1868
|
parserOptions = {},
|
|
1869
|
+
overridesTypeAware = {},
|
|
1830
1870
|
type = "app"
|
|
1831
1871
|
} = options ?? {};
|
|
1832
1872
|
const files = options.files ?? [
|
|
@@ -1951,8 +1991,13 @@ async function typescript(options = {}) {
|
|
|
1951
1991
|
"ts/no-invalid-this": "error",
|
|
1952
1992
|
"ts/no-invalid-void-type": "off",
|
|
1953
1993
|
"ts/no-non-null-assertion": "off",
|
|
1954
|
-
"ts/no-redeclare": "error",
|
|
1994
|
+
"ts/no-redeclare": ["error", { builtinGlobals: false }],
|
|
1955
1995
|
"ts/no-require-imports": "error",
|
|
1996
|
+
"ts/no-unused-expressions": ["error", {
|
|
1997
|
+
allowShortCircuit: true,
|
|
1998
|
+
allowTaggedTemplates: true,
|
|
1999
|
+
allowTernary: true
|
|
2000
|
+
}],
|
|
1956
2001
|
"ts/no-unused-vars": "off",
|
|
1957
2002
|
"ts/no-use-before-define": [
|
|
1958
2003
|
"error",
|
|
@@ -1976,7 +2021,10 @@ async function typescript(options = {}) {
|
|
|
1976
2021
|
files: filesTypeAware,
|
|
1977
2022
|
ignores: ignoresTypeAware,
|
|
1978
2023
|
name: "luxass/typescript/rules-type-aware",
|
|
1979
|
-
rules:
|
|
2024
|
+
rules: {
|
|
2025
|
+
...typeAwareRules,
|
|
2026
|
+
...overridesTypeAware
|
|
2027
|
+
}
|
|
1980
2028
|
}] : []
|
|
1981
2029
|
];
|
|
1982
2030
|
}
|
|
@@ -2160,7 +2208,9 @@ async function vue(options = {}) {
|
|
|
2160
2208
|
...pluginVue.configs["vue3-essential"].rules,
|
|
2161
2209
|
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
2162
2210
|
...pluginVue.configs["vue3-recommended"].rules,
|
|
2211
|
+
"antfu/no-top-level-await": "off",
|
|
2163
2212
|
"node/prefer-global/process": "off",
|
|
2213
|
+
"ts/explicit-function-return-type": "off",
|
|
2164
2214
|
"vue/block-order": [
|
|
2165
2215
|
"error",
|
|
2166
2216
|
{
|
|
@@ -2321,10 +2371,7 @@ async function yaml(options = {}) {
|
|
|
2321
2371
|
"yaml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
2322
2372
|
"yaml/key-spacing": "error",
|
|
2323
2373
|
"yaml/no-tab-indent": "error",
|
|
2324
|
-
"yaml/quotes": [
|
|
2325
|
-
"error",
|
|
2326
|
-
{ avoidEscape: false, prefer: quotes }
|
|
2327
|
-
],
|
|
2374
|
+
"yaml/quotes": ["error", { avoidEscape: true, prefer: quotes === "backtick" ? "single" : quotes }],
|
|
2328
2375
|
"yaml/spaced-comment": "error"
|
|
2329
2376
|
} : {},
|
|
2330
2377
|
...overrides
|