@luxass/eslint-config 7.0.0 → 7.1.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.d.mts +896 -1646
- package/dist/index.mjs +72 -21
- package/dist/{lib-ur-SnMJ-.mjs → lib-BgGy3QDX.mjs} +286 -261
- package/package.json +76 -61
package/dist/index.mjs
CHANGED
|
@@ -72,6 +72,8 @@ const GLOB_SVELTE = "**/*.svelte";
|
|
|
72
72
|
const GLOB_VUE = "**/*.vue";
|
|
73
73
|
const GLOB_YAML = "**/*.y?(a)ml";
|
|
74
74
|
const GLOB_TOML = "**/*.toml";
|
|
75
|
+
const GLOB_XML = "**/*.xml";
|
|
76
|
+
const GLOB_SVG = "**/*.svg";
|
|
75
77
|
const GLOB_HTML = "**/*.htm?(l)";
|
|
76
78
|
const GLOB_ASTRO = "**/*.astro";
|
|
77
79
|
const GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
@@ -530,7 +532,7 @@ async function stylistic(options = {}) {
|
|
|
530
532
|
|
|
531
533
|
//#endregion
|
|
532
534
|
//#region src/configs/formatters.ts
|
|
533
|
-
function mergePrettierOptions(options, overrides
|
|
535
|
+
function mergePrettierOptions(options, overrides) {
|
|
534
536
|
return {
|
|
535
537
|
...options,
|
|
536
538
|
...overrides,
|
|
@@ -538,14 +540,23 @@ function mergePrettierOptions(options, overrides = {}) {
|
|
|
538
540
|
};
|
|
539
541
|
}
|
|
540
542
|
async function formatters(options = {}, stylistic = {}) {
|
|
541
|
-
if (options === true)
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
543
|
+
if (options === true) {
|
|
544
|
+
const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
|
|
545
|
+
options = {
|
|
546
|
+
astro: isPackageInScope("prettier-plugin-astro"),
|
|
547
|
+
css: true,
|
|
548
|
+
graphql: true,
|
|
549
|
+
html: true,
|
|
550
|
+
markdown: true,
|
|
551
|
+
svg: isPrettierPluginXmlInScope,
|
|
552
|
+
xml: isPrettierPluginXmlInScope
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
await ensure([
|
|
556
|
+
"eslint-plugin-format",
|
|
557
|
+
options.astro ? "prettier-plugin-astro" : void 0,
|
|
558
|
+
options.xml || options.svg ? "@prettier/plugin-xml" : void 0
|
|
559
|
+
]);
|
|
549
560
|
const { indent, quotes, semi } = {
|
|
550
561
|
...StylisticConfigDefaults,
|
|
551
562
|
...stylistic
|
|
@@ -559,6 +570,12 @@ async function formatters(options = {}, stylistic = {}) {
|
|
|
559
570
|
trailingComma: "all",
|
|
560
571
|
useTabs: indent === "tab"
|
|
561
572
|
}, options.prettierOptions || {});
|
|
573
|
+
const prettierXmlOptions = {
|
|
574
|
+
xmlQuoteAttributes: "double",
|
|
575
|
+
xmlSelfClosingSpace: true,
|
|
576
|
+
xmlSortAttributesByKey: false,
|
|
577
|
+
xmlWhitespaceSensitivity: "ignore"
|
|
578
|
+
};
|
|
562
579
|
const dprintOptions = Object.assign({
|
|
563
580
|
indentWidth: typeof indent === "number" ? indent : 2,
|
|
564
581
|
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
@@ -590,6 +607,30 @@ async function formatters(options = {}, stylistic = {}) {
|
|
|
590
607
|
name: "luxass/formatter/html",
|
|
591
608
|
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
|
|
592
609
|
});
|
|
610
|
+
if (options.xml) configs.push({
|
|
611
|
+
files: [GLOB_XML],
|
|
612
|
+
languageOptions: { parser: parserPlain },
|
|
613
|
+
name: "luxass/formatter/xml",
|
|
614
|
+
rules: { "format/prettier": ["error", mergePrettierOptions({
|
|
615
|
+
...prettierXmlOptions,
|
|
616
|
+
...prettierOptions
|
|
617
|
+
}, {
|
|
618
|
+
parser: "xml",
|
|
619
|
+
plugins: ["@prettier/plugin-xml"]
|
|
620
|
+
})] }
|
|
621
|
+
});
|
|
622
|
+
if (options.svg) configs.push({
|
|
623
|
+
files: [GLOB_SVG],
|
|
624
|
+
languageOptions: { parser: parserPlain },
|
|
625
|
+
name: "luxass/formatter/svg",
|
|
626
|
+
rules: { "format/prettier": ["error", mergePrettierOptions({
|
|
627
|
+
...prettierXmlOptions,
|
|
628
|
+
...prettierOptions
|
|
629
|
+
}, {
|
|
630
|
+
parser: "xml",
|
|
631
|
+
plugins: ["@prettier/plugin-xml"]
|
|
632
|
+
})] }
|
|
633
|
+
});
|
|
593
634
|
if (options.markdown) {
|
|
594
635
|
const formatter = options.markdown === true ? "prettier" : options.markdown;
|
|
595
636
|
configs.push({
|
|
@@ -625,9 +666,13 @@ async function formatters(options = {}, stylistic = {}) {
|
|
|
625
666
|
|
|
626
667
|
//#endregion
|
|
627
668
|
//#region src/configs/ignores.ts
|
|
628
|
-
async function ignores(userIgnores = []) {
|
|
669
|
+
async function ignores(userIgnores = [], ignoreTypeScript = false) {
|
|
670
|
+
let ignores = [...GLOB_EXCLUDE];
|
|
671
|
+
if (ignoreTypeScript) ignores.push(GLOB_TS, GLOB_TSX);
|
|
672
|
+
if (typeof userIgnores === "function") ignores = userIgnores(ignores);
|
|
673
|
+
else ignores = [...ignores, ...userIgnores];
|
|
629
674
|
return [{
|
|
630
|
-
ignores
|
|
675
|
+
ignores,
|
|
631
676
|
name: "luxass/ignores"
|
|
632
677
|
}];
|
|
633
678
|
}
|
|
@@ -902,6 +947,7 @@ async function javascript(options = {}) {
|
|
|
902
947
|
async function jsdoc(options = {}) {
|
|
903
948
|
const { overrides, stylistic = true } = options;
|
|
904
949
|
return [{
|
|
950
|
+
files: [GLOB_SRC],
|
|
905
951
|
name: "luxass/jsdoc/rules",
|
|
906
952
|
plugins: { jsdoc: await interop(import("eslint-plugin-jsdoc")) },
|
|
907
953
|
rules: {
|
|
@@ -1068,6 +1114,7 @@ async function markdown(options = {}) {
|
|
|
1068
1114
|
//#region src/configs/node.ts
|
|
1069
1115
|
function node() {
|
|
1070
1116
|
return [{
|
|
1117
|
+
files: [GLOB_SRC],
|
|
1071
1118
|
name: "luxass/node",
|
|
1072
1119
|
plugins: { node: pluginNode },
|
|
1073
1120
|
rules: {
|
|
@@ -1316,6 +1363,7 @@ async function react(options = {}) {
|
|
|
1316
1363
|
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
1317
1364
|
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1318
1365
|
"react-refresh": pluginReactRefresh,
|
|
1366
|
+
"react-rsc": plugins["@eslint-react/rsc"],
|
|
1319
1367
|
"react-web-api": plugins["@eslint-react/web-api"]
|
|
1320
1368
|
}
|
|
1321
1369
|
},
|
|
@@ -1339,8 +1387,17 @@ async function react(options = {}) {
|
|
|
1339
1387
|
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
1340
1388
|
"react-dom/no-use-form-state": "error",
|
|
1341
1389
|
"react-dom/no-void-elements-with-children": "error",
|
|
1390
|
+
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1342
1391
|
"react-hooks/exhaustive-deps": "warn",
|
|
1343
1392
|
"react-hooks/rules-of-hooks": "error",
|
|
1393
|
+
"react-naming-convention/context-name": "warn",
|
|
1394
|
+
"react-naming-convention/ref-name": "warn",
|
|
1395
|
+
"react-naming-convention/use-state": "warn",
|
|
1396
|
+
"react-rsc/function-definition": "error",
|
|
1397
|
+
"react-web-api/no-leaked-event-listener": "warn",
|
|
1398
|
+
"react-web-api/no-leaked-interval": "warn",
|
|
1399
|
+
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1400
|
+
"react-web-api/no-leaked-timeout": "warn",
|
|
1344
1401
|
"react/jsx-key-before-spread": "warn",
|
|
1345
1402
|
"react/jsx-no-comment-textnodes": "warn",
|
|
1346
1403
|
"react/jsx-no-duplicate-props": "warn",
|
|
@@ -1361,9 +1418,7 @@ async function react(options = {}) {
|
|
|
1361
1418
|
"react/no-create-ref": "error",
|
|
1362
1419
|
"react/no-default-props": "error",
|
|
1363
1420
|
"react/no-direct-mutation-state": "error",
|
|
1364
|
-
"react/no-duplicate-key": "error",
|
|
1365
1421
|
"react/no-forward-ref": "warn",
|
|
1366
|
-
"react/no-implicit-key": "warn",
|
|
1367
1422
|
"react/no-missing-key": "error",
|
|
1368
1423
|
"react/no-nested-component-definitions": "error",
|
|
1369
1424
|
"react/no-nested-lazy-component-declarations": "error",
|
|
@@ -1377,6 +1432,7 @@ async function react(options = {}) {
|
|
|
1377
1432
|
"react/no-unsafe-component-will-mount": "warn",
|
|
1378
1433
|
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1379
1434
|
"react/no-unsafe-component-will-update": "warn",
|
|
1435
|
+
"react/no-unused-class-component-members": "warn",
|
|
1380
1436
|
"react/no-use-context": "warn",
|
|
1381
1437
|
"react/no-useless-forward-ref": "warn",
|
|
1382
1438
|
"react/prefer-namespace-import": "error",
|
|
@@ -1398,7 +1454,6 @@ async function react(options = {}) {
|
|
|
1398
1454
|
"react-hooks/unsupported-syntax": "warn",
|
|
1399
1455
|
"react-hooks/use-memo": "error"
|
|
1400
1456
|
} : {},
|
|
1401
|
-
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1402
1457
|
"react-refresh/only-export-components": ["error", {
|
|
1403
1458
|
allowConstantExport: isAllowConstantExport,
|
|
1404
1459
|
allowExportNames: [...isUsingNext ? [
|
|
@@ -1428,10 +1483,6 @@ async function react(options = {}) {
|
|
|
1428
1483
|
"shouldRevalidate"
|
|
1429
1484
|
] : []]
|
|
1430
1485
|
}],
|
|
1431
|
-
"react-web-api/no-leaked-event-listener": "warn",
|
|
1432
|
-
"react-web-api/no-leaked-interval": "warn",
|
|
1433
|
-
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1434
|
-
"react-web-api/no-leaked-timeout": "warn",
|
|
1435
1486
|
...overrides
|
|
1436
1487
|
}
|
|
1437
1488
|
},
|
|
@@ -1936,7 +1987,7 @@ async function typescript(options = {}) {
|
|
|
1936
1987
|
}] : [],
|
|
1937
1988
|
...erasableOnly ? [{
|
|
1938
1989
|
name: "luxas/typescript/erasable-syntax-only",
|
|
1939
|
-
plugins: { "erasable-syntax-only": await interop(import("./lib-
|
|
1990
|
+
plugins: { "erasable-syntax-only": await interop(import("./lib-BgGy3QDX.mjs")) },
|
|
1940
1991
|
rules: {
|
|
1941
1992
|
"erasable-syntax-only/enums": "error",
|
|
1942
1993
|
"erasable-syntax-only/import-aliases": "error",
|
|
@@ -2300,7 +2351,7 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2300
2351
|
})]));
|
|
2301
2352
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2302
2353
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2303
|
-
configs.push(ignores(userIgnores), javascript({
|
|
2354
|
+
configs.push(ignores(userIgnores, !enableTypeScript), javascript({
|
|
2304
2355
|
isInEditor,
|
|
2305
2356
|
overrides: getOverrides(options, "javascript")
|
|
2306
2357
|
}), comments(), command(), perfectionist());
|
|
@@ -2396,4 +2447,4 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2396
2447
|
var src_default = luxass;
|
|
2397
2448
|
|
|
2398
2449
|
//#endregion
|
|
2399
|
-
export { GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NEXTJS_OG, GLOB_NEXTJS_ROUTES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, astro, combine, command, comments, src_default as default, disables, ensure, formatters, getOverrides, ignores, imports, interop, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, luxass, markdown, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
2450
|
+
export { GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NEXTJS_OG, GLOB_NEXTJS_ROUTES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, astro, combine, command, comments, src_default as default, disables, ensure, formatters, getOverrides, ignores, imports, interop, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, luxass, markdown, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|