@luxass/eslint-config 4.2.5 → 4.2.7
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 +35 -54
- package/dist/index.cjs +166 -479
- package/dist/index.d.cts +733 -12
- package/dist/index.d.ts +733 -12
- package/dist/{configs/index.cjs → index.js} +300 -542
- package/package.json +51 -86
- package/dist/chunk-4YBQZLPS.mjs +0 -68
- package/dist/chunk-4YT54JFZ.mjs +0 -48
- package/dist/chunk-5NK24IKQ.mjs +0 -26
- package/dist/chunk-6T7MXPCT.mjs +0 -17
- package/dist/chunk-7ODEIBF5.mjs +0 -144
- package/dist/chunk-AQRBQAKE.mjs +0 -48
- package/dist/chunk-DAJA5AV3.mjs +0 -29
- package/dist/chunk-DCOLHWHC.mjs +0 -269
- package/dist/chunk-DVQQVCGF.mjs +0 -45
- package/dist/chunk-EHWA727G.mjs +0 -69
- package/dist/chunk-FNOIGW47.mjs +0 -104
- package/dist/chunk-KOXCJL3C.mjs +0 -109
- package/dist/chunk-MMSZW2UW.mjs +0 -92
- package/dist/chunk-MT5P5EKH.mjs +0 -207
- package/dist/chunk-O2BXTQHK.mjs +0 -117
- package/dist/chunk-QDSV5ONX.mjs +0 -93
- package/dist/chunk-QMGT2Z63.mjs +0 -57
- package/dist/chunk-RVSUTDCE.mjs +0 -57
- package/dist/chunk-SPD4DGYN.mjs +0 -274
- package/dist/chunk-UITQW3RA.mjs +0 -293
- package/dist/chunk-V57HXOSW.mjs +0 -81
- package/dist/chunk-WDSV2EFG.mjs +0 -7
- package/dist/chunk-WOBGA3K2.mjs +0 -63
- package/dist/chunk-WSQOWO67.mjs +0 -16
- package/dist/chunk-XBASVDU6.mjs +0 -215
- package/dist/chunk-XPKGXA67.mjs +0 -183
- package/dist/chunk-YGZJUKJC.mjs +0 -0
- package/dist/chunk-YO3IYQ2L.mjs +0 -220
- package/dist/configs/astro.cjs +0 -179
- package/dist/configs/astro.d.cts +0 -11
- package/dist/configs/astro.d.ts +0 -11
- package/dist/configs/astro.mjs +0 -8
- package/dist/configs/comments.cjs +0 -63
- package/dist/configs/comments.d.cts +0 -15
- package/dist/configs/comments.d.ts +0 -15
- package/dist/configs/comments.mjs +0 -6
- package/dist/configs/formatters.cjs +0 -274
- package/dist/configs/formatters.d.cts +0 -11
- package/dist/configs/formatters.d.ts +0 -11
- package/dist/configs/formatters.mjs +0 -9
- package/dist/configs/ignores.cjs +0 -96
- package/dist/configs/ignores.d.cts +0 -15
- package/dist/configs/ignores.d.ts +0 -15
- package/dist/configs/ignores.mjs +0 -7
- package/dist/configs/imports.cjs +0 -104
- package/dist/configs/imports.d.cts +0 -23
- package/dist/configs/imports.d.ts +0 -23
- package/dist/configs/imports.mjs +0 -7
- package/dist/configs/index.d.cts +0 -20
- package/dist/configs/index.d.ts +0 -20
- package/dist/configs/index.mjs +0 -104
- package/dist/configs/javascript.cjs +0 -324
- package/dist/configs/javascript.d.cts +0 -11
- package/dist/configs/javascript.d.ts +0 -11
- package/dist/configs/javascript.mjs +0 -7
- package/dist/configs/jsdoc.cjs +0 -85
- package/dist/configs/jsdoc.d.cts +0 -27
- package/dist/configs/jsdoc.d.ts +0 -27
- package/dist/configs/jsdoc.mjs +0 -7
- package/dist/configs/jsonc.cjs +0 -155
- package/dist/configs/jsonc.d.cts +0 -11
- package/dist/configs/jsonc.d.ts +0 -11
- package/dist/configs/jsonc.mjs +0 -8
- package/dist/configs/markdown.cjs +0 -164
- package/dist/configs/markdown.d.cts +0 -35
- package/dist/configs/markdown.d.ts +0 -35
- package/dist/configs/markdown.mjs +0 -8
- package/dist/configs/nextjs.cjs +0 -180
- package/dist/configs/nextjs.d.cts +0 -11
- package/dist/configs/nextjs.d.ts +0 -11
- package/dist/configs/nextjs.mjs +0 -8
- package/dist/configs/node.cjs +0 -60
- package/dist/configs/node.d.cts +0 -15
- package/dist/configs/node.d.ts +0 -15
- package/dist/configs/node.mjs +0 -6
- package/dist/configs/perfectionist.cjs +0 -51
- package/dist/configs/perfectionist.d.cts +0 -20
- package/dist/configs/perfectionist.d.ts +0 -20
- package/dist/configs/perfectionist.mjs +0 -6
- package/dist/configs/react.cjs +0 -379
- package/dist/configs/react.d.cts +0 -11
- package/dist/configs/react.d.ts +0 -11
- package/dist/configs/react.mjs +0 -8
- package/dist/configs/solid.cjs +0 -360
- package/dist/configs/solid.d.cts +0 -11
- package/dist/configs/solid.d.ts +0 -11
- package/dist/configs/solid.mjs +0 -8
- package/dist/configs/sort.cjs +0 -240
- package/dist/configs/sort.d.cts +0 -26
- package/dist/configs/sort.d.ts +0 -26
- package/dist/configs/sort.mjs +0 -8
- package/dist/configs/stylistic.cjs +0 -98
- package/dist/configs/stylistic.d.cts +0 -11
- package/dist/configs/stylistic.d.ts +0 -11
- package/dist/configs/stylistic.mjs +0 -9
- package/dist/configs/tailwindcss.cjs +0 -148
- package/dist/configs/tailwindcss.d.cts +0 -11
- package/dist/configs/tailwindcss.d.ts +0 -11
- package/dist/configs/tailwindcss.mjs +0 -8
- package/dist/configs/test.cjs +0 -206
- package/dist/configs/test.d.cts +0 -11
- package/dist/configs/test.d.ts +0 -11
- package/dist/configs/test.mjs +0 -9
- package/dist/configs/toml.cjs +0 -131
- package/dist/configs/toml.d.cts +0 -11
- package/dist/configs/toml.d.ts +0 -11
- package/dist/configs/toml.mjs +0 -8
- package/dist/configs/typescript.cjs +0 -291
- package/dist/configs/typescript.d.cts +0 -11
- package/dist/configs/typescript.d.ts +0 -11
- package/dist/configs/typescript.mjs +0 -8
- package/dist/configs/unicorn.cjs +0 -91
- package/dist/configs/unicorn.d.cts +0 -15
- package/dist/configs/unicorn.d.ts +0 -15
- package/dist/configs/unicorn.mjs +0 -6
- package/dist/configs/unocss.cjs +0 -133
- package/dist/configs/unocss.d.cts +0 -11
- package/dist/configs/unocss.d.ts +0 -11
- package/dist/configs/unocss.mjs +0 -8
- package/dist/configs/vue.cjs +0 -293
- package/dist/configs/vue.d.cts +0 -11
- package/dist/configs/vue.d.ts +0 -11
- package/dist/configs/vue.mjs +0 -8
- package/dist/configs/yaml.cjs +0 -143
- package/dist/configs/yaml.d.cts +0 -11
- package/dist/configs/yaml.d.ts +0 -11
- package/dist/configs/yaml.mjs +0 -8
- package/dist/custom-rules/utils.cjs +0 -31
- package/dist/custom-rules/utils.d.cts +0 -6
- package/dist/custom-rules/utils.d.ts +0 -6
- package/dist/custom-rules/utils.mjs +0 -6
- package/dist/globs.cjs +0 -158
- package/dist/globs.d.cts +0 -28
- package/dist/globs.d.ts +0 -28
- package/dist/globs.mjs +0 -56
- package/dist/index.mjs +0 -284
- package/dist/types-HqEzZfQU.d.cts +0 -668
- package/dist/types-HqEzZfQU.d.ts +0 -668
|
@@ -1,71 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/configs/index.ts
|
|
31
|
-
var configs_exports = {};
|
|
32
|
-
__export(configs_exports, {
|
|
33
|
-
astro: () => astro,
|
|
34
|
-
comments: () => comments,
|
|
35
|
-
formatters: () => formatters,
|
|
36
|
-
ignores: () => ignores,
|
|
37
|
-
imports: () => imports,
|
|
38
|
-
javascript: () => javascript,
|
|
39
|
-
jsdoc: () => jsdoc,
|
|
40
|
-
jsonc: () => jsonc,
|
|
41
|
-
markdown: () => markdown,
|
|
42
|
-
nextjs: () => nextjs,
|
|
43
|
-
node: () => node,
|
|
44
|
-
perfectionist: () => perfectionist,
|
|
45
|
-
react: () => react,
|
|
46
|
-
solid: () => solid,
|
|
47
|
-
sortPackageJson: () => sortPackageJson,
|
|
48
|
-
sortTsconfig: () => sortTsconfig,
|
|
49
|
-
stylistic: () => stylistic,
|
|
50
|
-
tailwindcss: () => tailwindcss,
|
|
51
|
-
test: () => test,
|
|
52
|
-
toml: () => toml,
|
|
53
|
-
typescript: () => typescript,
|
|
54
|
-
unicorn: () => unicorn,
|
|
55
|
-
unocss: () => unocss,
|
|
56
|
-
vue: () => vue,
|
|
57
|
-
yaml: () => yaml
|
|
58
|
-
});
|
|
59
|
-
module.exports = __toCommonJS(configs_exports);
|
|
1
|
+
// src/factory.ts
|
|
2
|
+
import process3 from "node:process";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { isPackageExists as isPackageExists3 } from "local-pkg";
|
|
60
5
|
|
|
61
6
|
// src/configs/comments.ts
|
|
62
|
-
|
|
7
|
+
import eslintCommentsPlugin from "@eslint-community/eslint-plugin-eslint-comments";
|
|
63
8
|
async function comments() {
|
|
64
9
|
return [
|
|
65
10
|
{
|
|
66
11
|
name: "luxass:eslint-comments",
|
|
67
12
|
plugins: {
|
|
68
|
-
"eslint-comments":
|
|
13
|
+
"eslint-comments": eslintCommentsPlugin
|
|
69
14
|
},
|
|
70
15
|
rules: {
|
|
71
16
|
// https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/disable-enable-pair.md
|
|
@@ -85,13 +30,13 @@ async function comments() {
|
|
|
85
30
|
}
|
|
86
31
|
|
|
87
32
|
// src/configs/unicorn.ts
|
|
88
|
-
|
|
33
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
89
34
|
function unicorn() {
|
|
90
35
|
return [
|
|
91
36
|
{
|
|
92
37
|
name: "luxass:unicorn",
|
|
93
38
|
plugins: {
|
|
94
|
-
unicorn:
|
|
39
|
+
unicorn: pluginUnicorn
|
|
95
40
|
},
|
|
96
41
|
rules: {
|
|
97
42
|
// Pass error message when throwing errors
|
|
@@ -141,9 +86,11 @@ function unicorn() {
|
|
|
141
86
|
// src/globs.ts
|
|
142
87
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
143
88
|
var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
89
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
144
90
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
145
91
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
146
92
|
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
93
|
+
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
147
94
|
var GLOB_CSS = "**/*.css";
|
|
148
95
|
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
149
96
|
var GLOB_LESS = "**/*.less";
|
|
@@ -156,6 +103,7 @@ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
|
156
103
|
var GLOB_VUE = "**/*.vue";
|
|
157
104
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
158
105
|
var GLOB_TOML = "**/*.toml";
|
|
106
|
+
var GLOB_HTML = "**/*.htm?(l)";
|
|
159
107
|
var GLOB_ASTRO = "**/*.astro";
|
|
160
108
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
161
109
|
var GLOB_TESTS = [
|
|
@@ -226,13 +174,13 @@ function ignores() {
|
|
|
226
174
|
}
|
|
227
175
|
|
|
228
176
|
// src/configs/node.ts
|
|
229
|
-
|
|
177
|
+
import pluginNode from "eslint-plugin-n";
|
|
230
178
|
function node() {
|
|
231
179
|
return [
|
|
232
180
|
{
|
|
233
181
|
name: "luxass:node",
|
|
234
182
|
plugins: {
|
|
235
|
-
node:
|
|
183
|
+
node: pluginNode
|
|
236
184
|
},
|
|
237
185
|
rules: {
|
|
238
186
|
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
@@ -459,23 +407,9 @@ function sortTsconfig() {
|
|
|
459
407
|
];
|
|
460
408
|
}
|
|
461
409
|
|
|
462
|
-
// src/configs/perfectionist.ts
|
|
463
|
-
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
464
|
-
async function perfectionist() {
|
|
465
|
-
return [
|
|
466
|
-
{
|
|
467
|
-
name: "luxass:perfectionist",
|
|
468
|
-
plugins: {
|
|
469
|
-
perfectionist: import_eslint_plugin_perfectionist.default
|
|
470
|
-
},
|
|
471
|
-
rules: {}
|
|
472
|
-
}
|
|
473
|
-
];
|
|
474
|
-
}
|
|
475
|
-
|
|
476
410
|
// src/configs/imports.ts
|
|
477
|
-
|
|
478
|
-
|
|
411
|
+
import pluginImport from "eslint-plugin-i";
|
|
412
|
+
import pluginAntfu from "eslint-plugin-antfu";
|
|
479
413
|
async function imports(options = {}) {
|
|
480
414
|
const {
|
|
481
415
|
stylistic: stylistic2 = true
|
|
@@ -484,8 +418,8 @@ async function imports(options = {}) {
|
|
|
484
418
|
{
|
|
485
419
|
name: "luxass:imports",
|
|
486
420
|
plugins: {
|
|
487
|
-
antfu:
|
|
488
|
-
import:
|
|
421
|
+
antfu: pluginAntfu,
|
|
422
|
+
import: pluginImport
|
|
489
423
|
},
|
|
490
424
|
rules: {
|
|
491
425
|
"antfu/import-dedupe": "error",
|
|
@@ -515,9 +449,9 @@ async function imports(options = {}) {
|
|
|
515
449
|
}
|
|
516
450
|
|
|
517
451
|
// src/configs/javascript.ts
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
452
|
+
import globals from "globals";
|
|
453
|
+
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
454
|
+
import pluginAntfu2 from "eslint-plugin-antfu";
|
|
521
455
|
async function javascript(options = {}) {
|
|
522
456
|
const { editor = false, overrides = {} } = options;
|
|
523
457
|
return [
|
|
@@ -526,9 +460,9 @@ async function javascript(options = {}) {
|
|
|
526
460
|
languageOptions: {
|
|
527
461
|
ecmaVersion: 2022,
|
|
528
462
|
globals: {
|
|
529
|
-
...
|
|
530
|
-
...
|
|
531
|
-
...
|
|
463
|
+
...globals.browser,
|
|
464
|
+
...globals.es2021,
|
|
465
|
+
...globals.node,
|
|
532
466
|
document: "readonly",
|
|
533
467
|
navigator: "readonly",
|
|
534
468
|
window: "readonly"
|
|
@@ -546,8 +480,8 @@ async function javascript(options = {}) {
|
|
|
546
480
|
reportUnusedDisableDirectives: true
|
|
547
481
|
},
|
|
548
482
|
plugins: {
|
|
549
|
-
"antfu":
|
|
550
|
-
"unused-imports":
|
|
483
|
+
"antfu": pluginAntfu2,
|
|
484
|
+
"unused-imports": pluginUnusedImports
|
|
551
485
|
},
|
|
552
486
|
rules: {
|
|
553
487
|
"accessor-pairs": [
|
|
@@ -776,8 +710,12 @@ async function javascript(options = {}) {
|
|
|
776
710
|
}
|
|
777
711
|
|
|
778
712
|
// src/utils.ts
|
|
779
|
-
|
|
780
|
-
|
|
713
|
+
import process from "node:process";
|
|
714
|
+
import { isPackageExists } from "local-pkg";
|
|
715
|
+
async function combine(...configs) {
|
|
716
|
+
const resolved = await Promise.all(configs);
|
|
717
|
+
return resolved.flat();
|
|
718
|
+
}
|
|
781
719
|
function renameRules(rules, from, to) {
|
|
782
720
|
return Object.fromEntries(
|
|
783
721
|
Object.entries(rules).map(([key, value]) => {
|
|
@@ -796,11 +734,11 @@ async function interop(m) {
|
|
|
796
734
|
return resolved.default || resolved;
|
|
797
735
|
}
|
|
798
736
|
async function ensure(packages) {
|
|
799
|
-
if (
|
|
737
|
+
if (process.env.CI || process.stdout.isTTY === false) {
|
|
800
738
|
return;
|
|
801
739
|
}
|
|
802
740
|
;
|
|
803
|
-
const nonExistingPackages = packages.filter((i) => !
|
|
741
|
+
const nonExistingPackages = packages.filter((i) => !isPackageExists(i));
|
|
804
742
|
if (nonExistingPackages.length === 0) {
|
|
805
743
|
return;
|
|
806
744
|
}
|
|
@@ -820,8 +758,17 @@ async function ensure(packages) {
|
|
|
820
758
|
}
|
|
821
759
|
;
|
|
822
760
|
}
|
|
761
|
+
function resolveSubOptions(options, key) {
|
|
762
|
+
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
763
|
+
}
|
|
764
|
+
function getOverrides(options, key) {
|
|
765
|
+
const sub = resolveSubOptions(options, key);
|
|
766
|
+
return {
|
|
767
|
+
..."overrides" in sub ? sub.overrides : {}
|
|
768
|
+
};
|
|
769
|
+
}
|
|
823
770
|
|
|
824
|
-
// src/configs/jsdoc.ts
|
|
771
|
+
// src/configs/docs/jsdoc.ts
|
|
825
772
|
async function jsdoc(options = {}) {
|
|
826
773
|
const {
|
|
827
774
|
overrides,
|
|
@@ -859,7 +806,7 @@ async function jsdoc(options = {}) {
|
|
|
859
806
|
];
|
|
860
807
|
}
|
|
861
808
|
|
|
862
|
-
// src/configs/
|
|
809
|
+
// src/configs/data/json.ts
|
|
863
810
|
async function jsonc(options = {}) {
|
|
864
811
|
const {
|
|
865
812
|
files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
@@ -940,9 +887,9 @@ async function jsonc(options = {}) {
|
|
|
940
887
|
];
|
|
941
888
|
}
|
|
942
889
|
|
|
943
|
-
// src/configs/markdown.ts
|
|
944
|
-
|
|
945
|
-
|
|
890
|
+
// src/configs/docs/markdown.ts
|
|
891
|
+
import * as parserPlain from "eslint-parser-plain";
|
|
892
|
+
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
946
893
|
async function markdown(options = {}) {
|
|
947
894
|
const {
|
|
948
895
|
exts = [],
|
|
@@ -964,9 +911,9 @@ async function markdown(options = {}) {
|
|
|
964
911
|
// `eslint-plugin-markdown` only creates virtual files for code blocks,
|
|
965
912
|
// but not the markdown file itself. We use `eslint-merge-processors` to
|
|
966
913
|
// add a pass-through processor for the markdown file itself.
|
|
967
|
-
processor:
|
|
914
|
+
processor: mergeProcessors([
|
|
968
915
|
markdown2.processors.markdown,
|
|
969
|
-
|
|
916
|
+
processorPassThrough
|
|
970
917
|
])
|
|
971
918
|
},
|
|
972
919
|
{
|
|
@@ -1033,12 +980,12 @@ async function markdown(options = {}) {
|
|
|
1033
980
|
}
|
|
1034
981
|
|
|
1035
982
|
// src/configs/stylistic.ts
|
|
1036
|
-
|
|
983
|
+
import pluginAntfu3 from "eslint-plugin-antfu";
|
|
1037
984
|
var StylisticConfigDefaults = {
|
|
1038
985
|
indent: 2,
|
|
1039
986
|
jsx: true,
|
|
1040
987
|
quotes: "double",
|
|
1041
|
-
semi:
|
|
988
|
+
semi: true
|
|
1042
989
|
};
|
|
1043
990
|
async function stylistic(options = {}) {
|
|
1044
991
|
const {
|
|
@@ -1064,7 +1011,7 @@ async function stylistic(options = {}) {
|
|
|
1064
1011
|
{
|
|
1065
1012
|
name: "luxass:stylistic",
|
|
1066
1013
|
plugins: {
|
|
1067
|
-
antfu:
|
|
1014
|
+
antfu: pluginAntfu3,
|
|
1068
1015
|
style: pluginStylistic
|
|
1069
1016
|
},
|
|
1070
1017
|
rules: {
|
|
@@ -1082,8 +1029,8 @@ async function stylistic(options = {}) {
|
|
|
1082
1029
|
}
|
|
1083
1030
|
|
|
1084
1031
|
// src/configs/typescript.ts
|
|
1085
|
-
|
|
1086
|
-
|
|
1032
|
+
import process2 from "node:process";
|
|
1033
|
+
import pluginAntfu4 from "eslint-plugin-antfu";
|
|
1087
1034
|
async function typescript(options = {}) {
|
|
1088
1035
|
const {
|
|
1089
1036
|
exts = [],
|
|
@@ -1137,7 +1084,7 @@ async function typescript(options = {}) {
|
|
|
1137
1084
|
sourceType: "module",
|
|
1138
1085
|
...typeAware ? {
|
|
1139
1086
|
project: tsconfigPath,
|
|
1140
|
-
tsconfigRootDir:
|
|
1087
|
+
tsconfigRootDir: process2.cwd()
|
|
1141
1088
|
} : {},
|
|
1142
1089
|
...parserOptions
|
|
1143
1090
|
}
|
|
@@ -1149,7 +1096,7 @@ async function typescript(options = {}) {
|
|
|
1149
1096
|
// Install the plugins without globs, so they can be configured separately.
|
|
1150
1097
|
name: "luxass:typescript:setup",
|
|
1151
1098
|
plugins: {
|
|
1152
|
-
antfu:
|
|
1099
|
+
antfu: pluginAntfu4,
|
|
1153
1100
|
ts: pluginTs
|
|
1154
1101
|
}
|
|
1155
1102
|
},
|
|
@@ -1286,28 +1233,22 @@ async function typescript(options = {}) {
|
|
|
1286
1233
|
];
|
|
1287
1234
|
}
|
|
1288
1235
|
|
|
1289
|
-
// src/configs/vue.ts
|
|
1290
|
-
|
|
1236
|
+
// src/configs/frameworks/vue.ts
|
|
1237
|
+
import { mergeProcessors as mergeProcessors2 } from "eslint-merge-processors";
|
|
1291
1238
|
async function vue(options = {}) {
|
|
1292
1239
|
const {
|
|
1293
|
-
a11y = false,
|
|
1294
1240
|
files = [GLOB_VUE],
|
|
1295
1241
|
overrides = {},
|
|
1296
1242
|
stylistic: stylistic2 = true
|
|
1297
1243
|
} = options;
|
|
1298
|
-
if (a11y) {
|
|
1299
|
-
await ensure(["eslint-plugin-vuejs-accessibility"]);
|
|
1300
|
-
}
|
|
1301
1244
|
const [
|
|
1302
1245
|
pluginVue,
|
|
1303
1246
|
parserVue,
|
|
1304
|
-
processorVueBlocks
|
|
1305
|
-
pluginA11y
|
|
1247
|
+
processorVueBlocks
|
|
1306
1248
|
] = await Promise.all([
|
|
1307
1249
|
interop(import("eslint-plugin-vue")),
|
|
1308
1250
|
interop(import("vue-eslint-parser")),
|
|
1309
|
-
interop(import("eslint-processor-vue-blocks"))
|
|
1310
|
-
...a11y ? [interop(import("eslint-plugin-vuejs-accessibility"))] : []
|
|
1251
|
+
interop(import("eslint-processor-vue-blocks"))
|
|
1311
1252
|
]);
|
|
1312
1253
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
1313
1254
|
const {
|
|
@@ -1317,8 +1258,7 @@ async function vue(options = {}) {
|
|
|
1317
1258
|
{
|
|
1318
1259
|
name: "luxass:vue:setup",
|
|
1319
1260
|
plugins: {
|
|
1320
|
-
vue: pluginVue
|
|
1321
|
-
...a11y ? { "vue-a11y": pluginA11y } : {}
|
|
1261
|
+
vue: pluginVue
|
|
1322
1262
|
}
|
|
1323
1263
|
},
|
|
1324
1264
|
{
|
|
@@ -1335,7 +1275,7 @@ async function vue(options = {}) {
|
|
|
1335
1275
|
sourceType: "module"
|
|
1336
1276
|
}
|
|
1337
1277
|
},
|
|
1338
|
-
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : (
|
|
1278
|
+
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors2([
|
|
1339
1279
|
pluginVue.processors[".vue"],
|
|
1340
1280
|
processorVueBlocks({
|
|
1341
1281
|
...sfcBlocks,
|
|
@@ -1454,35 +1394,13 @@ async function vue(options = {}) {
|
|
|
1454
1394
|
"vue/space-in-parens": ["error", "never"],
|
|
1455
1395
|
"vue/template-curly-spacing": "error"
|
|
1456
1396
|
} : {},
|
|
1457
|
-
...a11y ? {
|
|
1458
|
-
"vue-a11y/alt-text": "error",
|
|
1459
|
-
"vue-a11y/anchor-has-content": "error",
|
|
1460
|
-
"vue-a11y/aria-props": "error",
|
|
1461
|
-
"vue-a11y/aria-role": "error",
|
|
1462
|
-
"vue-a11y/aria-unsupported-elements": "error",
|
|
1463
|
-
"vue-a11y/click-events-have-key-events": "error",
|
|
1464
|
-
"vue-a11y/form-control-has-label": "error",
|
|
1465
|
-
"vue-a11y/heading-has-content": "error",
|
|
1466
|
-
"vue-a11y/iframe-has-title": "error",
|
|
1467
|
-
"vue-a11y/interactive-supports-focus": "error",
|
|
1468
|
-
"vue-a11y/label-has-for": "error",
|
|
1469
|
-
"vue-a11y/media-has-caption": "error",
|
|
1470
|
-
"vue-a11y/mouse-events-have-key-events": "error",
|
|
1471
|
-
"vue-a11y/no-access-key": "error",
|
|
1472
|
-
"vue-a11y/no-autofocus": "error",
|
|
1473
|
-
"vue-a11y/no-distracting-elements": "error",
|
|
1474
|
-
"vue-a11y/no-redundant-roles": "error",
|
|
1475
|
-
"vue-a11y/no-static-element-interactions": "error",
|
|
1476
|
-
"vue-a11y/role-has-required-aria-props": "error",
|
|
1477
|
-
"vue-a11y/tabindex-no-positive": "error"
|
|
1478
|
-
} : {},
|
|
1479
1397
|
...overrides
|
|
1480
1398
|
}
|
|
1481
1399
|
}
|
|
1482
1400
|
];
|
|
1483
1401
|
}
|
|
1484
1402
|
|
|
1485
|
-
// src/configs/yaml.ts
|
|
1403
|
+
// src/configs/data/yaml.ts
|
|
1486
1404
|
async function yaml(options = {}) {
|
|
1487
1405
|
const {
|
|
1488
1406
|
files = [GLOB_YAML],
|
|
@@ -1553,98 +1471,6 @@ async function yaml(options = {}) {
|
|
|
1553
1471
|
];
|
|
1554
1472
|
}
|
|
1555
1473
|
|
|
1556
|
-
// src/custom-rules/utils.ts
|
|
1557
|
-
var import_utils8 = require("@typescript-eslint/utils");
|
|
1558
|
-
var createRule = import_utils8.ESLintUtils.RuleCreator((ruleName) => `https://github.com/luxass/eslint-config/blob/main/src/custom-rules/${ruleName}/README.md`);
|
|
1559
|
-
|
|
1560
|
-
// src/custom-rules/no-only-tests/index.ts
|
|
1561
|
-
var DEFAULT_OPTIONS = {
|
|
1562
|
-
blocks: ["describe", "it", "test"],
|
|
1563
|
-
focus: ["only"]
|
|
1564
|
-
};
|
|
1565
|
-
function getPath(node2, path = []) {
|
|
1566
|
-
if (node2) {
|
|
1567
|
-
const nodeName = node2.name || node2.property && node2.property.name;
|
|
1568
|
-
if (node2.object) {
|
|
1569
|
-
return getPath(node2.object, [
|
|
1570
|
-
nodeName,
|
|
1571
|
-
...path
|
|
1572
|
-
]);
|
|
1573
|
-
}
|
|
1574
|
-
if (node2.callee)
|
|
1575
|
-
return getPath(node2.callee, path);
|
|
1576
|
-
return [nodeName, ...path];
|
|
1577
|
-
}
|
|
1578
|
-
return path;
|
|
1579
|
-
}
|
|
1580
|
-
var noOnlyTests = createRule({
|
|
1581
|
-
name: "no-only-tests",
|
|
1582
|
-
create: (context, [options]) => {
|
|
1583
|
-
const {
|
|
1584
|
-
blocks = DEFAULT_OPTIONS.blocks,
|
|
1585
|
-
focus = DEFAULT_OPTIONS.focus
|
|
1586
|
-
} = options;
|
|
1587
|
-
const handler = {
|
|
1588
|
-
Identifier(node2) {
|
|
1589
|
-
const parent = node2.parent?.object;
|
|
1590
|
-
if (!parent)
|
|
1591
|
-
return;
|
|
1592
|
-
if (!focus.includes(node2.name))
|
|
1593
|
-
return;
|
|
1594
|
-
const callPath = getPath(node2.parent).join(".");
|
|
1595
|
-
const found = blocks.find((block) => {
|
|
1596
|
-
if (block.endsWith("*"))
|
|
1597
|
-
return callPath.startsWith(block.replace(/\*$/, ""));
|
|
1598
|
-
return callPath.startsWith(`${block}.`);
|
|
1599
|
-
});
|
|
1600
|
-
if (found) {
|
|
1601
|
-
context.report({
|
|
1602
|
-
data: { block: callPath.split(".")[0], focus: node2.name },
|
|
1603
|
-
messageId: "notPermitted",
|
|
1604
|
-
node: node2
|
|
1605
|
-
});
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
};
|
|
1609
|
-
return handler;
|
|
1610
|
-
},
|
|
1611
|
-
defaultOptions: [{
|
|
1612
|
-
blocks: ["describe", "it", "test"],
|
|
1613
|
-
focus: ["only"]
|
|
1614
|
-
}],
|
|
1615
|
-
meta: {
|
|
1616
|
-
docs: {
|
|
1617
|
-
description: "disallow .only blocks in tests",
|
|
1618
|
-
recommended: "recommended"
|
|
1619
|
-
},
|
|
1620
|
-
messages: {
|
|
1621
|
-
notPermitted: "{{ block }}.{{ focus }} not permitted"
|
|
1622
|
-
},
|
|
1623
|
-
schema: [{
|
|
1624
|
-
additionalProperties: false,
|
|
1625
|
-
properties: {
|
|
1626
|
-
blocks: {
|
|
1627
|
-
items: {
|
|
1628
|
-
type: "string"
|
|
1629
|
-
},
|
|
1630
|
-
type: "array",
|
|
1631
|
-
uniqueItems: true
|
|
1632
|
-
},
|
|
1633
|
-
focus: {
|
|
1634
|
-
items: {
|
|
1635
|
-
type: "string"
|
|
1636
|
-
},
|
|
1637
|
-
type: "array",
|
|
1638
|
-
uniqueItems: true
|
|
1639
|
-
}
|
|
1640
|
-
},
|
|
1641
|
-
type: "object"
|
|
1642
|
-
}],
|
|
1643
|
-
type: "layout"
|
|
1644
|
-
}
|
|
1645
|
-
// i need to have this here, otherwise typechecking fails.
|
|
1646
|
-
});
|
|
1647
|
-
|
|
1648
1474
|
// src/configs/test.ts
|
|
1649
1475
|
async function test(options = {}) {
|
|
1650
1476
|
const {
|
|
@@ -1664,8 +1490,7 @@ async function test(options = {}) {
|
|
|
1664
1490
|
test: {
|
|
1665
1491
|
...pluginVitest,
|
|
1666
1492
|
rules: {
|
|
1667
|
-
...pluginVitest.rules
|
|
1668
|
-
"no-only-tests": noOnlyTests
|
|
1493
|
+
...pluginVitest.rules
|
|
1669
1494
|
}
|
|
1670
1495
|
}
|
|
1671
1496
|
}
|
|
@@ -1679,7 +1504,7 @@ async function test(options = {}) {
|
|
|
1679
1504
|
{ fn: "it", withinDescribe: "it" }
|
|
1680
1505
|
],
|
|
1681
1506
|
"test/no-identical-title": "error",
|
|
1682
|
-
"test/no-
|
|
1507
|
+
"test/no-focused-tests": editor ? "off" : "error",
|
|
1683
1508
|
"test/prefer-hooks-in-order": "error",
|
|
1684
1509
|
"test/prefer-lowercase-title": "error",
|
|
1685
1510
|
...overrides
|
|
@@ -1688,7 +1513,7 @@ async function test(options = {}) {
|
|
|
1688
1513
|
];
|
|
1689
1514
|
}
|
|
1690
1515
|
|
|
1691
|
-
// src/configs/unocss.ts
|
|
1516
|
+
// src/configs/css/unocss.ts
|
|
1692
1517
|
async function unocss(options = {}) {
|
|
1693
1518
|
const {
|
|
1694
1519
|
attributify = true,
|
|
@@ -1725,7 +1550,7 @@ async function unocss(options = {}) {
|
|
|
1725
1550
|
];
|
|
1726
1551
|
}
|
|
1727
1552
|
|
|
1728
|
-
// src/configs/nextjs.ts
|
|
1553
|
+
// src/configs/frameworks/nextjs.ts
|
|
1729
1554
|
async function nextjs(options = {}) {
|
|
1730
1555
|
const {
|
|
1731
1556
|
files = [GLOB_SRC],
|
|
@@ -1804,8 +1629,8 @@ async function nextjs(options = {}) {
|
|
|
1804
1629
|
];
|
|
1805
1630
|
}
|
|
1806
1631
|
|
|
1807
|
-
// src/configs/react.ts
|
|
1808
|
-
|
|
1632
|
+
// src/configs/frameworks/react.ts
|
|
1633
|
+
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
1809
1634
|
async function react(options = {}) {
|
|
1810
1635
|
const {
|
|
1811
1636
|
a11y = false,
|
|
@@ -1830,9 +1655,7 @@ async function react(options = {}) {
|
|
|
1830
1655
|
interop(import("eslint-plugin-react-refresh")),
|
|
1831
1656
|
...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
|
|
1832
1657
|
]);
|
|
1833
|
-
const isAllowConstantExport =
|
|
1834
|
-
(i) => (0, import_local_pkg2.isPackageExists)(i)
|
|
1835
|
-
);
|
|
1658
|
+
const isAllowConstantExport = isPackageExists2("vite");
|
|
1836
1659
|
return [
|
|
1837
1660
|
{
|
|
1838
1661
|
name: "luxass:react:setup",
|
|
@@ -2085,21 +1908,24 @@ async function react(options = {}) {
|
|
|
2085
1908
|
];
|
|
2086
1909
|
}
|
|
2087
1910
|
|
|
2088
|
-
// src/configs/astro.ts
|
|
1911
|
+
// src/configs/frameworks/astro.ts
|
|
2089
1912
|
async function astro(options) {
|
|
2090
1913
|
const {
|
|
2091
1914
|
a11y = false,
|
|
2092
1915
|
files = [GLOB_ASTRO],
|
|
2093
1916
|
overrides = {},
|
|
2094
|
-
typescript: typescript2 = true
|
|
1917
|
+
typescript: typescript2 = true,
|
|
1918
|
+
stylistic: stylistic2 = true
|
|
2095
1919
|
} = options;
|
|
2096
1920
|
const [
|
|
2097
1921
|
pluginAstro,
|
|
2098
1922
|
parserAstro,
|
|
1923
|
+
parserTs,
|
|
2099
1924
|
pluginA11y
|
|
2100
1925
|
] = await Promise.all([
|
|
2101
1926
|
interop(import("eslint-plugin-astro")),
|
|
2102
1927
|
interop(import("astro-eslint-parser")),
|
|
1928
|
+
interop(import("@typescript-eslint/parser")),
|
|
2103
1929
|
...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
|
|
2104
1930
|
]);
|
|
2105
1931
|
return [
|
|
@@ -2114,15 +1940,10 @@ async function astro(options) {
|
|
|
2114
1940
|
name: "luxass:astro:rules",
|
|
2115
1941
|
files,
|
|
2116
1942
|
languageOptions: {
|
|
2117
|
-
globals: {
|
|
2118
|
-
"astro/astro": true,
|
|
2119
|
-
"es2020": true,
|
|
2120
|
-
"node": true
|
|
2121
|
-
},
|
|
2122
1943
|
parser: parserAstro,
|
|
2123
1944
|
parserOptions: {
|
|
2124
1945
|
extraFileExtensions: [".astro"],
|
|
2125
|
-
parser: typescript2 ?
|
|
1946
|
+
parser: typescript2 ? parserTs : null,
|
|
2126
1947
|
sourceType: "module"
|
|
2127
1948
|
}
|
|
2128
1949
|
},
|
|
@@ -2130,28 +1951,16 @@ async function astro(options) {
|
|
|
2130
1951
|
// Disallow conflicting set directives and child contents
|
|
2131
1952
|
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-conflict-set-directives/
|
|
2132
1953
|
"astro/no-conflict-set-directives": "error",
|
|
2133
|
-
// Disallow
|
|
2134
|
-
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-
|
|
2135
|
-
"astro/no-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-deprecated-getentrybyslug/
|
|
2144
|
-
"astro/no-deprecated-getentrybyslug": "error",
|
|
2145
|
-
// Disallow unused define:vars={...} in style tag
|
|
2146
|
-
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-unused-define-vars-in-style/
|
|
2147
|
-
"astro/no-unused-define-vars-in-style": "error",
|
|
2148
|
-
// Disallow warnings when compiling
|
|
2149
|
-
// https://ota-meshi.github.io/eslint-plugin-astro/rules/valid-compile/
|
|
2150
|
-
"astro/valid-compile": "error",
|
|
2151
|
-
"style/jsx-closing-tag-location": "off",
|
|
2152
|
-
"style/jsx-indent": "off",
|
|
2153
|
-
"style/jsx-one-expression-per-line": "off",
|
|
2154
|
-
"style/multiline-ternary": ["error", "never"],
|
|
1954
|
+
// Disallow use of `set:html` directive
|
|
1955
|
+
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-set-html-directive/
|
|
1956
|
+
"astro/no-set-html-directive": "off",
|
|
1957
|
+
...stylistic2 ? {
|
|
1958
|
+
"style/indent": "off",
|
|
1959
|
+
"style/jsx-indent": "off",
|
|
1960
|
+
"style/jsx-closing-tag-location": "off",
|
|
1961
|
+
"style/jsx-one-expression-per-line": "off",
|
|
1962
|
+
"style/no-multiple-empty-lines": "off"
|
|
1963
|
+
} : {},
|
|
2155
1964
|
...overrides
|
|
2156
1965
|
}
|
|
2157
1966
|
},
|
|
@@ -2182,7 +1991,7 @@ async function astro(options) {
|
|
|
2182
1991
|
browser: true,
|
|
2183
1992
|
es2020: true
|
|
2184
1993
|
},
|
|
2185
|
-
parser: typescript2 ?
|
|
1994
|
+
parser: typescript2 ? parserTs : null,
|
|
2186
1995
|
parserOptions: {
|
|
2187
1996
|
project: null,
|
|
2188
1997
|
sourceType: "module"
|
|
@@ -2192,7 +2001,7 @@ async function astro(options) {
|
|
|
2192
2001
|
];
|
|
2193
2002
|
}
|
|
2194
2003
|
|
|
2195
|
-
// src/configs/tailwindcss.ts
|
|
2004
|
+
// src/configs/css/tailwindcss.ts
|
|
2196
2005
|
async function tailwindcss(options = {}) {
|
|
2197
2006
|
const {
|
|
2198
2007
|
files = [GLOB_SRC],
|
|
@@ -2245,7 +2054,7 @@ async function tailwindcss(options = {}) {
|
|
|
2245
2054
|
}
|
|
2246
2055
|
|
|
2247
2056
|
// src/configs/formatters.ts
|
|
2248
|
-
|
|
2057
|
+
import * as parserPlain2 from "eslint-parser-plain";
|
|
2249
2058
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
2250
2059
|
await ensure([
|
|
2251
2060
|
"eslint-plugin-format"
|
|
@@ -2409,7 +2218,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2409
2218
|
return configs;
|
|
2410
2219
|
}
|
|
2411
2220
|
|
|
2412
|
-
// src/configs/toml.ts
|
|
2221
|
+
// src/configs/data/toml.ts
|
|
2413
2222
|
async function toml(options = {}) {
|
|
2414
2223
|
const {
|
|
2415
2224
|
files = [GLOB_TOML],
|
|
@@ -2468,292 +2277,241 @@ async function toml(options = {}) {
|
|
|
2468
2277
|
];
|
|
2469
2278
|
}
|
|
2470
2279
|
|
|
2471
|
-
// src/
|
|
2472
|
-
|
|
2280
|
+
// src/factory.ts
|
|
2281
|
+
var FLAT_CONFIG_PROPS = [
|
|
2282
|
+
"name",
|
|
2283
|
+
"files",
|
|
2284
|
+
"ignores",
|
|
2285
|
+
"languageOptions",
|
|
2286
|
+
"linterOptions",
|
|
2287
|
+
"processor",
|
|
2288
|
+
"plugins",
|
|
2289
|
+
"rules",
|
|
2290
|
+
"settings"
|
|
2291
|
+
];
|
|
2292
|
+
var VuePackages = [
|
|
2293
|
+
"vue",
|
|
2294
|
+
"nuxt",
|
|
2295
|
+
"vitepress",
|
|
2296
|
+
"@slidev/cli"
|
|
2297
|
+
];
|
|
2298
|
+
async function luxass(options = {}, ...userConfigs) {
|
|
2473
2299
|
const {
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2300
|
+
astro: enableAstro = false,
|
|
2301
|
+
editor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI),
|
|
2302
|
+
exts = [],
|
|
2303
|
+
gitignore: enableGitignore = true,
|
|
2304
|
+
nextjs: enableNextJS = false,
|
|
2305
|
+
react: enableReact = false,
|
|
2306
|
+
tailwindcss: enableTailwindCSS = false,
|
|
2307
|
+
typescript: enableTypeScript = isPackageExists3("typescript"),
|
|
2308
|
+
unocss: enableUnoCSS = false,
|
|
2309
|
+
vue: enableVue = VuePackages.some((i) => isPackageExists3(i))
|
|
2478
2310
|
} = options;
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
plugins: {
|
|
2491
|
-
solid: pluginSolid
|
|
2492
|
-
}
|
|
2493
|
-
},
|
|
2494
|
-
{
|
|
2495
|
-
name: "luxass:solid:rules",
|
|
2496
|
-
files,
|
|
2497
|
-
languageOptions: {
|
|
2498
|
-
parserOptions: {
|
|
2499
|
-
ecmaFeatures: {
|
|
2500
|
-
jsx: true
|
|
2501
|
-
}
|
|
2502
|
-
},
|
|
2503
|
-
sourceType: "module"
|
|
2504
|
-
},
|
|
2505
|
-
rules: {
|
|
2506
|
-
...a11y ? {
|
|
2507
|
-
// recommended rules for jsx-a11y
|
|
2508
|
-
"jsx-a11y/alt-text": "error",
|
|
2509
|
-
"jsx-a11y/anchor-ambiguous-text": "off",
|
|
2510
|
-
"jsx-a11y/anchor-has-content": "error",
|
|
2511
|
-
"jsx-a11y/anchor-is-valid": "error",
|
|
2512
|
-
"jsx-a11y/aria-activedescendant-has-tabindex": "error",
|
|
2513
|
-
"jsx-a11y/aria-props": "error",
|
|
2514
|
-
"jsx-a11y/aria-proptypes": "error",
|
|
2515
|
-
"jsx-a11y/aria-role": "error",
|
|
2516
|
-
"jsx-a11y/aria-unsupported-elements": "error",
|
|
2517
|
-
"jsx-a11y/autocomplete-valid": "error",
|
|
2518
|
-
"jsx-a11y/click-events-have-key-events": "error",
|
|
2519
|
-
"jsx-a11y/control-has-associated-label": [
|
|
2520
|
-
"off",
|
|
2521
|
-
{
|
|
2522
|
-
ignoreElements: [
|
|
2523
|
-
"audio",
|
|
2524
|
-
"canvas",
|
|
2525
|
-
"embed",
|
|
2526
|
-
"input",
|
|
2527
|
-
"textarea",
|
|
2528
|
-
"tr",
|
|
2529
|
-
"video"
|
|
2530
|
-
],
|
|
2531
|
-
ignoreRoles: [
|
|
2532
|
-
"grid",
|
|
2533
|
-
"listbox",
|
|
2534
|
-
"menu",
|
|
2535
|
-
"menubar",
|
|
2536
|
-
"radiogroup",
|
|
2537
|
-
"row",
|
|
2538
|
-
"tablist",
|
|
2539
|
-
"toolbar",
|
|
2540
|
-
"tree",
|
|
2541
|
-
"treegrid"
|
|
2542
|
-
],
|
|
2543
|
-
includeRoles: [
|
|
2544
|
-
"alert",
|
|
2545
|
-
"dialog"
|
|
2546
|
-
]
|
|
2547
|
-
}
|
|
2548
|
-
],
|
|
2549
|
-
"jsx-a11y/heading-has-content": "error",
|
|
2550
|
-
"jsx-a11y/html-has-lang": "error",
|
|
2551
|
-
"jsx-a11y/iframe-has-title": "error",
|
|
2552
|
-
"jsx-a11y/img-redundant-alt": "error",
|
|
2553
|
-
"jsx-a11y/interactive-supports-focus": [
|
|
2554
|
-
"error",
|
|
2555
|
-
{
|
|
2556
|
-
tabbable: [
|
|
2557
|
-
"button",
|
|
2558
|
-
"checkbox",
|
|
2559
|
-
"link",
|
|
2560
|
-
"searchbox",
|
|
2561
|
-
"spinbutton",
|
|
2562
|
-
"switch",
|
|
2563
|
-
"textbox"
|
|
2564
|
-
]
|
|
2565
|
-
}
|
|
2566
|
-
],
|
|
2567
|
-
"jsx-a11y/label-has-associated-control": "error",
|
|
2568
|
-
"jsx-a11y/label-has-for": "off",
|
|
2569
|
-
"jsx-a11y/media-has-caption": "error",
|
|
2570
|
-
"jsx-a11y/mouse-events-have-key-events": "error",
|
|
2571
|
-
"jsx-a11y/no-access-key": "error",
|
|
2572
|
-
"jsx-a11y/no-autofocus": "error",
|
|
2573
|
-
"jsx-a11y/no-distracting-elements": "error",
|
|
2574
|
-
"jsx-a11y/no-interactive-element-to-noninteractive-role": [
|
|
2575
|
-
"error",
|
|
2576
|
-
{
|
|
2577
|
-
canvas: [
|
|
2578
|
-
"img"
|
|
2579
|
-
],
|
|
2580
|
-
tr: [
|
|
2581
|
-
"none",
|
|
2582
|
-
"presentation"
|
|
2583
|
-
]
|
|
2584
|
-
}
|
|
2585
|
-
],
|
|
2586
|
-
"jsx-a11y/no-noninteractive-element-interactions": [
|
|
2587
|
-
"error",
|
|
2588
|
-
{
|
|
2589
|
-
alert: [
|
|
2590
|
-
"onKeyUp",
|
|
2591
|
-
"onKeyDown",
|
|
2592
|
-
"onKeyPress"
|
|
2593
|
-
],
|
|
2594
|
-
body: [
|
|
2595
|
-
"onError",
|
|
2596
|
-
"onLoad"
|
|
2597
|
-
],
|
|
2598
|
-
dialog: [
|
|
2599
|
-
"onKeyUp",
|
|
2600
|
-
"onKeyDown",
|
|
2601
|
-
"onKeyPress"
|
|
2602
|
-
],
|
|
2603
|
-
handlers: [
|
|
2604
|
-
"onClick",
|
|
2605
|
-
"onError",
|
|
2606
|
-
"onLoad",
|
|
2607
|
-
"onMouseDown",
|
|
2608
|
-
"onMouseUp",
|
|
2609
|
-
"onKeyPress",
|
|
2610
|
-
"onKeyDown",
|
|
2611
|
-
"onKeyUp"
|
|
2612
|
-
],
|
|
2613
|
-
iframe: [
|
|
2614
|
-
"onError",
|
|
2615
|
-
"onLoad"
|
|
2616
|
-
],
|
|
2617
|
-
img: [
|
|
2618
|
-
"onError",
|
|
2619
|
-
"onLoad"
|
|
2620
|
-
]
|
|
2621
|
-
}
|
|
2622
|
-
],
|
|
2623
|
-
"jsx-a11y/no-noninteractive-element-to-interactive-role": [
|
|
2624
|
-
"error",
|
|
2625
|
-
{
|
|
2626
|
-
fieldset: [
|
|
2627
|
-
"radiogroup",
|
|
2628
|
-
"presentation"
|
|
2629
|
-
],
|
|
2630
|
-
li: [
|
|
2631
|
-
"menuitem",
|
|
2632
|
-
"option",
|
|
2633
|
-
"row",
|
|
2634
|
-
"tab",
|
|
2635
|
-
"treeitem"
|
|
2636
|
-
],
|
|
2637
|
-
ol: [
|
|
2638
|
-
"listbox",
|
|
2639
|
-
"menu",
|
|
2640
|
-
"menubar",
|
|
2641
|
-
"radiogroup",
|
|
2642
|
-
"tablist",
|
|
2643
|
-
"tree",
|
|
2644
|
-
"treegrid"
|
|
2645
|
-
],
|
|
2646
|
-
table: [
|
|
2647
|
-
"grid"
|
|
2648
|
-
],
|
|
2649
|
-
td: [
|
|
2650
|
-
"gridcell"
|
|
2651
|
-
],
|
|
2652
|
-
ul: [
|
|
2653
|
-
"listbox",
|
|
2654
|
-
"menu",
|
|
2655
|
-
"menubar",
|
|
2656
|
-
"radiogroup",
|
|
2657
|
-
"tablist",
|
|
2658
|
-
"tree",
|
|
2659
|
-
"treegrid"
|
|
2660
|
-
]
|
|
2661
|
-
}
|
|
2662
|
-
],
|
|
2663
|
-
"jsx-a11y/no-noninteractive-tabindex": [
|
|
2664
|
-
"error",
|
|
2665
|
-
{
|
|
2666
|
-
allowExpressionValues: true,
|
|
2667
|
-
roles: [
|
|
2668
|
-
"tabpanel"
|
|
2669
|
-
],
|
|
2670
|
-
tags: []
|
|
2671
|
-
}
|
|
2672
|
-
],
|
|
2673
|
-
"jsx-a11y/no-redundant-roles": "error",
|
|
2674
|
-
"jsx-a11y/no-static-element-interactions": [
|
|
2675
|
-
"error",
|
|
2676
|
-
{
|
|
2677
|
-
allowExpressionValues: true,
|
|
2678
|
-
handlers: [
|
|
2679
|
-
"onClick",
|
|
2680
|
-
"onMouseDown",
|
|
2681
|
-
"onMouseUp",
|
|
2682
|
-
"onKeyPress",
|
|
2683
|
-
"onKeyDown",
|
|
2684
|
-
"onKeyUp"
|
|
2685
|
-
]
|
|
2686
|
-
}
|
|
2687
|
-
],
|
|
2688
|
-
"jsx-a11y/role-has-required-aria-props": "error",
|
|
2689
|
-
"jsx-a11y/role-supports-aria-props": "error",
|
|
2690
|
-
"jsx-a11y/scope": "error",
|
|
2691
|
-
"jsx-a11y/tabindex-no-positive": "error"
|
|
2692
|
-
} : {},
|
|
2693
|
-
// solid recommended rules
|
|
2694
|
-
// reactivity
|
|
2695
|
-
"solid/components-return-once": 1,
|
|
2696
|
-
"solid/event-handlers": 1,
|
|
2697
|
-
// these rules are mostly style suggestions
|
|
2698
|
-
"solid/imports": 1,
|
|
2699
|
-
// identifier usage is important
|
|
2700
|
-
"solid/jsx-no-duplicate-props": 2,
|
|
2701
|
-
"solid/jsx-no-script-url": 2,
|
|
2702
|
-
"solid/jsx-no-undef": 2,
|
|
2703
|
-
"solid/jsx-uses-vars": 2,
|
|
2704
|
-
"solid/no-array-handlers": 0,
|
|
2705
|
-
"solid/no-destructure": 2,
|
|
2706
|
-
// security problems
|
|
2707
|
-
"solid/no-innerhtml": 2,
|
|
2708
|
-
// only necessary for resource-constrained environments
|
|
2709
|
-
"solid/no-proxy-apis": 0,
|
|
2710
|
-
"solid/no-react-deps": 1,
|
|
2711
|
-
"solid/no-react-specific-props": 1,
|
|
2712
|
-
"solid/no-unknown-namespaces": 2,
|
|
2713
|
-
// deprecated
|
|
2714
|
-
"solid/prefer-classlist": 0,
|
|
2715
|
-
"solid/prefer-for": 2,
|
|
2716
|
-
// handled by Solid compiler, opt-in style suggestion
|
|
2717
|
-
"solid/prefer-show": 0,
|
|
2718
|
-
"solid/reactivity": 1,
|
|
2719
|
-
"solid/self-closing-comp": 1,
|
|
2720
|
-
"solid/style-prop": 1,
|
|
2721
|
-
...typescript2 ? {
|
|
2722
|
-
"solid/jsx-no-undef": [2, { typescriptEnabled: true }],
|
|
2723
|
-
// namespaces taken care of by TS
|
|
2724
|
-
"solid/no-unknown-namespaces": 0
|
|
2725
|
-
} : {},
|
|
2726
|
-
// overrides
|
|
2727
|
-
...overrides
|
|
2311
|
+
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2312
|
+
if (stylisticOptions && !("jsx" in stylisticOptions)) {
|
|
2313
|
+
stylisticOptions.jsx = options.jsx ?? true;
|
|
2314
|
+
}
|
|
2315
|
+
const configs = [];
|
|
2316
|
+
if (enableGitignore) {
|
|
2317
|
+
if (typeof enableGitignore !== "boolean") {
|
|
2318
|
+
configs.push(interop(import("eslint-config-flat-gitignore")).then((plugin) => [plugin(enableGitignore)]));
|
|
2319
|
+
} else {
|
|
2320
|
+
if (existsSync(".gitignore")) {
|
|
2321
|
+
configs.push(interop(import("eslint-config-flat-gitignore")).then((plugin) => [plugin()]));
|
|
2728
2322
|
}
|
|
2729
2323
|
}
|
|
2730
|
-
|
|
2324
|
+
}
|
|
2325
|
+
configs.push(
|
|
2326
|
+
ignores(),
|
|
2327
|
+
javascript({
|
|
2328
|
+
editor,
|
|
2329
|
+
overrides: getOverrides(options, "javascript")
|
|
2330
|
+
}),
|
|
2331
|
+
comments(),
|
|
2332
|
+
node(),
|
|
2333
|
+
jsdoc({
|
|
2334
|
+
stylistic: stylisticOptions
|
|
2335
|
+
}),
|
|
2336
|
+
imports({
|
|
2337
|
+
stylistic: stylisticOptions
|
|
2338
|
+
}),
|
|
2339
|
+
unicorn()
|
|
2340
|
+
);
|
|
2341
|
+
if (enableVue) {
|
|
2342
|
+
exts.push("vue");
|
|
2343
|
+
}
|
|
2344
|
+
if (enableTypeScript) {
|
|
2345
|
+
configs.push(typescript({
|
|
2346
|
+
...resolveSubOptions(options, "typescript"),
|
|
2347
|
+
exts,
|
|
2348
|
+
overrides: getOverrides(options, "typescript")
|
|
2349
|
+
}));
|
|
2350
|
+
}
|
|
2351
|
+
if (stylisticOptions) {
|
|
2352
|
+
configs.push(stylistic({
|
|
2353
|
+
...stylisticOptions,
|
|
2354
|
+
overrides: getOverrides(options, "stylistic")
|
|
2355
|
+
}));
|
|
2356
|
+
}
|
|
2357
|
+
if (options.test ?? true) {
|
|
2358
|
+
configs.push(test({
|
|
2359
|
+
editor,
|
|
2360
|
+
overrides: getOverrides(options, "test")
|
|
2361
|
+
}));
|
|
2362
|
+
}
|
|
2363
|
+
if (enableReact || enableNextJS) {
|
|
2364
|
+
configs.push(react({
|
|
2365
|
+
overrides: getOverrides(options, "react"),
|
|
2366
|
+
typescript: !!enableTypeScript
|
|
2367
|
+
}));
|
|
2368
|
+
}
|
|
2369
|
+
if (enableNextJS) {
|
|
2370
|
+
configs.push(
|
|
2371
|
+
nextjs({
|
|
2372
|
+
...resolveSubOptions(options, "nextjs"),
|
|
2373
|
+
overrides: getOverrides(options, "nextjs")
|
|
2374
|
+
})
|
|
2375
|
+
);
|
|
2376
|
+
}
|
|
2377
|
+
if (enableVue) {
|
|
2378
|
+
configs.push(
|
|
2379
|
+
vue({
|
|
2380
|
+
...resolveSubOptions(options, "vue"),
|
|
2381
|
+
overrides: getOverrides(options, "vue"),
|
|
2382
|
+
stylistic: stylisticOptions,
|
|
2383
|
+
typescript: !!enableTypeScript
|
|
2384
|
+
})
|
|
2385
|
+
);
|
|
2386
|
+
}
|
|
2387
|
+
if (enableAstro) {
|
|
2388
|
+
configs.push(
|
|
2389
|
+
astro({
|
|
2390
|
+
...resolveSubOptions(options, "astro"),
|
|
2391
|
+
overrides: getOverrides(options, "astro"),
|
|
2392
|
+
typescript: !!enableTypeScript
|
|
2393
|
+
})
|
|
2394
|
+
);
|
|
2395
|
+
}
|
|
2396
|
+
if (enableUnoCSS) {
|
|
2397
|
+
configs.push(unocss({
|
|
2398
|
+
...resolveSubOptions(options, "unocss"),
|
|
2399
|
+
overrides: getOverrides(options, "unocss")
|
|
2400
|
+
}));
|
|
2401
|
+
}
|
|
2402
|
+
if (enableTailwindCSS) {
|
|
2403
|
+
configs.push(tailwindcss({
|
|
2404
|
+
...resolveSubOptions(options, "tailwindcss"),
|
|
2405
|
+
overrides: getOverrides(options, "tailwindcss")
|
|
2406
|
+
}));
|
|
2407
|
+
}
|
|
2408
|
+
if (options.jsonc ?? true) {
|
|
2409
|
+
configs.push(
|
|
2410
|
+
jsonc({
|
|
2411
|
+
overrides: getOverrides(options, "jsonc"),
|
|
2412
|
+
stylistic: stylisticOptions
|
|
2413
|
+
}),
|
|
2414
|
+
sortPackageJson(),
|
|
2415
|
+
sortTsconfig()
|
|
2416
|
+
);
|
|
2417
|
+
}
|
|
2418
|
+
if (options.yaml ?? true) {
|
|
2419
|
+
configs.push(yaml({
|
|
2420
|
+
overrides: getOverrides(options, "yaml"),
|
|
2421
|
+
stylistic: stylisticOptions
|
|
2422
|
+
}));
|
|
2423
|
+
}
|
|
2424
|
+
if (options.toml ?? true) {
|
|
2425
|
+
configs.push(toml({
|
|
2426
|
+
overrides: getOverrides(options, "toml"),
|
|
2427
|
+
stylistic: stylisticOptions
|
|
2428
|
+
}));
|
|
2429
|
+
}
|
|
2430
|
+
if (options.markdown ?? true) {
|
|
2431
|
+
configs.push(
|
|
2432
|
+
markdown({
|
|
2433
|
+
exts,
|
|
2434
|
+
overrides: getOverrides(options, "markdown")
|
|
2435
|
+
})
|
|
2436
|
+
);
|
|
2437
|
+
}
|
|
2438
|
+
if (options.formatters) {
|
|
2439
|
+
configs.push(formatters(
|
|
2440
|
+
options.formatters,
|
|
2441
|
+
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2442
|
+
));
|
|
2443
|
+
}
|
|
2444
|
+
const fusedConfig = FLAT_CONFIG_PROPS.reduce((acc, key) => {
|
|
2445
|
+
if (key in options) {
|
|
2446
|
+
acc[key] = options[key];
|
|
2447
|
+
}
|
|
2448
|
+
return acc;
|
|
2449
|
+
}, {});
|
|
2450
|
+
if (Object.keys(fusedConfig).length) {
|
|
2451
|
+
configs.push([fusedConfig]);
|
|
2452
|
+
}
|
|
2453
|
+
const merged = combine(
|
|
2454
|
+
...configs,
|
|
2455
|
+
...userConfigs
|
|
2456
|
+
);
|
|
2457
|
+
return merged;
|
|
2731
2458
|
}
|
|
2732
|
-
|
|
2733
|
-
|
|
2459
|
+
export {
|
|
2460
|
+
GLOB_ASTRO,
|
|
2461
|
+
GLOB_CSS,
|
|
2462
|
+
GLOB_EXCLUDE,
|
|
2463
|
+
GLOB_HTML,
|
|
2464
|
+
GLOB_JS,
|
|
2465
|
+
GLOB_JSON,
|
|
2466
|
+
GLOB_JSON5,
|
|
2467
|
+
GLOB_JSONC,
|
|
2468
|
+
GLOB_JSX,
|
|
2469
|
+
GLOB_LESS,
|
|
2470
|
+
GLOB_MARKDOWN,
|
|
2471
|
+
GLOB_MARKDOWN_CODE,
|
|
2472
|
+
GLOB_MARKDOWN_IN_MARKDOWN,
|
|
2473
|
+
GLOB_NEXTJS_OG,
|
|
2474
|
+
GLOB_NEXTJS_ROUTES,
|
|
2475
|
+
GLOB_POSTCSS,
|
|
2476
|
+
GLOB_SCSS,
|
|
2477
|
+
GLOB_SRC,
|
|
2478
|
+
GLOB_SRC_EXT,
|
|
2479
|
+
GLOB_STYLE,
|
|
2480
|
+
GLOB_TESTS,
|
|
2481
|
+
GLOB_TOML,
|
|
2482
|
+
GLOB_TS,
|
|
2483
|
+
GLOB_TSX,
|
|
2484
|
+
GLOB_VUE,
|
|
2485
|
+
GLOB_YAML,
|
|
2734
2486
|
astro,
|
|
2487
|
+
combine,
|
|
2735
2488
|
comments,
|
|
2489
|
+
ensure,
|
|
2736
2490
|
formatters,
|
|
2491
|
+
getOverrides,
|
|
2737
2492
|
ignores,
|
|
2738
2493
|
imports,
|
|
2494
|
+
interop,
|
|
2739
2495
|
javascript,
|
|
2740
2496
|
jsdoc,
|
|
2741
2497
|
jsonc,
|
|
2498
|
+
luxass,
|
|
2742
2499
|
markdown,
|
|
2743
2500
|
nextjs,
|
|
2744
2501
|
node,
|
|
2745
|
-
perfectionist,
|
|
2746
2502
|
react,
|
|
2747
|
-
|
|
2503
|
+
renameRules,
|
|
2504
|
+
resolveSubOptions,
|
|
2748
2505
|
sortPackageJson,
|
|
2749
2506
|
sortTsconfig,
|
|
2750
2507
|
stylistic,
|
|
2751
2508
|
tailwindcss,
|
|
2752
2509
|
test,
|
|
2510
|
+
toArray,
|
|
2753
2511
|
toml,
|
|
2754
2512
|
typescript,
|
|
2755
2513
|
unicorn,
|
|
2756
2514
|
unocss,
|
|
2757
2515
|
vue,
|
|
2758
2516
|
yaml
|
|
2759
|
-
}
|
|
2517
|
+
};
|