@luxass/eslint-config 7.0.0-beta.2 → 7.0.0-beta.3
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 +10 -10
- package/dist/index.mjs +77 -76
- package/dist/{lib-DHxUIJ7x.mjs → lib-ur-SnMJ-.mjs} +273 -273
- package/package.json +19 -19
package/dist/index.d.mts
CHANGED
|
@@ -3560,7 +3560,7 @@ interface RuleOptions {
|
|
|
3560
3560
|
*/
|
|
3561
3561
|
'react-dom/no-unknown-property'?: Linter.RuleEntry<ReactDomNoUnknownProperty>;
|
|
3562
3562
|
/**
|
|
3563
|
-
* Enforces 'sandbox' attribute for 'iframe' elements is not set to unsafe combinations.
|
|
3563
|
+
* Enforces that the 'sandbox' attribute for 'iframe' elements is not set to unsafe combinations.
|
|
3564
3564
|
* @see https://eslint-react.xyz/docs/rules/dom-no-unsafe-iframe-sandbox
|
|
3565
3565
|
*/
|
|
3566
3566
|
'react-dom/no-unsafe-iframe-sandbox'?: Linter.RuleEntry<[]>;
|
|
@@ -3759,12 +3759,12 @@ interface RuleOptions {
|
|
|
3759
3759
|
*/
|
|
3760
3760
|
'react-web-api/no-leaked-timeout'?: Linter.RuleEntry<[]>;
|
|
3761
3761
|
/**
|
|
3762
|
-
* Prevents unnecessary
|
|
3762
|
+
* Prevents unnecessary '$' symbols before JSX expressions.
|
|
3763
3763
|
* @see https://eslint-react.xyz/docs/rules/jsx-dollar
|
|
3764
3764
|
*/
|
|
3765
3765
|
'react/jsx-dollar'?: Linter.RuleEntry<[]>;
|
|
3766
3766
|
/**
|
|
3767
|
-
* Enforces
|
|
3767
|
+
* Enforces 'key' prop placement before spread props.
|
|
3768
3768
|
* @see https://eslint-react.xyz/docs/rules/jsx-key-before-spread
|
|
3769
3769
|
*/
|
|
3770
3770
|
'react/jsx-key-before-spread'?: Linter.RuleEntry<[]>;
|
|
@@ -3779,7 +3779,7 @@ interface RuleOptions {
|
|
|
3779
3779
|
*/
|
|
3780
3780
|
'react/jsx-no-duplicate-props'?: Linter.RuleEntry<[]>;
|
|
3781
3781
|
/**
|
|
3782
|
-
* Disallows
|
|
3782
|
+
* Disallows immediately-invoked function expressions in JSX.
|
|
3783
3783
|
* @see https://eslint-react.xyz/docs/rules/jsx-no-iife
|
|
3784
3784
|
*/
|
|
3785
3785
|
'react/jsx-no-iife'?: Linter.RuleEntry<[]>;
|
|
@@ -3789,12 +3789,12 @@ interface RuleOptions {
|
|
|
3789
3789
|
*/
|
|
3790
3790
|
'react/jsx-no-undef'?: Linter.RuleEntry<[]>;
|
|
3791
3791
|
/**
|
|
3792
|
-
* Enforces
|
|
3792
|
+
* Enforces shorthand syntax for boolean props.
|
|
3793
3793
|
* @see https://eslint-react.xyz/docs/rules/jsx-shorthand-boolean
|
|
3794
3794
|
*/
|
|
3795
3795
|
'react/jsx-shorthand-boolean'?: Linter.RuleEntry<ReactJsxShorthandBoolean>;
|
|
3796
3796
|
/**
|
|
3797
|
-
* Enforces
|
|
3797
|
+
* Enforces shorthand syntax for fragment elements.
|
|
3798
3798
|
* @see https://eslint-react.xyz/docs/rules/jsx-shorthand-fragment
|
|
3799
3799
|
*/
|
|
3800
3800
|
'react/jsx-shorthand-fragment'?: Linter.RuleEntry<ReactJsxShorthandFragment>;
|
|
@@ -3804,7 +3804,7 @@ interface RuleOptions {
|
|
|
3804
3804
|
*/
|
|
3805
3805
|
'react/jsx-uses-react'?: Linter.RuleEntry<[]>;
|
|
3806
3806
|
/**
|
|
3807
|
-
* Marks
|
|
3807
|
+
* Marks JSX element variables as used.
|
|
3808
3808
|
* @see https://eslint-react.xyz/docs/rules/jsx-uses-vars
|
|
3809
3809
|
*/
|
|
3810
3810
|
'react/jsx-uses-vars'?: Linter.RuleEntry<[]>;
|
|
@@ -3920,12 +3920,12 @@ interface RuleOptions {
|
|
|
3920
3920
|
*/
|
|
3921
3921
|
'react/no-leaked-conditional-rendering'?: Linter.RuleEntry<[]>;
|
|
3922
3922
|
/**
|
|
3923
|
-
* Enforces that all components have a 'displayName' that can be used in
|
|
3923
|
+
* Enforces that all components have a 'displayName' that can be used in DevTools.
|
|
3924
3924
|
* @see https://eslint-react.xyz/docs/rules/no-missing-component-display-name
|
|
3925
3925
|
*/
|
|
3926
3926
|
'react/no-missing-component-display-name'?: Linter.RuleEntry<[]>;
|
|
3927
3927
|
/**
|
|
3928
|
-
* Enforces that all contexts have a 'displayName' that can be used in
|
|
3928
|
+
* Enforces that all contexts have a 'displayName' that can be used in DevTools.
|
|
3929
3929
|
* @see https://eslint-react.xyz/docs/rules/no-missing-context-display-name
|
|
3930
3930
|
*/
|
|
3931
3931
|
'react/no-missing-context-display-name'?: Linter.RuleEntry<[]>;
|
|
@@ -3980,7 +3980,7 @@ interface RuleOptions {
|
|
|
3980
3980
|
*/
|
|
3981
3981
|
'react/no-string-refs'?: Linter.RuleEntry<[]>;
|
|
3982
3982
|
/**
|
|
3983
|
-
* Disallows unnecessary 'key' props on elements.
|
|
3983
|
+
* Disallows unnecessary 'key' props on nested child elements when rendering lists.
|
|
3984
3984
|
* @see https://eslint-react.xyz/docs/rules/no-unnecessary-key
|
|
3985
3985
|
*/
|
|
3986
3986
|
'react/no-unnecessary-key'?: Linter.RuleEntry<[]>;
|
package/dist/index.mjs
CHANGED
|
@@ -163,8 +163,8 @@ const parserPlain = {
|
|
|
163
163
|
/**
|
|
164
164
|
* Combine array and non-array configs into a single array.
|
|
165
165
|
*/
|
|
166
|
-
async function combine(...configs
|
|
167
|
-
return (await Promise.all(configs
|
|
166
|
+
async function combine(...configs) {
|
|
167
|
+
return (await Promise.all(configs)).flat();
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
170
|
* Rename plugin prefixes in a rule object.
|
|
@@ -204,8 +204,8 @@ function renameRules(rules, map) {
|
|
|
204
204
|
* })
|
|
205
205
|
* ```
|
|
206
206
|
*/
|
|
207
|
-
function renamePluginInConfigs(configs
|
|
208
|
-
return configs
|
|
207
|
+
function renamePluginInConfigs(configs, map) {
|
|
208
|
+
return configs.map((i) => {
|
|
209
209
|
const clone = { ...i };
|
|
210
210
|
if (clone.rules) clone.rules = renameRules(clone.rules, map);
|
|
211
211
|
if (clone.plugins) clone.plugins = Object.fromEntries(Object.entries(clone.plugins).map(([key, value]) => {
|
|
@@ -338,7 +338,7 @@ function isInGitHooksOrLintStaged() {
|
|
|
338
338
|
//#endregion
|
|
339
339
|
//#region src/configs/astro.ts
|
|
340
340
|
async function astro(options = {}) {
|
|
341
|
-
const { files = [GLOB_ASTRO], overrides = {}, stylistic
|
|
341
|
+
const { files = [GLOB_ASTRO], overrides = {}, stylistic = true } = options;
|
|
342
342
|
await ensure(["eslint-plugin-astro", "astro-eslint-parser"]);
|
|
343
343
|
const [pluginAstro, parserAstro, parserTs] = await Promise.all([
|
|
344
344
|
interop(import("eslint-plugin-astro")),
|
|
@@ -373,7 +373,7 @@ async function astro(options = {}) {
|
|
|
373
373
|
"astro/no-unused-define-vars-in-style": "error",
|
|
374
374
|
"astro/semi": "off",
|
|
375
375
|
"astro/valid-compile": "error",
|
|
376
|
-
...stylistic
|
|
376
|
+
...stylistic ? {
|
|
377
377
|
"style/indent": "off",
|
|
378
378
|
"style/jsx-closing-tag-location": "off",
|
|
379
379
|
"style/jsx-one-expression-per-line": "off",
|
|
@@ -477,14 +477,14 @@ const StylisticConfigDefaults = {
|
|
|
477
477
|
semi: true
|
|
478
478
|
};
|
|
479
479
|
async function stylistic(options = {}) {
|
|
480
|
-
const { indent, jsx
|
|
480
|
+
const { indent, jsx, overrides = {}, quotes, semi } = {
|
|
481
481
|
...StylisticConfigDefaults,
|
|
482
482
|
...options
|
|
483
483
|
};
|
|
484
484
|
const pluginStylistic = await interop(import("@stylistic/eslint-plugin"));
|
|
485
485
|
const config = pluginStylistic.configs.customize({
|
|
486
486
|
indent,
|
|
487
|
-
jsx
|
|
487
|
+
jsx,
|
|
488
488
|
pluginName: "style",
|
|
489
489
|
quotes,
|
|
490
490
|
semi
|
|
@@ -537,7 +537,7 @@ function mergePrettierOptions(options, overrides = {}) {
|
|
|
537
537
|
plugins: [...overrides.plugins || [], ...options.plugins || []]
|
|
538
538
|
};
|
|
539
539
|
}
|
|
540
|
-
async function formatters(options = {}, stylistic
|
|
540
|
+
async function formatters(options = {}, stylistic = {}) {
|
|
541
541
|
if (options === true) options = {
|
|
542
542
|
astro: isPackageInScope("astro"),
|
|
543
543
|
css: true,
|
|
@@ -548,7 +548,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
548
548
|
await ensure(["eslint-plugin-format", options.astro ? "prettier-plugin-astro" : void 0]);
|
|
549
549
|
const { indent, quotes, semi } = {
|
|
550
550
|
...StylisticConfigDefaults,
|
|
551
|
-
...stylistic
|
|
551
|
+
...stylistic
|
|
552
552
|
};
|
|
553
553
|
const prettierOptions = Object.assign({
|
|
554
554
|
endOfLine: "auto",
|
|
@@ -564,11 +564,11 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
564
564
|
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
565
565
|
useTabs: indent === "tab"
|
|
566
566
|
}, options.dprintOptions || {});
|
|
567
|
-
const configs
|
|
567
|
+
const configs = [{
|
|
568
568
|
name: "luxass/formatter/setup",
|
|
569
569
|
plugins: { format: await interop(import("eslint-plugin-format")) }
|
|
570
570
|
}];
|
|
571
|
-
if (options.css) configs
|
|
571
|
+
if (options.css) configs.push({
|
|
572
572
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
573
573
|
languageOptions: { parser: parserPlain },
|
|
574
574
|
name: "luxass/formatter/css",
|
|
@@ -584,7 +584,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
584
584
|
name: "luxass/formatter/less",
|
|
585
585
|
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "less" })] }
|
|
586
586
|
});
|
|
587
|
-
if (options.html) configs
|
|
587
|
+
if (options.html) configs.push({
|
|
588
588
|
files: [GLOB_HTML],
|
|
589
589
|
languageOptions: { parser: parserPlain },
|
|
590
590
|
name: "luxass/formatter/html",
|
|
@@ -592,7 +592,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
592
592
|
});
|
|
593
593
|
if (options.markdown) {
|
|
594
594
|
const formatter = options.markdown === true ? "prettier" : options.markdown;
|
|
595
|
-
configs
|
|
595
|
+
configs.push({
|
|
596
596
|
files: [GLOB_MARKDOWN],
|
|
597
597
|
languageOptions: { parser: parserPlain },
|
|
598
598
|
name: "luxass/formatter/markdown",
|
|
@@ -605,7 +605,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
605
605
|
}] }
|
|
606
606
|
});
|
|
607
607
|
}
|
|
608
|
-
if (options.astro) configs
|
|
608
|
+
if (options.astro) configs.push({
|
|
609
609
|
files: [GLOB_ASTRO],
|
|
610
610
|
languageOptions: { parser: parserPlain },
|
|
611
611
|
name: "luxass/formatter/astro",
|
|
@@ -614,13 +614,13 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
614
614
|
plugins: ["prettier-plugin-astro"]
|
|
615
615
|
})] }
|
|
616
616
|
});
|
|
617
|
-
if (options.graphql) configs
|
|
617
|
+
if (options.graphql) configs.push({
|
|
618
618
|
files: [GLOB_GRAPHQL],
|
|
619
619
|
languageOptions: { parser: parserPlain },
|
|
620
620
|
name: "luxass/formatter/graphql",
|
|
621
621
|
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
|
|
622
622
|
});
|
|
623
|
-
return configs
|
|
623
|
+
return configs;
|
|
624
624
|
}
|
|
625
625
|
|
|
626
626
|
//#endregion
|
|
@@ -635,7 +635,7 @@ async function ignores(userIgnores = []) {
|
|
|
635
635
|
//#endregion
|
|
636
636
|
//#region src/configs/imports.ts
|
|
637
637
|
async function imports(options = {}) {
|
|
638
|
-
const { overrides = {}, stylistic
|
|
638
|
+
const { overrides = {}, stylistic = true } = options;
|
|
639
639
|
return [{
|
|
640
640
|
name: "luxass/imports",
|
|
641
641
|
plugins: {
|
|
@@ -651,7 +651,7 @@ async function imports(options = {}) {
|
|
|
651
651
|
"import/no-duplicates": "error",
|
|
652
652
|
"import/no-mutable-exports": "error",
|
|
653
653
|
"import/no-named-default": "error",
|
|
654
|
-
...stylistic
|
|
654
|
+
...stylistic ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
|
|
655
655
|
...overrides
|
|
656
656
|
}
|
|
657
657
|
}];
|
|
@@ -900,7 +900,7 @@ async function javascript(options = {}) {
|
|
|
900
900
|
//#endregion
|
|
901
901
|
//#region src/configs/jsdoc.ts
|
|
902
902
|
async function jsdoc(options = {}) {
|
|
903
|
-
const { overrides, stylistic
|
|
903
|
+
const { overrides, stylistic = true } = options;
|
|
904
904
|
return [{
|
|
905
905
|
name: "luxass/jsdoc/rules",
|
|
906
906
|
plugins: { jsdoc: await interop(import("eslint-plugin-jsdoc")) },
|
|
@@ -920,7 +920,7 @@ async function jsdoc(options = {}) {
|
|
|
920
920
|
"jsdoc/require-returns-check": "warn",
|
|
921
921
|
"jsdoc/require-returns-description": "warn",
|
|
922
922
|
"jsdoc/require-yields-check": "warn",
|
|
923
|
-
...stylistic
|
|
923
|
+
...stylistic ? {
|
|
924
924
|
"jsdoc/check-alignment": "warn",
|
|
925
925
|
"jsdoc/multiline-blocks": "warn"
|
|
926
926
|
} : {},
|
|
@@ -936,8 +936,8 @@ async function jsonc(options = {}) {
|
|
|
936
936
|
GLOB_JSON,
|
|
937
937
|
GLOB_JSON5,
|
|
938
938
|
GLOB_JSONC
|
|
939
|
-
], overrides = {}, stylistic
|
|
940
|
-
const { indent = 2 } = typeof stylistic
|
|
939
|
+
], overrides = {}, stylistic = true } = options;
|
|
940
|
+
const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
|
|
941
941
|
const [pluginJsonc, parserJsonc] = await Promise.all([interop(import("eslint-plugin-jsonc")), interop(import("jsonc-eslint-parser"))]);
|
|
942
942
|
return [{
|
|
943
943
|
name: "luxass/jsonc/setup",
|
|
@@ -973,7 +973,7 @@ async function jsonc(options = {}) {
|
|
|
973
973
|
"jsonc/space-unary-ops": "error",
|
|
974
974
|
"jsonc/valid-json-number": "error",
|
|
975
975
|
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
976
|
-
...stylistic
|
|
976
|
+
...stylistic ? {
|
|
977
977
|
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
978
978
|
"jsonc/comma-dangle": ["error", "never"],
|
|
979
979
|
"jsonc/comma-style": ["error", "last"],
|
|
@@ -1142,8 +1142,8 @@ async function perfectionist() {
|
|
|
1142
1142
|
async function detectCatalogUsage() {
|
|
1143
1143
|
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
1144
1144
|
if (!workspaceFile) return false;
|
|
1145
|
-
const yaml
|
|
1146
|
-
return yaml
|
|
1145
|
+
const yaml = await fsPromises.readFile(workspaceFile, "utf-8");
|
|
1146
|
+
return yaml.includes("catalog:") || yaml.includes("catalogs:");
|
|
1147
1147
|
}
|
|
1148
1148
|
async function pnpm(options) {
|
|
1149
1149
|
const [pluginPnpm, pluginYaml, yamlParser, jsoncParser] = await Promise.all([
|
|
@@ -1152,9 +1152,9 @@ async function pnpm(options) {
|
|
|
1152
1152
|
interop(import("yaml-eslint-parser")),
|
|
1153
1153
|
interop(import("jsonc-eslint-parser"))
|
|
1154
1154
|
]);
|
|
1155
|
-
const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml
|
|
1156
|
-
const configs
|
|
1157
|
-
if (json) configs
|
|
1155
|
+
const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml = true } = options;
|
|
1156
|
+
const configs = [];
|
|
1157
|
+
if (json) configs.push({
|
|
1158
1158
|
files: ["package.json", "**/package.json"],
|
|
1159
1159
|
languageOptions: { parser: jsoncParser },
|
|
1160
1160
|
name: "luxass/pnpm/package-json",
|
|
@@ -1168,8 +1168,8 @@ async function pnpm(options) {
|
|
|
1168
1168
|
"pnpm/json-valid-catalog": ["error", { autofix: !isInEditor }]
|
|
1169
1169
|
}
|
|
1170
1170
|
});
|
|
1171
|
-
if (yaml
|
|
1172
|
-
configs
|
|
1171
|
+
if (yaml) {
|
|
1172
|
+
configs.push({
|
|
1173
1173
|
files: ["pnpm-workspace.yaml"],
|
|
1174
1174
|
languageOptions: { parser: yamlParser },
|
|
1175
1175
|
name: "luxass/pnpm/pnpm-workspace-yaml",
|
|
@@ -1183,7 +1183,7 @@ async function pnpm(options) {
|
|
|
1183
1183
|
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
1184
1184
|
}
|
|
1185
1185
|
});
|
|
1186
|
-
if (sort) configs
|
|
1186
|
+
if (sort) configs.push({
|
|
1187
1187
|
files: ["pnpm-workspace.yaml"],
|
|
1188
1188
|
languageOptions: { parser: yamlParser },
|
|
1189
1189
|
name: "luxass/pnpm/pnpm-workspace-yaml-sort",
|
|
@@ -1262,7 +1262,7 @@ async function pnpm(options) {
|
|
|
1262
1262
|
] }
|
|
1263
1263
|
});
|
|
1264
1264
|
}
|
|
1265
|
-
return configs
|
|
1265
|
+
return configs;
|
|
1266
1266
|
}
|
|
1267
1267
|
|
|
1268
1268
|
//#endregion
|
|
@@ -1399,7 +1399,7 @@ async function react(options = {}) {
|
|
|
1399
1399
|
"react-hooks/use-memo": "error"
|
|
1400
1400
|
} : {},
|
|
1401
1401
|
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1402
|
-
"react-refresh/only-export-components": ["
|
|
1402
|
+
"react-refresh/only-export-components": ["error", {
|
|
1403
1403
|
allowConstantExport: isAllowConstantExport,
|
|
1404
1404
|
allowExportNames: [...isUsingNext ? [
|
|
1405
1405
|
"dynamic",
|
|
@@ -1409,12 +1409,13 @@ async function react(options = {}) {
|
|
|
1409
1409
|
"runtime",
|
|
1410
1410
|
"preferredRegion",
|
|
1411
1411
|
"maxDuration",
|
|
1412
|
-
"config",
|
|
1413
1412
|
"generateStaticParams",
|
|
1414
1413
|
"metadata",
|
|
1415
1414
|
"generateMetadata",
|
|
1416
1415
|
"viewport",
|
|
1417
|
-
"generateViewport"
|
|
1416
|
+
"generateViewport",
|
|
1417
|
+
"generateImageMetadata",
|
|
1418
|
+
"generateSitemaps"
|
|
1418
1419
|
] : [], ...isUsingRemix || isUsingReactRouter ? [
|
|
1419
1420
|
"meta",
|
|
1420
1421
|
"links",
|
|
@@ -1758,8 +1759,8 @@ async function test(options = {}) {
|
|
|
1758
1759
|
//#endregion
|
|
1759
1760
|
//#region src/configs/toml.ts
|
|
1760
1761
|
async function toml(options = {}) {
|
|
1761
|
-
const { files = [GLOB_TOML], overrides = {}, stylistic
|
|
1762
|
-
const { indent = 2 } = typeof stylistic
|
|
1762
|
+
const { files = [GLOB_TOML], overrides = {}, stylistic = true } = options;
|
|
1763
|
+
const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
|
|
1763
1764
|
const [pluginToml, parserToml] = await Promise.all([interop(import("eslint-plugin-toml")), interop(import("toml-eslint-parser"))]);
|
|
1764
1765
|
return [{
|
|
1765
1766
|
name: "luxass/toml/setup",
|
|
@@ -1778,7 +1779,7 @@ async function toml(options = {}) {
|
|
|
1778
1779
|
"toml/precision-of-integer": "error",
|
|
1779
1780
|
"toml/tables-order": "error",
|
|
1780
1781
|
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1781
|
-
...stylistic
|
|
1782
|
+
...stylistic ? {
|
|
1782
1783
|
"toml/array-bracket-newline": "error",
|
|
1783
1784
|
"toml/array-bracket-spacing": "error",
|
|
1784
1785
|
"toml/array-element-newline": "error",
|
|
@@ -1836,10 +1837,10 @@ async function typescript(options = {}) {
|
|
|
1836
1837
|
"ts/unbound-method": "error"
|
|
1837
1838
|
};
|
|
1838
1839
|
const [pluginTs, parserTs] = await Promise.all([interop(import("@typescript-eslint/eslint-plugin")), interop(import("@typescript-eslint/parser"))]);
|
|
1839
|
-
function makeParser(typeAware, files
|
|
1840
|
+
function makeParser(typeAware, files, ignores) {
|
|
1840
1841
|
return {
|
|
1841
|
-
files
|
|
1842
|
-
...ignores
|
|
1842
|
+
files,
|
|
1843
|
+
...ignores ? { ignores } : {},
|
|
1843
1844
|
languageOptions: {
|
|
1844
1845
|
parser: parserTs,
|
|
1845
1846
|
parserOptions: {
|
|
@@ -1935,7 +1936,7 @@ async function typescript(options = {}) {
|
|
|
1935
1936
|
}] : [],
|
|
1936
1937
|
...erasableOnly ? [{
|
|
1937
1938
|
name: "luxas/typescript/erasable-syntax-only",
|
|
1938
|
-
plugins: { "erasable-syntax-only": await interop(import("./lib-
|
|
1939
|
+
plugins: { "erasable-syntax-only": await interop(import("./lib-ur-SnMJ-.mjs")) },
|
|
1939
1940
|
rules: {
|
|
1940
1941
|
"erasable-syntax-only/enums": "error",
|
|
1941
1942
|
"erasable-syntax-only/import-aliases": "error",
|
|
@@ -1992,14 +1993,14 @@ async function unocss(options = {}) {
|
|
|
1992
1993
|
//#endregion
|
|
1993
1994
|
//#region src/configs/vue.ts
|
|
1994
1995
|
async function vue(options = {}) {
|
|
1995
|
-
const { files = [GLOB_VUE], overrides = {}, stylistic
|
|
1996
|
+
const { files = [GLOB_VUE], overrides = {}, stylistic = true } = options;
|
|
1996
1997
|
const [pluginVue, parserVue, processorVueBlocks] = await Promise.all([
|
|
1997
1998
|
interop(import("eslint-plugin-vue")),
|
|
1998
1999
|
interop(import("vue-eslint-parser")),
|
|
1999
2000
|
interop(import("eslint-processor-vue-blocks"))
|
|
2000
2001
|
]);
|
|
2001
2002
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
2002
|
-
const { indent = 2 } = typeof stylistic
|
|
2003
|
+
const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
|
|
2003
2004
|
return [{
|
|
2004
2005
|
languageOptions: { globals: {
|
|
2005
2006
|
computed: "readonly",
|
|
@@ -2111,7 +2112,7 @@ async function vue(options = {}) {
|
|
|
2111
2112
|
nonwords: false,
|
|
2112
2113
|
words: true
|
|
2113
2114
|
}],
|
|
2114
|
-
...stylistic
|
|
2115
|
+
...stylistic ? {
|
|
2115
2116
|
"vue/array-bracket-spacing": ["error", "never"],
|
|
2116
2117
|
"vue/arrow-spacing": ["error", {
|
|
2117
2118
|
after: true,
|
|
@@ -2163,9 +2164,9 @@ async function vue(options = {}) {
|
|
|
2163
2164
|
//#endregion
|
|
2164
2165
|
//#region src/configs/yaml.ts
|
|
2165
2166
|
async function yaml(options = {}) {
|
|
2166
|
-
const { files = [GLOB_YAML], overrides = {}, stylistic
|
|
2167
|
+
const { files = [GLOB_YAML], overrides = {}, stylistic = true } = options;
|
|
2167
2168
|
const [pluginYaml, parserYaml] = await Promise.all([interop(import("eslint-plugin-yml")), interop(import("yaml-eslint-parser"))]);
|
|
2168
|
-
const { indent = 2, quotes = "double" } = typeof stylistic
|
|
2169
|
+
const { indent = 2, quotes = "double" } = typeof stylistic === "boolean" ? {} : stylistic;
|
|
2169
2170
|
return [
|
|
2170
2171
|
{
|
|
2171
2172
|
name: "luxass/yaml/setup",
|
|
@@ -2185,7 +2186,7 @@ async function yaml(options = {}) {
|
|
|
2185
2186
|
"yaml/no-irregular-whitespace": "error",
|
|
2186
2187
|
"yaml/plain-scalar": "error",
|
|
2187
2188
|
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
2188
|
-
...stylistic
|
|
2189
|
+
...stylistic ? {
|
|
2189
2190
|
"yaml/block-mapping-question-indicator-newline": "error",
|
|
2190
2191
|
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
2191
2192
|
"yaml/flow-mapping-curly-newline": "error",
|
|
@@ -2288,104 +2289,104 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2288
2289
|
}
|
|
2289
2290
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2290
2291
|
if (stylisticOptions && !("jsx" in stylisticOptions)) stylisticOptions.jsx = enableJsx;
|
|
2291
|
-
const configs
|
|
2292
|
-
if (enableGitignore) if (typeof enableGitignore !== "boolean") configs
|
|
2292
|
+
const configs = [];
|
|
2293
|
+
if (enableGitignore) if (typeof enableGitignore !== "boolean") configs.push(interop(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2293
2294
|
name: "luxass/gitignore",
|
|
2294
2295
|
...enableGitignore
|
|
2295
2296
|
})]));
|
|
2296
|
-
else configs
|
|
2297
|
+
else configs.push(interop(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2297
2298
|
name: "luxass/gitignore",
|
|
2298
2299
|
strict: false
|
|
2299
2300
|
})]));
|
|
2300
2301
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2301
2302
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2302
|
-
configs
|
|
2303
|
+
configs.push(ignores(userIgnores), javascript({
|
|
2303
2304
|
isInEditor,
|
|
2304
2305
|
overrides: getOverrides(options, "javascript")
|
|
2305
2306
|
}), comments(), command(), perfectionist());
|
|
2306
|
-
if (enableNode) configs
|
|
2307
|
-
if (enableJsdoc) configs
|
|
2308
|
-
if (enableImports) configs
|
|
2307
|
+
if (enableNode) configs.push(node());
|
|
2308
|
+
if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
|
|
2309
|
+
if (enableImports) configs.push(imports({
|
|
2309
2310
|
stylistic: stylisticOptions,
|
|
2310
2311
|
...resolveSubOptions(options, "imports")
|
|
2311
2312
|
}));
|
|
2312
|
-
if (enableUnicorn) configs
|
|
2313
|
+
if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2313
2314
|
if (enableVue) exts.push("vue");
|
|
2314
|
-
if (enableJsx) configs
|
|
2315
|
-
if (enableTypeScript) configs
|
|
2315
|
+
if (enableJsx) configs.push(jsx());
|
|
2316
|
+
if (enableTypeScript) configs.push(typescript({
|
|
2316
2317
|
...typescriptOptions,
|
|
2317
2318
|
exts,
|
|
2318
2319
|
overrides: getOverrides(options, "typescript"),
|
|
2319
2320
|
type: projectType
|
|
2320
2321
|
}));
|
|
2321
|
-
if (stylisticOptions) configs
|
|
2322
|
+
if (stylisticOptions) configs.push(stylistic({
|
|
2322
2323
|
...stylisticOptions,
|
|
2323
2324
|
overrides: getOverrides(options, "stylistic")
|
|
2324
2325
|
}));
|
|
2325
|
-
if (enableRegexp) configs
|
|
2326
|
+
if (enableRegexp) configs.push(regexp({
|
|
2326
2327
|
...resolveSubOptions(options, "regexp"),
|
|
2327
2328
|
overrides: getOverrides(options, "regexp")
|
|
2328
2329
|
}));
|
|
2329
|
-
if (options.test ?? true) configs
|
|
2330
|
+
if (options.test ?? true) configs.push(test({
|
|
2330
2331
|
isInEditor,
|
|
2331
2332
|
overrides: getOverrides(options, "test")
|
|
2332
2333
|
}));
|
|
2333
|
-
if (enableReact) configs
|
|
2334
|
+
if (enableReact) configs.push(react({
|
|
2334
2335
|
...typescriptOptions,
|
|
2335
2336
|
...resolveSubOptions(options, "react"),
|
|
2336
2337
|
overrides: getOverrides(options, "react"),
|
|
2337
2338
|
tsconfigPath
|
|
2338
2339
|
}));
|
|
2339
|
-
if (enableVue) configs
|
|
2340
|
+
if (enableVue) configs.push(vue({
|
|
2340
2341
|
...resolveSubOptions(options, "vue"),
|
|
2341
2342
|
overrides: getOverrides(options, "vue"),
|
|
2342
2343
|
stylistic: stylisticOptions,
|
|
2343
2344
|
typescript: !!enableTypeScript
|
|
2344
2345
|
}));
|
|
2345
|
-
if (enableAstro) configs
|
|
2346
|
+
if (enableAstro) configs.push(astro({
|
|
2346
2347
|
...resolveSubOptions(options, "astro"),
|
|
2347
2348
|
overrides: getOverrides(options, "astro")
|
|
2348
2349
|
}));
|
|
2349
|
-
if (enableUnoCSS) configs
|
|
2350
|
+
if (enableUnoCSS) configs.push(unocss({
|
|
2350
2351
|
...resolveSubOptions(options, "unocss"),
|
|
2351
2352
|
overrides: getOverrides(options, "unocss")
|
|
2352
2353
|
}));
|
|
2353
|
-
if (enableTailwindCSS) configs
|
|
2354
|
+
if (enableTailwindCSS) configs.push(tailwindcss({
|
|
2354
2355
|
...resolveSubOptions(options, "tailwindcss"),
|
|
2355
2356
|
overrides: getOverrides(options, "tailwindcss")
|
|
2356
2357
|
}));
|
|
2357
|
-
if (options.jsonc ?? true) configs
|
|
2358
|
+
if (options.jsonc ?? true) configs.push(jsonc({
|
|
2358
2359
|
overrides: getOverrides(options, "jsonc"),
|
|
2359
2360
|
stylistic: stylisticOptions
|
|
2360
2361
|
}), sortPackageJson(), sortTsconfig());
|
|
2361
|
-
if (enableCatalogs) configs
|
|
2362
|
+
if (enableCatalogs) configs.push(pnpm({
|
|
2362
2363
|
isInEditor,
|
|
2363
2364
|
json: options.jsonc !== false,
|
|
2364
2365
|
yaml: options.yaml !== false,
|
|
2365
2366
|
...resolveSubOptions(options, "pnpm")
|
|
2366
2367
|
}));
|
|
2367
|
-
if (options.yaml ?? true) configs
|
|
2368
|
+
if (options.yaml ?? true) configs.push(yaml({
|
|
2368
2369
|
overrides: getOverrides(options, "yaml"),
|
|
2369
2370
|
stylistic: stylisticOptions
|
|
2370
2371
|
}));
|
|
2371
|
-
if (options.toml ?? true) configs
|
|
2372
|
+
if (options.toml ?? true) configs.push(toml({
|
|
2372
2373
|
overrides: getOverrides(options, "toml"),
|
|
2373
2374
|
stylistic: stylisticOptions
|
|
2374
2375
|
}));
|
|
2375
|
-
if (options.markdown ?? true) configs
|
|
2376
|
+
if (options.markdown ?? true) configs.push(markdown({
|
|
2376
2377
|
exts,
|
|
2377
2378
|
overrides: getOverrides(options, "markdown")
|
|
2378
2379
|
}));
|
|
2379
|
-
if (options.formatters) configs
|
|
2380
|
-
configs
|
|
2380
|
+
if (options.formatters) configs.push(formatters(options.formatters, typeof stylisticOptions === "boolean" ? {} : stylisticOptions));
|
|
2381
|
+
configs.push(disables());
|
|
2381
2382
|
if ("files" in options) throw new Error("[@luxass/eslint-config] The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
|
|
2382
2383
|
const fusedConfig = FLAT_CONFIG_PROPS.reduce((acc, key) => {
|
|
2383
2384
|
if (key in options) acc[key] = options[key];
|
|
2384
2385
|
return acc;
|
|
2385
2386
|
}, {});
|
|
2386
|
-
if (Object.keys(fusedConfig).length) configs
|
|
2387
|
+
if (Object.keys(fusedConfig).length) configs.push([fusedConfig]);
|
|
2387
2388
|
let composer = new FlatConfigComposer();
|
|
2388
|
-
composer = composer.append(...configs
|
|
2389
|
+
composer = composer.append(...configs, ...userConfigs);
|
|
2389
2390
|
if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
|
|
2390
2391
|
return composer;
|
|
2391
2392
|
}
|