@luxass/eslint-config 4.4.3 → 4.6.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/README.md +4 -1
- package/dist/index.cjs +169 -334
- package/dist/index.d.cts +320 -903
- package/dist/index.d.ts +320 -903
- package/dist/index.js +167 -332
- package/package.json +37 -53
package/dist/index.cjs
CHANGED
|
@@ -71,18 +71,18 @@ __export(src_exports, {
|
|
|
71
71
|
javascript: () => javascript,
|
|
72
72
|
jsdoc: () => jsdoc,
|
|
73
73
|
jsonc: () => jsonc,
|
|
74
|
+
jsx: () => jsx,
|
|
74
75
|
luxass: () => luxass,
|
|
75
76
|
markdown: () => markdown,
|
|
76
77
|
node: () => node,
|
|
77
78
|
parserPlain: () => parserPlain,
|
|
78
79
|
react: () => react,
|
|
80
|
+
regexp: () => regexp,
|
|
79
81
|
renameRules: () => renameRules,
|
|
80
82
|
resolveSubOptions: () => resolveSubOptions,
|
|
81
|
-
solid: () => solid,
|
|
82
83
|
sortPackageJson: () => sortPackageJson,
|
|
83
84
|
sortTsconfig: () => sortTsconfig,
|
|
84
85
|
stylistic: () => stylistic,
|
|
85
|
-
svelte: () => svelte,
|
|
86
86
|
tailwindcss: () => tailwindcss,
|
|
87
87
|
test: () => test,
|
|
88
88
|
toArray: () => toArray,
|
|
@@ -521,172 +521,6 @@ function sortTsconfig() {
|
|
|
521
521
|
];
|
|
522
522
|
}
|
|
523
523
|
|
|
524
|
-
// src/utils.ts
|
|
525
|
-
var import_node_process = __toESM(require("process"), 1);
|
|
526
|
-
var import_local_pkg = require("local-pkg");
|
|
527
|
-
var parserPlain = {
|
|
528
|
-
meta: {
|
|
529
|
-
name: "parser-plain"
|
|
530
|
-
},
|
|
531
|
-
parseForESLint: (code) => ({
|
|
532
|
-
ast: {
|
|
533
|
-
body: [],
|
|
534
|
-
comments: [],
|
|
535
|
-
loc: { end: code.length, start: 0 },
|
|
536
|
-
range: [0, code.length],
|
|
537
|
-
tokens: [],
|
|
538
|
-
type: "Program"
|
|
539
|
-
},
|
|
540
|
-
scopeManager: null,
|
|
541
|
-
services: { isPlain: true },
|
|
542
|
-
visitorKeys: {
|
|
543
|
-
Program: []
|
|
544
|
-
}
|
|
545
|
-
})
|
|
546
|
-
};
|
|
547
|
-
async function combine(...configs) {
|
|
548
|
-
const resolved = await Promise.all(configs);
|
|
549
|
-
return resolved.flat();
|
|
550
|
-
}
|
|
551
|
-
function renameRules(rules, from, to) {
|
|
552
|
-
return Object.fromEntries(
|
|
553
|
-
Object.entries(rules).map(([key, value]) => {
|
|
554
|
-
if (key.startsWith(from)) {
|
|
555
|
-
return [to + key.slice(from.length), value];
|
|
556
|
-
}
|
|
557
|
-
return [key, value];
|
|
558
|
-
})
|
|
559
|
-
);
|
|
560
|
-
}
|
|
561
|
-
function toArray(value) {
|
|
562
|
-
return Array.isArray(value) ? value : [value];
|
|
563
|
-
}
|
|
564
|
-
async function interop(m) {
|
|
565
|
-
const resolved = await m;
|
|
566
|
-
return resolved.default || resolved;
|
|
567
|
-
}
|
|
568
|
-
async function ensure(packages) {
|
|
569
|
-
if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false) {
|
|
570
|
-
return;
|
|
571
|
-
}
|
|
572
|
-
;
|
|
573
|
-
const nonExistingPackages = packages.filter((i) => i && !(0, import_local_pkg.isPackageExists)(i));
|
|
574
|
-
if (nonExistingPackages.length === 0) {
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
const p = await import("@clack/prompts");
|
|
578
|
-
const result = await p.confirm({
|
|
579
|
-
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
|
|
580
|
-
});
|
|
581
|
-
if (result) {
|
|
582
|
-
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
function resolveSubOptions(options, key) {
|
|
586
|
-
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
587
|
-
}
|
|
588
|
-
function getOverrides(options, key) {
|
|
589
|
-
const sub = resolveSubOptions(options, key);
|
|
590
|
-
return {
|
|
591
|
-
..."overrides" in sub ? sub.overrides : {}
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
// src/configs/svelte.ts
|
|
596
|
-
async function svelte(options = {}) {
|
|
597
|
-
const {
|
|
598
|
-
files = [GLOB_SVELTE],
|
|
599
|
-
overrides = {},
|
|
600
|
-
stylistic: stylistic2 = true
|
|
601
|
-
} = options;
|
|
602
|
-
const {
|
|
603
|
-
indent = 2,
|
|
604
|
-
quotes = "single"
|
|
605
|
-
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
606
|
-
await ensure([
|
|
607
|
-
"eslint-plugin-svelte"
|
|
608
|
-
]);
|
|
609
|
-
const [
|
|
610
|
-
pluginSvelte,
|
|
611
|
-
parserSvelte
|
|
612
|
-
] = await Promise.all([
|
|
613
|
-
interop(import("eslint-plugin-svelte")),
|
|
614
|
-
interop(import("svelte-eslint-parser"))
|
|
615
|
-
]);
|
|
616
|
-
return [
|
|
617
|
-
{
|
|
618
|
-
name: "antfu/svelte/setup",
|
|
619
|
-
plugins: {
|
|
620
|
-
svelte: pluginSvelte
|
|
621
|
-
}
|
|
622
|
-
},
|
|
623
|
-
{
|
|
624
|
-
files,
|
|
625
|
-
languageOptions: {
|
|
626
|
-
parser: parserSvelte,
|
|
627
|
-
parserOptions: {
|
|
628
|
-
extraFileExtensions: [".svelte"],
|
|
629
|
-
parser: options.typescript ? await interop(import("@typescript-eslint/parser")) : null
|
|
630
|
-
}
|
|
631
|
-
},
|
|
632
|
-
name: "antfu/svelte/rules",
|
|
633
|
-
processor: pluginSvelte.processors[".svelte"],
|
|
634
|
-
rules: {
|
|
635
|
-
"import/no-mutable-exports": "off",
|
|
636
|
-
"no-undef": "off",
|
|
637
|
-
// incompatible with most recent (attribute-form) generic types RFC
|
|
638
|
-
"no-unused-vars": ["error", {
|
|
639
|
-
args: "none",
|
|
640
|
-
caughtErrors: "none",
|
|
641
|
-
ignoreRestSiblings: true,
|
|
642
|
-
vars: "all",
|
|
643
|
-
varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
|
|
644
|
-
}],
|
|
645
|
-
"svelte/comment-directive": "error",
|
|
646
|
-
"svelte/no-at-debug-tags": "warn",
|
|
647
|
-
"svelte/no-at-html-tags": "error",
|
|
648
|
-
"svelte/no-dupe-else-if-blocks": "error",
|
|
649
|
-
"svelte/no-dupe-style-properties": "error",
|
|
650
|
-
"svelte/no-dupe-use-directives": "error",
|
|
651
|
-
"svelte/no-dynamic-slot-name": "error",
|
|
652
|
-
"svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
|
|
653
|
-
"svelte/no-inner-declarations": "error",
|
|
654
|
-
"svelte/no-not-function-handler": "error",
|
|
655
|
-
"svelte/no-object-in-text-mustaches": "error",
|
|
656
|
-
"svelte/no-reactive-functions": "error",
|
|
657
|
-
"svelte/no-reactive-literals": "error",
|
|
658
|
-
"svelte/no-shorthand-style-property-overrides": "error",
|
|
659
|
-
"svelte/no-unknown-style-directive-property": "error",
|
|
660
|
-
"svelte/no-unused-svelte-ignore": "error",
|
|
661
|
-
"svelte/no-useless-mustaches": "error",
|
|
662
|
-
"svelte/require-store-callbacks-use-set-param": "error",
|
|
663
|
-
"svelte/system": "error",
|
|
664
|
-
"svelte/valid-compile": "error",
|
|
665
|
-
"svelte/valid-each-key": "error",
|
|
666
|
-
"unused-imports/no-unused-vars": [
|
|
667
|
-
"error",
|
|
668
|
-
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^(_|\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)" }
|
|
669
|
-
],
|
|
670
|
-
...stylistic2 ? {
|
|
671
|
-
"style/indent": "off",
|
|
672
|
-
// superseded by svelte/indent
|
|
673
|
-
"style/no-trailing-spaces": "off",
|
|
674
|
-
// superseded by svelte/no-trailing-spaces
|
|
675
|
-
"svelte/derived-has-same-inputs-outputs": "error",
|
|
676
|
-
"svelte/html-closing-bracket-spacing": "error",
|
|
677
|
-
"svelte/html-quotes": ["error", { prefer: quotes }],
|
|
678
|
-
"svelte/indent": ["error", { alignAttributesVertically: true, indent }],
|
|
679
|
-
"svelte/mustache-spacing": "error",
|
|
680
|
-
"svelte/no-spaces-around-equal-signs-in-attribute": "error",
|
|
681
|
-
"svelte/no-trailing-spaces": "error",
|
|
682
|
-
"svelte/spaced-html-comment": "error"
|
|
683
|
-
} : {},
|
|
684
|
-
...overrides
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
];
|
|
688
|
-
}
|
|
689
|
-
|
|
690
524
|
// src/configs/imports.ts
|
|
691
525
|
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
692
526
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
@@ -986,6 +820,77 @@ async function javascript(options = {}) {
|
|
|
986
820
|
];
|
|
987
821
|
}
|
|
988
822
|
|
|
823
|
+
// src/utils.ts
|
|
824
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
825
|
+
var import_local_pkg = require("local-pkg");
|
|
826
|
+
var parserPlain = {
|
|
827
|
+
meta: {
|
|
828
|
+
name: "parser-plain"
|
|
829
|
+
},
|
|
830
|
+
parseForESLint: (code) => ({
|
|
831
|
+
ast: {
|
|
832
|
+
body: [],
|
|
833
|
+
comments: [],
|
|
834
|
+
loc: { end: code.length, start: 0 },
|
|
835
|
+
range: [0, code.length],
|
|
836
|
+
tokens: [],
|
|
837
|
+
type: "Program"
|
|
838
|
+
},
|
|
839
|
+
scopeManager: null,
|
|
840
|
+
services: { isPlain: true },
|
|
841
|
+
visitorKeys: {
|
|
842
|
+
Program: []
|
|
843
|
+
}
|
|
844
|
+
})
|
|
845
|
+
};
|
|
846
|
+
async function combine(...configs2) {
|
|
847
|
+
const resolved = await Promise.all(configs2);
|
|
848
|
+
return resolved.flat();
|
|
849
|
+
}
|
|
850
|
+
function renameRules(rules, from, to) {
|
|
851
|
+
return Object.fromEntries(
|
|
852
|
+
Object.entries(rules).map(([key, value]) => {
|
|
853
|
+
if (key.startsWith(from)) {
|
|
854
|
+
return [to + key.slice(from.length), value];
|
|
855
|
+
}
|
|
856
|
+
return [key, value];
|
|
857
|
+
})
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
function toArray(value) {
|
|
861
|
+
return Array.isArray(value) ? value : [value];
|
|
862
|
+
}
|
|
863
|
+
async function interop(m) {
|
|
864
|
+
const resolved = await m;
|
|
865
|
+
return resolved.default || resolved;
|
|
866
|
+
}
|
|
867
|
+
async function ensure(packages) {
|
|
868
|
+
if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false) {
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
;
|
|
872
|
+
const nonExistingPackages = packages.filter((i) => i && !(0, import_local_pkg.isPackageExists)(i));
|
|
873
|
+
if (nonExistingPackages.length === 0) {
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
const p = await import("@clack/prompts");
|
|
877
|
+
const result = await p.confirm({
|
|
878
|
+
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
|
|
879
|
+
});
|
|
880
|
+
if (result) {
|
|
881
|
+
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function resolveSubOptions(options, key) {
|
|
885
|
+
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
886
|
+
}
|
|
887
|
+
function getOverrides(options, key) {
|
|
888
|
+
const sub = resolveSubOptions(options, key);
|
|
889
|
+
return {
|
|
890
|
+
..."overrides" in sub ? sub.overrides : {}
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
|
|
989
894
|
// src/configs/jsdoc.ts
|
|
990
895
|
async function jsdoc(options = {}) {
|
|
991
896
|
const {
|
|
@@ -1207,7 +1112,7 @@ var StylisticConfigDefaults = {
|
|
|
1207
1112
|
async function stylistic(options = {}) {
|
|
1208
1113
|
const {
|
|
1209
1114
|
indent,
|
|
1210
|
-
jsx,
|
|
1115
|
+
jsx: jsx2,
|
|
1211
1116
|
overrides = {},
|
|
1212
1117
|
quotes,
|
|
1213
1118
|
semi
|
|
@@ -1219,7 +1124,7 @@ async function stylistic(options = {}) {
|
|
|
1219
1124
|
const config = pluginStylistic.configs.customize({
|
|
1220
1125
|
flat: true,
|
|
1221
1126
|
indent,
|
|
1222
|
-
jsx,
|
|
1127
|
+
jsx: jsx2,
|
|
1223
1128
|
pluginName: "style",
|
|
1224
1129
|
quotes,
|
|
1225
1130
|
semi
|
|
@@ -1735,11 +1640,13 @@ async function test(options = {}) {
|
|
|
1735
1640
|
name: "luxass/test/rules",
|
|
1736
1641
|
files,
|
|
1737
1642
|
rules: {
|
|
1643
|
+
"node/prefer-global/process": "off",
|
|
1738
1644
|
"test/consistent-test-it": [
|
|
1739
1645
|
"error",
|
|
1740
1646
|
{ fn: "it", withinDescribe: "it" }
|
|
1741
1647
|
],
|
|
1742
1648
|
"test/no-identical-title": "error",
|
|
1649
|
+
"test/no-import-node-test": "error",
|
|
1743
1650
|
"test/no-focused-tests": editor ? "off" : "error",
|
|
1744
1651
|
"test/prefer-hooks-in-order": "error",
|
|
1745
1652
|
"test/prefer-lowercase-title": "error",
|
|
@@ -1802,7 +1709,7 @@ var RemixPackages = [
|
|
|
1802
1709
|
];
|
|
1803
1710
|
async function react(options = {}) {
|
|
1804
1711
|
const {
|
|
1805
|
-
files = [GLOB_TS, GLOB_TSX],
|
|
1712
|
+
files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
|
|
1806
1713
|
overrides = {}
|
|
1807
1714
|
} = options;
|
|
1808
1715
|
await ensure([
|
|
@@ -1947,7 +1854,6 @@ async function astro(options = {}) {
|
|
|
1947
1854
|
const {
|
|
1948
1855
|
files = [GLOB_ASTRO],
|
|
1949
1856
|
overrides = {},
|
|
1950
|
-
typescript: typescript2 = true,
|
|
1951
1857
|
stylistic: stylistic2 = true
|
|
1952
1858
|
} = options;
|
|
1953
1859
|
await ensure([
|
|
@@ -1974,63 +1880,35 @@ async function astro(options = {}) {
|
|
|
1974
1880
|
name: "luxass/astro/rules",
|
|
1975
1881
|
files,
|
|
1976
1882
|
languageOptions: {
|
|
1883
|
+
globals: pluginAstro.environments.astro.globals,
|
|
1977
1884
|
parser: parserAstro,
|
|
1978
1885
|
parserOptions: {
|
|
1979
1886
|
extraFileExtensions: [".astro"],
|
|
1980
|
-
parser:
|
|
1981
|
-
|
|
1982
|
-
|
|
1887
|
+
parser: parserTs
|
|
1888
|
+
},
|
|
1889
|
+
sourceType: "module"
|
|
1983
1890
|
},
|
|
1891
|
+
processor: "astro/client-side-ts",
|
|
1984
1892
|
rules: {
|
|
1985
|
-
|
|
1986
|
-
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-conflict-set-directives/
|
|
1893
|
+
"astro/missing-client-only-directive-value": "error",
|
|
1987
1894
|
"astro/no-conflict-set-directives": "error",
|
|
1988
|
-
|
|
1989
|
-
|
|
1895
|
+
"astro/no-deprecated-astro-canonicalurl": "error",
|
|
1896
|
+
"astro/no-deprecated-astro-fetchcontent": "error",
|
|
1897
|
+
"astro/no-deprecated-astro-resolve": "error",
|
|
1898
|
+
"astro/no-deprecated-getentrybyslug": "error",
|
|
1990
1899
|
"astro/no-set-html-directive": "off",
|
|
1900
|
+
"astro/no-unused-define-vars-in-style": "error",
|
|
1901
|
+
"astro/semi": "off",
|
|
1902
|
+
"astro/valid-compile": "error",
|
|
1991
1903
|
...stylistic2 ? {
|
|
1992
1904
|
"style/indent": "off",
|
|
1993
|
-
"style/jsx-indent": "off",
|
|
1994
1905
|
"style/jsx-closing-tag-location": "off",
|
|
1906
|
+
"style/jsx-indent": "off",
|
|
1995
1907
|
"style/jsx-one-expression-per-line": "off",
|
|
1996
1908
|
"style/no-multiple-empty-lines": "off"
|
|
1997
1909
|
} : {},
|
|
1998
1910
|
...overrides
|
|
1999
1911
|
}
|
|
2000
|
-
},
|
|
2001
|
-
{
|
|
2002
|
-
name: "luxass/astro/scripts-js",
|
|
2003
|
-
files: [
|
|
2004
|
-
"**/*.astro/*.js",
|
|
2005
|
-
"*.astro/*.js"
|
|
2006
|
-
],
|
|
2007
|
-
languageOptions: {
|
|
2008
|
-
globals: {
|
|
2009
|
-
browser: true,
|
|
2010
|
-
es2020: true
|
|
2011
|
-
},
|
|
2012
|
-
parserOptions: {
|
|
2013
|
-
sourceType: "module"
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
},
|
|
2017
|
-
{
|
|
2018
|
-
name: "luxass/astro/scripts-ts",
|
|
2019
|
-
files: [
|
|
2020
|
-
"**/*.astro/*.ts",
|
|
2021
|
-
"*.astro/*.ts"
|
|
2022
|
-
],
|
|
2023
|
-
languageOptions: {
|
|
2024
|
-
globals: {
|
|
2025
|
-
browser: true,
|
|
2026
|
-
es2020: true
|
|
2027
|
-
},
|
|
2028
|
-
parser: typescript2 ? parserTs : null,
|
|
2029
|
-
parserOptions: {
|
|
2030
|
-
project: null,
|
|
2031
|
-
sourceType: "module"
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
1912
|
}
|
|
2035
1913
|
];
|
|
2036
1914
|
}
|
|
@@ -2131,7 +2009,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2131
2009
|
options.dprintOptions || {}
|
|
2132
2010
|
);
|
|
2133
2011
|
const pluginFormat = await interop(import("eslint-plugin-format"));
|
|
2134
|
-
const
|
|
2012
|
+
const configs2 = [
|
|
2135
2013
|
{
|
|
2136
2014
|
name: "luxass/formatter/setup",
|
|
2137
2015
|
plugins: {
|
|
@@ -2140,7 +2018,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2140
2018
|
}
|
|
2141
2019
|
];
|
|
2142
2020
|
if (options.css) {
|
|
2143
|
-
|
|
2021
|
+
configs2.push(
|
|
2144
2022
|
{
|
|
2145
2023
|
name: "luxass/formatter/css",
|
|
2146
2024
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
@@ -2192,7 +2070,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2192
2070
|
);
|
|
2193
2071
|
}
|
|
2194
2072
|
if (options.html) {
|
|
2195
|
-
|
|
2073
|
+
configs2.push({
|
|
2196
2074
|
name: "luxass/formatter/html",
|
|
2197
2075
|
files: [GLOB_HTML],
|
|
2198
2076
|
languageOptions: {
|
|
@@ -2211,7 +2089,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2211
2089
|
}
|
|
2212
2090
|
if (options.markdown) {
|
|
2213
2091
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
2214
|
-
|
|
2092
|
+
configs2.push({
|
|
2215
2093
|
name: "luxass/formatter/markdown",
|
|
2216
2094
|
files: [GLOB_MARKDOWN],
|
|
2217
2095
|
languageOptions: {
|
|
@@ -2234,7 +2112,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2234
2112
|
});
|
|
2235
2113
|
}
|
|
2236
2114
|
if (options.astro) {
|
|
2237
|
-
|
|
2115
|
+
configs2.push({
|
|
2238
2116
|
name: "luxass/formatter/astro",
|
|
2239
2117
|
files: [GLOB_ASTRO],
|
|
2240
2118
|
languageOptions: {
|
|
@@ -2255,7 +2133,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2255
2133
|
});
|
|
2256
2134
|
}
|
|
2257
2135
|
if (options.graphql) {
|
|
2258
|
-
|
|
2136
|
+
configs2.push({
|
|
2259
2137
|
name: "luxass/formatter/graphql",
|
|
2260
2138
|
files: [GLOB_GRAPHQL],
|
|
2261
2139
|
languageOptions: {
|
|
@@ -2272,7 +2150,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2272
2150
|
}
|
|
2273
2151
|
});
|
|
2274
2152
|
}
|
|
2275
|
-
return
|
|
2153
|
+
return configs2;
|
|
2276
2154
|
}
|
|
2277
2155
|
|
|
2278
2156
|
// src/configs/toml.ts
|
|
@@ -2334,78 +2212,44 @@ async function toml(options = {}) {
|
|
|
2334
2212
|
];
|
|
2335
2213
|
}
|
|
2336
2214
|
|
|
2337
|
-
// src/configs/
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
parserTs
|
|
2352
|
-
] = await Promise.all([
|
|
2353
|
-
interop(import("eslint-plugin-solid")),
|
|
2354
|
-
interop(import("@typescript-eslint/parser"))
|
|
2355
|
-
]);
|
|
2215
|
+
// src/configs/regexp.ts
|
|
2216
|
+
var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
2217
|
+
async function regexp(options = {}) {
|
|
2218
|
+
const config = import_eslint_plugin_regexp.configs["flat/recommended"];
|
|
2219
|
+
const rules = {
|
|
2220
|
+
...config.rules
|
|
2221
|
+
};
|
|
2222
|
+
if (options.level === "warn") {
|
|
2223
|
+
for (const key in rules) {
|
|
2224
|
+
if (rules[key] === "error") {
|
|
2225
|
+
rules[key] = "warn";
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2356
2229
|
return [
|
|
2357
2230
|
{
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2231
|
+
...config,
|
|
2232
|
+
name: "luxass/regexp/rules",
|
|
2233
|
+
rules: {
|
|
2234
|
+
...rules,
|
|
2235
|
+
...options.overrides
|
|
2361
2236
|
}
|
|
2362
|
-
}
|
|
2237
|
+
}
|
|
2238
|
+
];
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
// src/configs/jsx.ts
|
|
2242
|
+
async function jsx() {
|
|
2243
|
+
return [
|
|
2363
2244
|
{
|
|
2364
|
-
name: "luxass/
|
|
2365
|
-
files,
|
|
2245
|
+
name: "luxass/jsx/setup",
|
|
2246
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
2366
2247
|
languageOptions: {
|
|
2367
|
-
parser: parserTs,
|
|
2368
2248
|
parserOptions: {
|
|
2369
2249
|
ecmaFeatures: {
|
|
2370
2250
|
jsx: true
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
},
|
|
2374
|
-
sourceType: "module"
|
|
2375
|
-
},
|
|
2376
|
-
rules: {
|
|
2377
|
-
// reactivity
|
|
2378
|
-
"solid/components-return-once": "warn",
|
|
2379
|
-
"solid/event-handlers": ["error", {
|
|
2380
|
-
// if true, don't warn on ambiguously named event handlers like `onclick` or `onchange`
|
|
2381
|
-
ignoreCase: false,
|
|
2382
|
-
// if true, warn when spreading event handlers onto JSX. Enable for Solid < v1.6.
|
|
2383
|
-
warnOnSpread: false
|
|
2384
|
-
}],
|
|
2385
|
-
// these rules are mostly style suggestions
|
|
2386
|
-
"solid/imports": "error",
|
|
2387
|
-
// identifier usage is important
|
|
2388
|
-
"solid/jsx-no-duplicate-props": "error",
|
|
2389
|
-
"solid/jsx-no-script-url": "error",
|
|
2390
|
-
"solid/jsx-no-undef": "error",
|
|
2391
|
-
"solid/jsx-uses-vars": "error",
|
|
2392
|
-
"solid/no-destructure": "error",
|
|
2393
|
-
// security problems
|
|
2394
|
-
"solid/no-innerhtml": ["error", { allowStatic: true }],
|
|
2395
|
-
"solid/no-react-deps": "error",
|
|
2396
|
-
"solid/no-react-specific-props": "error",
|
|
2397
|
-
"solid/no-unknown-namespaces": "error",
|
|
2398
|
-
"solid/prefer-for": "error",
|
|
2399
|
-
"solid/reactivity": "warn",
|
|
2400
|
-
"solid/self-closing-comp": "error",
|
|
2401
|
-
"solid/style-prop": ["error", { styleProps: ["style", "css"] }],
|
|
2402
|
-
...typescript2 ? {
|
|
2403
|
-
"solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
|
|
2404
|
-
// namespaces taken care of by TS
|
|
2405
|
-
"solid/no-unknown-namespaces": "off"
|
|
2406
|
-
} : {},
|
|
2407
|
-
// overrides
|
|
2408
|
-
...overrides
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2409
2253
|
}
|
|
2410
2254
|
}
|
|
2411
2255
|
];
|
|
@@ -2445,32 +2289,34 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2445
2289
|
const {
|
|
2446
2290
|
astro: enableAstro = false,
|
|
2447
2291
|
autoRenamePlugins = true,
|
|
2448
|
-
editor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
|
|
2449
2292
|
exts = [],
|
|
2450
2293
|
gitignore: enableGitignore = true,
|
|
2294
|
+
editor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
|
|
2295
|
+
jsx: enableJsx = true,
|
|
2451
2296
|
react: enableReact = false,
|
|
2452
|
-
|
|
2453
|
-
svelte: enableSvelte = false,
|
|
2454
|
-
solid: enableSolid = false,
|
|
2297
|
+
regexp: enableRegexp = true,
|
|
2455
2298
|
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
2456
2299
|
unocss: enableUnoCSS = false,
|
|
2300
|
+
tailwindcss: enableTailwindCSS = false,
|
|
2457
2301
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
|
|
2458
2302
|
} = options;
|
|
2459
2303
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2460
2304
|
if (stylisticOptions && !("jsx" in stylisticOptions)) {
|
|
2461
|
-
stylisticOptions.jsx =
|
|
2305
|
+
stylisticOptions.jsx = enableJsx;
|
|
2462
2306
|
}
|
|
2463
|
-
const
|
|
2307
|
+
const configs2 = [];
|
|
2464
2308
|
if (enableGitignore) {
|
|
2465
2309
|
if (typeof enableGitignore !== "boolean") {
|
|
2466
|
-
|
|
2310
|
+
configs2.push(interop(import("eslint-config-flat-gitignore")).then((plugin) => [plugin(enableGitignore)]));
|
|
2467
2311
|
} else {
|
|
2468
2312
|
if ((0, import_node_fs.existsSync)(".gitignore")) {
|
|
2469
|
-
|
|
2313
|
+
configs2.push(interop(import("eslint-config-flat-gitignore")).then((plugin) => [plugin()]));
|
|
2470
2314
|
}
|
|
2471
2315
|
}
|
|
2472
2316
|
}
|
|
2473
|
-
|
|
2317
|
+
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2318
|
+
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2319
|
+
configs2.push(
|
|
2474
2320
|
ignores(),
|
|
2475
2321
|
javascript({
|
|
2476
2322
|
editor,
|
|
@@ -2489,53 +2335,43 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2489
2335
|
if (enableVue) {
|
|
2490
2336
|
exts.push("vue");
|
|
2491
2337
|
}
|
|
2338
|
+
if (enableJsx) {
|
|
2339
|
+
configs2.push(jsx());
|
|
2340
|
+
}
|
|
2492
2341
|
if (enableTypeScript) {
|
|
2493
|
-
|
|
2494
|
-
...
|
|
2342
|
+
configs2.push(typescript({
|
|
2343
|
+
...typescriptOptions,
|
|
2495
2344
|
exts,
|
|
2496
2345
|
overrides: getOverrides(options, "typescript")
|
|
2497
2346
|
}));
|
|
2498
2347
|
}
|
|
2499
2348
|
if (stylisticOptions) {
|
|
2500
|
-
|
|
2349
|
+
configs2.push(stylistic({
|
|
2501
2350
|
...stylisticOptions,
|
|
2502
2351
|
overrides: getOverrides(options, "stylistic")
|
|
2503
2352
|
}));
|
|
2504
2353
|
}
|
|
2354
|
+
if (enableRegexp) {
|
|
2355
|
+
configs2.push(regexp({
|
|
2356
|
+
...resolveSubOptions(options, "regexp"),
|
|
2357
|
+
overrides: getOverrides(options, "regexp")
|
|
2358
|
+
}));
|
|
2359
|
+
}
|
|
2505
2360
|
if (options.test ?? true) {
|
|
2506
|
-
|
|
2361
|
+
configs2.push(test({
|
|
2507
2362
|
editor,
|
|
2508
2363
|
overrides: getOverrides(options, "test")
|
|
2509
2364
|
}));
|
|
2510
2365
|
}
|
|
2511
2366
|
if (enableReact) {
|
|
2512
|
-
|
|
2367
|
+
configs2.push(react({
|
|
2513
2368
|
...resolveSubOptions(options, "react"),
|
|
2514
2369
|
overrides: getOverrides(options, "react"),
|
|
2515
|
-
tsconfigPath
|
|
2370
|
+
tsconfigPath
|
|
2516
2371
|
}));
|
|
2517
2372
|
}
|
|
2518
|
-
if (enableSolid) {
|
|
2519
|
-
configs.push(
|
|
2520
|
-
solid({
|
|
2521
|
-
...resolveSubOptions(options, "solid"),
|
|
2522
|
-
overrides: getOverrides(options, "solid"),
|
|
2523
|
-
typescript: !!enableTypeScript
|
|
2524
|
-
})
|
|
2525
|
-
);
|
|
2526
|
-
}
|
|
2527
|
-
if (enableSvelte) {
|
|
2528
|
-
configs.push(
|
|
2529
|
-
svelte({
|
|
2530
|
-
...resolveSubOptions(options, "svelte"),
|
|
2531
|
-
overrides: getOverrides(options, "svelte"),
|
|
2532
|
-
stylistic: stylisticOptions,
|
|
2533
|
-
typescript: !!enableTypeScript
|
|
2534
|
-
})
|
|
2535
|
-
);
|
|
2536
|
-
}
|
|
2537
2373
|
if (enableVue) {
|
|
2538
|
-
|
|
2374
|
+
configs2.push(
|
|
2539
2375
|
vue({
|
|
2540
2376
|
...resolveSubOptions(options, "vue"),
|
|
2541
2377
|
overrides: getOverrides(options, "vue"),
|
|
@@ -2545,28 +2381,27 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2545
2381
|
);
|
|
2546
2382
|
}
|
|
2547
2383
|
if (enableAstro) {
|
|
2548
|
-
|
|
2384
|
+
configs2.push(
|
|
2549
2385
|
astro({
|
|
2550
2386
|
...resolveSubOptions(options, "astro"),
|
|
2551
|
-
overrides: getOverrides(options, "astro")
|
|
2552
|
-
typescript: !!enableTypeScript
|
|
2387
|
+
overrides: getOverrides(options, "astro")
|
|
2553
2388
|
})
|
|
2554
2389
|
);
|
|
2555
2390
|
}
|
|
2556
2391
|
if (enableUnoCSS) {
|
|
2557
|
-
|
|
2392
|
+
configs2.push(unocss({
|
|
2558
2393
|
...resolveSubOptions(options, "unocss"),
|
|
2559
2394
|
overrides: getOverrides(options, "unocss")
|
|
2560
2395
|
}));
|
|
2561
2396
|
}
|
|
2562
2397
|
if (enableTailwindCSS) {
|
|
2563
|
-
|
|
2398
|
+
configs2.push(tailwindcss({
|
|
2564
2399
|
...resolveSubOptions(options, "tailwindcss"),
|
|
2565
2400
|
overrides: getOverrides(options, "tailwindcss")
|
|
2566
2401
|
}));
|
|
2567
2402
|
}
|
|
2568
2403
|
if (options.jsonc ?? true) {
|
|
2569
|
-
|
|
2404
|
+
configs2.push(
|
|
2570
2405
|
jsonc({
|
|
2571
2406
|
overrides: getOverrides(options, "jsonc"),
|
|
2572
2407
|
stylistic: stylisticOptions
|
|
@@ -2576,19 +2411,19 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2576
2411
|
);
|
|
2577
2412
|
}
|
|
2578
2413
|
if (options.yaml ?? true) {
|
|
2579
|
-
|
|
2414
|
+
configs2.push(yaml({
|
|
2580
2415
|
overrides: getOverrides(options, "yaml"),
|
|
2581
2416
|
stylistic: stylisticOptions
|
|
2582
2417
|
}));
|
|
2583
2418
|
}
|
|
2584
2419
|
if (options.toml ?? true) {
|
|
2585
|
-
|
|
2420
|
+
configs2.push(toml({
|
|
2586
2421
|
overrides: getOverrides(options, "toml"),
|
|
2587
2422
|
stylistic: stylisticOptions
|
|
2588
2423
|
}));
|
|
2589
2424
|
}
|
|
2590
2425
|
if (options.markdown ?? true) {
|
|
2591
|
-
|
|
2426
|
+
configs2.push(
|
|
2592
2427
|
markdown({
|
|
2593
2428
|
exts,
|
|
2594
2429
|
overrides: getOverrides(options, "markdown")
|
|
@@ -2596,7 +2431,7 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2596
2431
|
);
|
|
2597
2432
|
}
|
|
2598
2433
|
if (options.formatters) {
|
|
2599
|
-
|
|
2434
|
+
configs2.push(formatters(
|
|
2600
2435
|
options.formatters,
|
|
2601
2436
|
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2602
2437
|
));
|
|
@@ -2608,11 +2443,11 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2608
2443
|
return acc;
|
|
2609
2444
|
}, {});
|
|
2610
2445
|
if (Object.keys(fusedConfig).length) {
|
|
2611
|
-
|
|
2446
|
+
configs2.push([fusedConfig]);
|
|
2612
2447
|
}
|
|
2613
2448
|
let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
|
|
2614
2449
|
composer = composer.append(
|
|
2615
|
-
...
|
|
2450
|
+
...configs2,
|
|
2616
2451
|
...userConfigs
|
|
2617
2452
|
);
|
|
2618
2453
|
if (autoRenamePlugins) {
|
|
@@ -2665,18 +2500,18 @@ var src_default = luxass;
|
|
|
2665
2500
|
javascript,
|
|
2666
2501
|
jsdoc,
|
|
2667
2502
|
jsonc,
|
|
2503
|
+
jsx,
|
|
2668
2504
|
luxass,
|
|
2669
2505
|
markdown,
|
|
2670
2506
|
node,
|
|
2671
2507
|
parserPlain,
|
|
2672
2508
|
react,
|
|
2509
|
+
regexp,
|
|
2673
2510
|
renameRules,
|
|
2674
2511
|
resolveSubOptions,
|
|
2675
|
-
solid,
|
|
2676
2512
|
sortPackageJson,
|
|
2677
2513
|
sortTsconfig,
|
|
2678
2514
|
stylistic,
|
|
2679
|
-
svelte,
|
|
2680
2515
|
tailwindcss,
|
|
2681
2516
|
test,
|
|
2682
2517
|
toArray,
|