@luxass/eslint-config 5.3.1 → 6.0.0-beta.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.d.ts +827 -332
- package/dist/index.js +34 -17
- package/dist/lib-CANFQzGY.js +10961 -0
- package/package.json +57 -56
package/dist/index.js
CHANGED
|
@@ -127,8 +127,7 @@ const parserPlain = {
|
|
|
127
127
|
* Combine array and non-array configs into a single array.
|
|
128
128
|
*/
|
|
129
129
|
async function combine(...configs$1) {
|
|
130
|
-
|
|
131
|
-
return resolved.flat();
|
|
130
|
+
return (await Promise.all(configs$1)).flat();
|
|
132
131
|
}
|
|
133
132
|
/**
|
|
134
133
|
* Rename plugin prefixes in a rule object.
|
|
@@ -235,9 +234,7 @@ async function ensure(packages) {
|
|
|
235
234
|
if (process.env.CI || process.stdout.isTTY === false || isCwdInScope === false) return;
|
|
236
235
|
const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
|
|
237
236
|
if (nonExistingPackages.length === 0) return;
|
|
238
|
-
|
|
239
|
-
const result = await p.confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` });
|
|
240
|
-
if (result) await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
237
|
+
if (await (await import("@clack/prompts")).confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` })) await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
241
238
|
}
|
|
242
239
|
/**
|
|
243
240
|
* Resolve sub-options from a config options object.
|
|
@@ -530,10 +527,9 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
530
527
|
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
531
528
|
useTabs: indent === "tab"
|
|
532
529
|
}, options.dprintOptions || {});
|
|
533
|
-
const pluginFormat = await interop(import("eslint-plugin-format"));
|
|
534
530
|
const configs$1 = [{
|
|
535
531
|
name: "luxass/formatter/setup",
|
|
536
|
-
plugins: { format:
|
|
532
|
+
plugins: { format: await interop(import("eslint-plugin-format")) }
|
|
537
533
|
}];
|
|
538
534
|
if (options.css) configs$1.push({
|
|
539
535
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
@@ -631,7 +627,7 @@ async function javascript(options = {}) {
|
|
|
631
627
|
return [
|
|
632
628
|
{
|
|
633
629
|
languageOptions: {
|
|
634
|
-
ecmaVersion:
|
|
630
|
+
ecmaVersion: "latest",
|
|
635
631
|
globals: {
|
|
636
632
|
...globals.browser,
|
|
637
633
|
...globals.es2021,
|
|
@@ -642,7 +638,7 @@ async function javascript(options = {}) {
|
|
|
642
638
|
},
|
|
643
639
|
parserOptions: {
|
|
644
640
|
ecmaFeatures: { jsx: true },
|
|
645
|
-
ecmaVersion:
|
|
641
|
+
ecmaVersion: "latest",
|
|
646
642
|
sourceType: "module"
|
|
647
643
|
},
|
|
648
644
|
sourceType: "module"
|
|
@@ -1210,10 +1206,7 @@ async function react(options = {}) {
|
|
|
1210
1206
|
"react-dom/no-use-form-state": "error",
|
|
1211
1207
|
"react-dom/no-void-elements-with-children": "error",
|
|
1212
1208
|
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1213
|
-
|
|
1214
|
-
"react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
|
|
1215
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
1216
|
-
"react-hooks/rules-of-hooks": "error",
|
|
1209
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
1217
1210
|
"react-refresh/only-export-components": ["warn", {
|
|
1218
1211
|
allowConstantExport: isAllowConstantExport,
|
|
1219
1212
|
allowExportNames: [...isUsingNext ? [
|
|
@@ -1235,13 +1228,18 @@ async function react(options = {}) {
|
|
|
1235
1228
|
"links",
|
|
1236
1229
|
"headers",
|
|
1237
1230
|
"loader",
|
|
1238
|
-
"action"
|
|
1231
|
+
"action",
|
|
1232
|
+
"clientLoader",
|
|
1233
|
+
"clientAction",
|
|
1234
|
+
"handle",
|
|
1235
|
+
"shouldRevalidate"
|
|
1239
1236
|
] : []]
|
|
1240
1237
|
}],
|
|
1241
1238
|
"react-web-api/no-leaked-event-listener": "warn",
|
|
1242
1239
|
"react-web-api/no-leaked-interval": "warn",
|
|
1243
1240
|
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1244
1241
|
"react-web-api/no-leaked-timeout": "warn",
|
|
1242
|
+
"react/jsx-no-comment-textnodes": "warn",
|
|
1245
1243
|
"react/jsx-no-duplicate-props": "warn",
|
|
1246
1244
|
"react/jsx-uses-vars": "warn",
|
|
1247
1245
|
"react/no-access-state-in-setstate": "error",
|
|
@@ -1252,7 +1250,6 @@ async function react(options = {}) {
|
|
|
1252
1250
|
"react/no-children-only": "warn",
|
|
1253
1251
|
"react/no-children-to-array": "warn",
|
|
1254
1252
|
"react/no-clone-element": "warn",
|
|
1255
|
-
"react/no-comment-textnodes": "warn",
|
|
1256
1253
|
"react/no-component-will-mount": "error",
|
|
1257
1254
|
"react/no-component-will-receive-props": "error",
|
|
1258
1255
|
"react/no-component-will-update": "error",
|
|
@@ -1271,6 +1268,7 @@ async function react(options = {}) {
|
|
|
1271
1268
|
"react/no-set-state-in-component-did-update": "warn",
|
|
1272
1269
|
"react/no-set-state-in-component-will-update": "warn",
|
|
1273
1270
|
"react/no-string-refs": "error",
|
|
1271
|
+
"react/no-unnecessary-use-prefix": "warn",
|
|
1274
1272
|
"react/no-unsafe-component-will-mount": "warn",
|
|
1275
1273
|
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1276
1274
|
"react/no-unsafe-component-will-update": "warn",
|
|
@@ -1280,6 +1278,7 @@ async function react(options = {}) {
|
|
|
1280
1278
|
"react/no-unused-state": "warn",
|
|
1281
1279
|
"react/no-use-context": "warn",
|
|
1282
1280
|
"react/no-useless-forward-ref": "warn",
|
|
1281
|
+
"react/prefer-use-state-lazy-initialization": "warn",
|
|
1283
1282
|
...overrides
|
|
1284
1283
|
}
|
|
1285
1284
|
},
|
|
@@ -1388,7 +1387,15 @@ function sortPackageJson() {
|
|
|
1388
1387
|
},
|
|
1389
1388
|
{
|
|
1390
1389
|
order: { type: "asc" },
|
|
1391
|
-
pathPattern: "^pnpm.overrides$"
|
|
1390
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
1391
|
+
},
|
|
1392
|
+
{
|
|
1393
|
+
order: { type: "asc" },
|
|
1394
|
+
pathPattern: "^workspaces\\.catalog$"
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
order: { type: "asc" },
|
|
1398
|
+
pathPattern: "^workspaces\\.catalogs\\.[^.]+$"
|
|
1392
1399
|
},
|
|
1393
1400
|
{
|
|
1394
1401
|
order: [
|
|
@@ -1640,7 +1647,7 @@ async function toml(options = {}) {
|
|
|
1640
1647
|
//#endregion
|
|
1641
1648
|
//#region src/configs/typescript.ts
|
|
1642
1649
|
async function typescript(options = {}) {
|
|
1643
|
-
const { exts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options ?? {};
|
|
1650
|
+
const { erasableOnly = false, exts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options ?? {};
|
|
1644
1651
|
const files = options.files ?? [
|
|
1645
1652
|
GLOB_TS,
|
|
1646
1653
|
GLOB_TSX,
|
|
@@ -1773,6 +1780,16 @@ async function typescript(options = {}) {
|
|
|
1773
1780
|
...typeAwareRules,
|
|
1774
1781
|
...overridesTypeAware
|
|
1775
1782
|
}
|
|
1783
|
+
}] : [],
|
|
1784
|
+
...erasableOnly ? [{
|
|
1785
|
+
name: "luxas/typescript/erasable-syntax-only",
|
|
1786
|
+
plugins: { "erasable-syntax-only": await interop(import("./lib-CANFQzGY.js")) },
|
|
1787
|
+
rules: {
|
|
1788
|
+
"erasable-syntax-only/enums": "error",
|
|
1789
|
+
"erasable-syntax-only/import-aliases": "error",
|
|
1790
|
+
"erasable-syntax-only/namespaces": "error",
|
|
1791
|
+
"erasable-syntax-only/parameter-properties": "error"
|
|
1792
|
+
}
|
|
1776
1793
|
}] : []
|
|
1777
1794
|
];
|
|
1778
1795
|
}
|