@luxass/eslint-config 4.2.6 → 4.2.8
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 -5
- package/dist/index.cjs +165 -446
- package/dist/index.d.cts +733 -12
- package/dist/index.d.ts +733 -12
- package/dist/{configs/index.cjs → index.js} +308 -516
- package/package.json +51 -85
- package/dist/chunk-2IR43M6N.mjs +0 -48
- package/dist/chunk-47ISSTHW.mjs +0 -291
- package/dist/chunk-4YBQZLPS.mjs +0 -68
- package/dist/chunk-4YT54JFZ.mjs +0 -48
- package/dist/chunk-5NK24IKQ.mjs +0 -26
- package/dist/chunk-AJS3TMZE.mjs +0 -63
- package/dist/chunk-C6FE5KXJ.mjs +0 -104
- package/dist/chunk-DAJA5AV3.mjs +0 -29
- package/dist/chunk-DCOLHWHC.mjs +0 -269
- package/dist/chunk-E4RVBKZB.mjs +0 -207
- package/dist/chunk-HZNHG5PB.mjs +0 -45
- package/dist/chunk-KOXCJL3C.mjs +0 -109
- package/dist/chunk-PFCAWBCD.mjs +0 -93
- package/dist/chunk-PFYV2TWZ.mjs +0 -117
- package/dist/chunk-QT6FHTFU.mjs +0 -92
- package/dist/chunk-RDZJT36Z.mjs +0 -57
- package/dist/chunk-RVSUTDCE.mjs +0 -57
- package/dist/chunk-TWAETZPX.mjs +0 -149
- package/dist/chunk-WSQOWO67.mjs +0 -16
- package/dist/chunk-XBASVDU6.mjs +0 -215
- package/dist/chunk-XD3UVRU7.mjs +0 -274
- package/dist/chunk-XGI647GZ.mjs +0 -81
- package/dist/chunk-XMXYE5WC.mjs +0 -183
- package/dist/chunk-YNMFVYL6.mjs +0 -69
- package/dist/chunk-YO3IYQ2L.mjs +0 -220
- package/dist/chunk-YZCJUX6Z.mjs +0 -0
- 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/css/tailwindcss.cjs +0 -148
- package/dist/configs/css/tailwindcss.d.cts +0 -11
- package/dist/configs/css/tailwindcss.d.ts +0 -11
- package/dist/configs/css/tailwindcss.mjs +0 -8
- package/dist/configs/css/unocss.cjs +0 -133
- package/dist/configs/css/unocss.d.cts +0 -11
- package/dist/configs/css/unocss.d.ts +0 -11
- package/dist/configs/css/unocss.mjs +0 -8
- package/dist/configs/data/json.cjs +0 -155
- package/dist/configs/data/json.d.cts +0 -11
- package/dist/configs/data/json.d.ts +0 -11
- package/dist/configs/data/json.mjs +0 -8
- package/dist/configs/data/toml.cjs +0 -131
- package/dist/configs/data/toml.d.cts +0 -11
- package/dist/configs/data/toml.d.ts +0 -11
- package/dist/configs/data/toml.mjs +0 -8
- package/dist/configs/data/yaml.cjs +0 -143
- package/dist/configs/data/yaml.d.cts +0 -11
- package/dist/configs/data/yaml.d.ts +0 -11
- package/dist/configs/data/yaml.mjs +0 -8
- package/dist/configs/docs/jsdoc.cjs +0 -85
- package/dist/configs/docs/jsdoc.d.cts +0 -27
- package/dist/configs/docs/jsdoc.d.ts +0 -27
- package/dist/configs/docs/jsdoc.mjs +0 -7
- package/dist/configs/docs/markdown.cjs +0 -164
- package/dist/configs/docs/markdown.d.cts +0 -35
- package/dist/configs/docs/markdown.d.ts +0 -35
- package/dist/configs/docs/markdown.mjs +0 -8
- 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/frameworks/astro.cjs +0 -179
- package/dist/configs/frameworks/astro.d.cts +0 -11
- package/dist/configs/frameworks/astro.d.ts +0 -11
- package/dist/configs/frameworks/astro.mjs +0 -8
- package/dist/configs/frameworks/nextjs.cjs +0 -180
- package/dist/configs/frameworks/nextjs.d.cts +0 -11
- package/dist/configs/frameworks/nextjs.d.ts +0 -11
- package/dist/configs/frameworks/nextjs.mjs +0 -8
- package/dist/configs/frameworks/react.cjs +0 -377
- package/dist/configs/frameworks/react.d.cts +0 -11
- package/dist/configs/frameworks/react.d.ts +0 -11
- package/dist/configs/frameworks/react.mjs +0 -8
- package/dist/configs/frameworks/solid.cjs +0 -360
- package/dist/configs/frameworks/solid.d.cts +0 -11
- package/dist/configs/frameworks/solid.d.ts +0 -11
- package/dist/configs/frameworks/solid.mjs +0 -8
- package/dist/configs/frameworks/vue.cjs +0 -293
- package/dist/configs/frameworks/vue.d.cts +0 -11
- package/dist/configs/frameworks/vue.d.ts +0 -11
- package/dist/configs/frameworks/vue.mjs +0 -8
- 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 -19
- package/dist/configs/index.d.ts +0 -19
- package/dist/configs/index.mjs +0 -99
- 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/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/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/test.cjs +0 -210
- package/dist/configs/test.d.cts +0 -11
- package/dist/configs/test.d.ts +0 -11
- package/dist/configs/test.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/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 -278
- package/dist/types-HqEzZfQU.d.cts +0 -668
- package/dist/types-HqEzZfQU.d.ts +0 -668
|
@@ -1,70 +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
|
-
react: () => react,
|
|
45
|
-
solid: () => solid,
|
|
46
|
-
sortPackageJson: () => sortPackageJson,
|
|
47
|
-
sortTsconfig: () => sortTsconfig,
|
|
48
|
-
stylistic: () => stylistic,
|
|
49
|
-
tailwindcss: () => tailwindcss,
|
|
50
|
-
test: () => test,
|
|
51
|
-
toml: () => toml,
|
|
52
|
-
typescript: () => typescript,
|
|
53
|
-
unicorn: () => unicorn,
|
|
54
|
-
unocss: () => unocss,
|
|
55
|
-
vue: () => vue,
|
|
56
|
-
yaml: () => yaml
|
|
57
|
-
});
|
|
58
|
-
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";
|
|
59
5
|
|
|
60
6
|
// src/configs/comments.ts
|
|
61
|
-
|
|
7
|
+
import eslintCommentsPlugin from "@eslint-community/eslint-plugin-eslint-comments";
|
|
62
8
|
async function comments() {
|
|
63
9
|
return [
|
|
64
10
|
{
|
|
65
11
|
name: "luxass:eslint-comments",
|
|
66
12
|
plugins: {
|
|
67
|
-
"eslint-comments":
|
|
13
|
+
"eslint-comments": eslintCommentsPlugin
|
|
68
14
|
},
|
|
69
15
|
rules: {
|
|
70
16
|
// https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/disable-enable-pair.md
|
|
@@ -84,13 +30,13 @@ async function comments() {
|
|
|
84
30
|
}
|
|
85
31
|
|
|
86
32
|
// src/configs/unicorn.ts
|
|
87
|
-
|
|
33
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
88
34
|
function unicorn() {
|
|
89
35
|
return [
|
|
90
36
|
{
|
|
91
37
|
name: "luxass:unicorn",
|
|
92
38
|
plugins: {
|
|
93
|
-
unicorn:
|
|
39
|
+
unicorn: pluginUnicorn
|
|
94
40
|
},
|
|
95
41
|
rules: {
|
|
96
42
|
// Pass error message when throwing errors
|
|
@@ -140,9 +86,11 @@ function unicorn() {
|
|
|
140
86
|
// src/globs.ts
|
|
141
87
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
142
88
|
var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
89
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
143
90
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
144
91
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
145
92
|
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
93
|
+
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
146
94
|
var GLOB_CSS = "**/*.css";
|
|
147
95
|
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
148
96
|
var GLOB_LESS = "**/*.less";
|
|
@@ -155,6 +103,7 @@ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
|
155
103
|
var GLOB_VUE = "**/*.vue";
|
|
156
104
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
157
105
|
var GLOB_TOML = "**/*.toml";
|
|
106
|
+
var GLOB_HTML = "**/*.htm?(l)";
|
|
158
107
|
var GLOB_ASTRO = "**/*.astro";
|
|
159
108
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
160
109
|
var GLOB_TESTS = [
|
|
@@ -225,13 +174,13 @@ function ignores() {
|
|
|
225
174
|
}
|
|
226
175
|
|
|
227
176
|
// src/configs/node.ts
|
|
228
|
-
|
|
177
|
+
import pluginNode from "eslint-plugin-n";
|
|
229
178
|
function node() {
|
|
230
179
|
return [
|
|
231
180
|
{
|
|
232
181
|
name: "luxass:node",
|
|
233
182
|
plugins: {
|
|
234
|
-
node:
|
|
183
|
+
node: pluginNode
|
|
235
184
|
},
|
|
236
185
|
rules: {
|
|
237
186
|
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
@@ -459,8 +408,8 @@ function sortTsconfig() {
|
|
|
459
408
|
}
|
|
460
409
|
|
|
461
410
|
// src/configs/imports.ts
|
|
462
|
-
|
|
463
|
-
|
|
411
|
+
import pluginImport from "eslint-plugin-i";
|
|
412
|
+
import pluginAntfu from "eslint-plugin-antfu";
|
|
464
413
|
async function imports(options = {}) {
|
|
465
414
|
const {
|
|
466
415
|
stylistic: stylistic2 = true
|
|
@@ -469,8 +418,8 @@ async function imports(options = {}) {
|
|
|
469
418
|
{
|
|
470
419
|
name: "luxass:imports",
|
|
471
420
|
plugins: {
|
|
472
|
-
antfu:
|
|
473
|
-
import:
|
|
421
|
+
antfu: pluginAntfu,
|
|
422
|
+
import: pluginImport
|
|
474
423
|
},
|
|
475
424
|
rules: {
|
|
476
425
|
"antfu/import-dedupe": "error",
|
|
@@ -500,9 +449,9 @@ async function imports(options = {}) {
|
|
|
500
449
|
}
|
|
501
450
|
|
|
502
451
|
// src/configs/javascript.ts
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
452
|
+
import globals from "globals";
|
|
453
|
+
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
454
|
+
import pluginAntfu2 from "eslint-plugin-antfu";
|
|
506
455
|
async function javascript(options = {}) {
|
|
507
456
|
const { editor = false, overrides = {} } = options;
|
|
508
457
|
return [
|
|
@@ -511,9 +460,9 @@ async function javascript(options = {}) {
|
|
|
511
460
|
languageOptions: {
|
|
512
461
|
ecmaVersion: 2022,
|
|
513
462
|
globals: {
|
|
514
|
-
...
|
|
515
|
-
...
|
|
516
|
-
...
|
|
463
|
+
...globals.browser,
|
|
464
|
+
...globals.es2021,
|
|
465
|
+
...globals.node,
|
|
517
466
|
document: "readonly",
|
|
518
467
|
navigator: "readonly",
|
|
519
468
|
window: "readonly"
|
|
@@ -531,8 +480,8 @@ async function javascript(options = {}) {
|
|
|
531
480
|
reportUnusedDisableDirectives: true
|
|
532
481
|
},
|
|
533
482
|
plugins: {
|
|
534
|
-
"antfu":
|
|
535
|
-
"unused-imports":
|
|
483
|
+
"antfu": pluginAntfu2,
|
|
484
|
+
"unused-imports": pluginUnusedImports
|
|
536
485
|
},
|
|
537
486
|
rules: {
|
|
538
487
|
"accessor-pairs": [
|
|
@@ -761,8 +710,12 @@ async function javascript(options = {}) {
|
|
|
761
710
|
}
|
|
762
711
|
|
|
763
712
|
// src/utils.ts
|
|
764
|
-
|
|
765
|
-
|
|
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
|
+
}
|
|
766
719
|
function renameRules(rules, from, to) {
|
|
767
720
|
return Object.fromEntries(
|
|
768
721
|
Object.entries(rules).map(([key, value]) => {
|
|
@@ -781,11 +734,11 @@ async function interop(m) {
|
|
|
781
734
|
return resolved.default || resolved;
|
|
782
735
|
}
|
|
783
736
|
async function ensure(packages) {
|
|
784
|
-
if (
|
|
737
|
+
if (process.env.CI || process.stdout.isTTY === false) {
|
|
785
738
|
return;
|
|
786
739
|
}
|
|
787
740
|
;
|
|
788
|
-
const nonExistingPackages = packages.filter((i) => !
|
|
741
|
+
const nonExistingPackages = packages.filter((i) => !isPackageExists(i));
|
|
789
742
|
if (nonExistingPackages.length === 0) {
|
|
790
743
|
return;
|
|
791
744
|
}
|
|
@@ -805,6 +758,15 @@ async function ensure(packages) {
|
|
|
805
758
|
}
|
|
806
759
|
;
|
|
807
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
|
+
}
|
|
808
770
|
|
|
809
771
|
// src/configs/docs/jsdoc.ts
|
|
810
772
|
async function jsdoc(options = {}) {
|
|
@@ -926,8 +888,8 @@ async function jsonc(options = {}) {
|
|
|
926
888
|
}
|
|
927
889
|
|
|
928
890
|
// src/configs/docs/markdown.ts
|
|
929
|
-
|
|
930
|
-
|
|
891
|
+
import * as parserPlain from "eslint-parser-plain";
|
|
892
|
+
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
931
893
|
async function markdown(options = {}) {
|
|
932
894
|
const {
|
|
933
895
|
exts = [],
|
|
@@ -949,9 +911,9 @@ async function markdown(options = {}) {
|
|
|
949
911
|
// `eslint-plugin-markdown` only creates virtual files for code blocks,
|
|
950
912
|
// but not the markdown file itself. We use `eslint-merge-processors` to
|
|
951
913
|
// add a pass-through processor for the markdown file itself.
|
|
952
|
-
processor:
|
|
914
|
+
processor: mergeProcessors([
|
|
953
915
|
markdown2.processors.markdown,
|
|
954
|
-
|
|
916
|
+
processorPassThrough
|
|
955
917
|
])
|
|
956
918
|
},
|
|
957
919
|
{
|
|
@@ -1018,7 +980,7 @@ async function markdown(options = {}) {
|
|
|
1018
980
|
}
|
|
1019
981
|
|
|
1020
982
|
// src/configs/stylistic.ts
|
|
1021
|
-
|
|
983
|
+
import pluginAntfu3 from "eslint-plugin-antfu";
|
|
1022
984
|
var StylisticConfigDefaults = {
|
|
1023
985
|
indent: 2,
|
|
1024
986
|
jsx: true,
|
|
@@ -1049,7 +1011,7 @@ async function stylistic(options = {}) {
|
|
|
1049
1011
|
{
|
|
1050
1012
|
name: "luxass:stylistic",
|
|
1051
1013
|
plugins: {
|
|
1052
|
-
antfu:
|
|
1014
|
+
antfu: pluginAntfu3,
|
|
1053
1015
|
style: pluginStylistic
|
|
1054
1016
|
},
|
|
1055
1017
|
rules: {
|
|
@@ -1067,8 +1029,8 @@ async function stylistic(options = {}) {
|
|
|
1067
1029
|
}
|
|
1068
1030
|
|
|
1069
1031
|
// src/configs/typescript.ts
|
|
1070
|
-
|
|
1071
|
-
|
|
1032
|
+
import process2 from "node:process";
|
|
1033
|
+
import pluginAntfu4 from "eslint-plugin-antfu";
|
|
1072
1034
|
async function typescript(options = {}) {
|
|
1073
1035
|
const {
|
|
1074
1036
|
exts = [],
|
|
@@ -1122,7 +1084,7 @@ async function typescript(options = {}) {
|
|
|
1122
1084
|
sourceType: "module",
|
|
1123
1085
|
...typeAware ? {
|
|
1124
1086
|
project: tsconfigPath,
|
|
1125
|
-
tsconfigRootDir:
|
|
1087
|
+
tsconfigRootDir: process2.cwd()
|
|
1126
1088
|
} : {},
|
|
1127
1089
|
...parserOptions
|
|
1128
1090
|
}
|
|
@@ -1134,7 +1096,7 @@ async function typescript(options = {}) {
|
|
|
1134
1096
|
// Install the plugins without globs, so they can be configured separately.
|
|
1135
1097
|
name: "luxass:typescript:setup",
|
|
1136
1098
|
plugins: {
|
|
1137
|
-
antfu:
|
|
1099
|
+
antfu: pluginAntfu4,
|
|
1138
1100
|
ts: pluginTs
|
|
1139
1101
|
}
|
|
1140
1102
|
},
|
|
@@ -1272,27 +1234,21 @@ async function typescript(options = {}) {
|
|
|
1272
1234
|
}
|
|
1273
1235
|
|
|
1274
1236
|
// src/configs/frameworks/vue.ts
|
|
1275
|
-
|
|
1237
|
+
import { mergeProcessors as mergeProcessors2 } from "eslint-merge-processors";
|
|
1276
1238
|
async function vue(options = {}) {
|
|
1277
1239
|
const {
|
|
1278
|
-
a11y = false,
|
|
1279
1240
|
files = [GLOB_VUE],
|
|
1280
1241
|
overrides = {},
|
|
1281
1242
|
stylistic: stylistic2 = true
|
|
1282
1243
|
} = options;
|
|
1283
|
-
if (a11y) {
|
|
1284
|
-
await ensure(["eslint-plugin-vuejs-accessibility"]);
|
|
1285
|
-
}
|
|
1286
1244
|
const [
|
|
1287
1245
|
pluginVue,
|
|
1288
1246
|
parserVue,
|
|
1289
|
-
processorVueBlocks
|
|
1290
|
-
pluginA11y
|
|
1247
|
+
processorVueBlocks
|
|
1291
1248
|
] = await Promise.all([
|
|
1292
1249
|
interop(import("eslint-plugin-vue")),
|
|
1293
1250
|
interop(import("vue-eslint-parser")),
|
|
1294
|
-
interop(import("eslint-processor-vue-blocks"))
|
|
1295
|
-
...a11y ? [interop(import("eslint-plugin-vuejs-accessibility"))] : []
|
|
1251
|
+
interop(import("eslint-processor-vue-blocks"))
|
|
1296
1252
|
]);
|
|
1297
1253
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
1298
1254
|
const {
|
|
@@ -1301,9 +1257,28 @@ async function vue(options = {}) {
|
|
|
1301
1257
|
return [
|
|
1302
1258
|
{
|
|
1303
1259
|
name: "luxass:vue:setup",
|
|
1260
|
+
// This allows Vue plugin to work with auto imports
|
|
1261
|
+
// https://github.com/vuejs/eslint-plugin-vue/pull/2422
|
|
1262
|
+
languageOptions: {
|
|
1263
|
+
globals: {
|
|
1264
|
+
computed: "readonly",
|
|
1265
|
+
defineEmits: "readonly",
|
|
1266
|
+
defineExpose: "readonly",
|
|
1267
|
+
defineProps: "readonly",
|
|
1268
|
+
onMounted: "readonly",
|
|
1269
|
+
onUnmounted: "readonly",
|
|
1270
|
+
reactive: "readonly",
|
|
1271
|
+
ref: "readonly",
|
|
1272
|
+
shallowReactive: "readonly",
|
|
1273
|
+
shallowRef: "readonly",
|
|
1274
|
+
toRef: "readonly",
|
|
1275
|
+
toRefs: "readonly",
|
|
1276
|
+
watch: "readonly",
|
|
1277
|
+
watchEffect: "readonly"
|
|
1278
|
+
}
|
|
1279
|
+
},
|
|
1304
1280
|
plugins: {
|
|
1305
|
-
vue: pluginVue
|
|
1306
|
-
...a11y ? { "vue-a11y": pluginA11y } : {}
|
|
1281
|
+
vue: pluginVue
|
|
1307
1282
|
}
|
|
1308
1283
|
},
|
|
1309
1284
|
{
|
|
@@ -1320,7 +1295,7 @@ async function vue(options = {}) {
|
|
|
1320
1295
|
sourceType: "module"
|
|
1321
1296
|
}
|
|
1322
1297
|
},
|
|
1323
|
-
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : (
|
|
1298
|
+
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors2([
|
|
1324
1299
|
pluginVue.processors[".vue"],
|
|
1325
1300
|
processorVueBlocks({
|
|
1326
1301
|
...sfcBlocks,
|
|
@@ -1439,28 +1414,6 @@ async function vue(options = {}) {
|
|
|
1439
1414
|
"vue/space-in-parens": ["error", "never"],
|
|
1440
1415
|
"vue/template-curly-spacing": "error"
|
|
1441
1416
|
} : {},
|
|
1442
|
-
...a11y ? {
|
|
1443
|
-
"vue-a11y/alt-text": "error",
|
|
1444
|
-
"vue-a11y/anchor-has-content": "error",
|
|
1445
|
-
"vue-a11y/aria-props": "error",
|
|
1446
|
-
"vue-a11y/aria-role": "error",
|
|
1447
|
-
"vue-a11y/aria-unsupported-elements": "error",
|
|
1448
|
-
"vue-a11y/click-events-have-key-events": "error",
|
|
1449
|
-
"vue-a11y/form-control-has-label": "error",
|
|
1450
|
-
"vue-a11y/heading-has-content": "error",
|
|
1451
|
-
"vue-a11y/iframe-has-title": "error",
|
|
1452
|
-
"vue-a11y/interactive-supports-focus": "error",
|
|
1453
|
-
"vue-a11y/label-has-for": "error",
|
|
1454
|
-
"vue-a11y/media-has-caption": "error",
|
|
1455
|
-
"vue-a11y/mouse-events-have-key-events": "error",
|
|
1456
|
-
"vue-a11y/no-access-key": "error",
|
|
1457
|
-
"vue-a11y/no-autofocus": "error",
|
|
1458
|
-
"vue-a11y/no-distracting-elements": "error",
|
|
1459
|
-
"vue-a11y/no-redundant-roles": "error",
|
|
1460
|
-
"vue-a11y/no-static-element-interactions": "error",
|
|
1461
|
-
"vue-a11y/role-has-required-aria-props": "error",
|
|
1462
|
-
"vue-a11y/tabindex-no-positive": "error"
|
|
1463
|
-
} : {},
|
|
1464
1417
|
...overrides
|
|
1465
1418
|
}
|
|
1466
1419
|
}
|
|
@@ -1538,102 +1491,6 @@ async function yaml(options = {}) {
|
|
|
1538
1491
|
];
|
|
1539
1492
|
}
|
|
1540
1493
|
|
|
1541
|
-
// src/custom-rules/utils.ts
|
|
1542
|
-
var import_utils8 = require("@typescript-eslint/utils");
|
|
1543
|
-
var createRule = import_utils8.ESLintUtils.RuleCreator((ruleName) => `https://github.com/luxass/eslint-config/blob/main/src/custom-rules/${ruleName}/README.md`);
|
|
1544
|
-
|
|
1545
|
-
// src/custom-rules/no-only-tests/index.ts
|
|
1546
|
-
var RULE_NAME = "no-only-tests";
|
|
1547
|
-
var DEFAULT_OPTIONS = {
|
|
1548
|
-
blocks: ["describe", "it", "test"],
|
|
1549
|
-
focus: ["only"]
|
|
1550
|
-
};
|
|
1551
|
-
function getPath(node2, path = []) {
|
|
1552
|
-
if (node2) {
|
|
1553
|
-
const nodeName = node2.name || node2.property && node2.property.name;
|
|
1554
|
-
if (node2.object) {
|
|
1555
|
-
return getPath(
|
|
1556
|
-
node2.object,
|
|
1557
|
-
[nodeName, ...path]
|
|
1558
|
-
);
|
|
1559
|
-
}
|
|
1560
|
-
if (node2.callee)
|
|
1561
|
-
return getPath(node2.callee, path);
|
|
1562
|
-
return [nodeName, ...path];
|
|
1563
|
-
}
|
|
1564
|
-
return path;
|
|
1565
|
-
}
|
|
1566
|
-
var noOnlyTests = createRule({
|
|
1567
|
-
name: RULE_NAME,
|
|
1568
|
-
create: (context, [options]) => {
|
|
1569
|
-
const {
|
|
1570
|
-
blocks = DEFAULT_OPTIONS.blocks,
|
|
1571
|
-
focus = DEFAULT_OPTIONS.focus
|
|
1572
|
-
} = options;
|
|
1573
|
-
return {
|
|
1574
|
-
Identifier(node2) {
|
|
1575
|
-
const parent = node2.parent?.object;
|
|
1576
|
-
if (!parent)
|
|
1577
|
-
return;
|
|
1578
|
-
if (!focus.includes(node2.name))
|
|
1579
|
-
return;
|
|
1580
|
-
const callPath = getPath(node2.parent).join(".");
|
|
1581
|
-
const found = blocks.find((block) => {
|
|
1582
|
-
if (block.endsWith("*")) {
|
|
1583
|
-
return callPath.startsWith(block.replace(/\*$/, ""));
|
|
1584
|
-
}
|
|
1585
|
-
return callPath.startsWith(`${block}.`);
|
|
1586
|
-
});
|
|
1587
|
-
if (found) {
|
|
1588
|
-
context.report({
|
|
1589
|
-
data: { block: callPath.split(".")[0], focus: node2.name },
|
|
1590
|
-
messageId: "not-permitted",
|
|
1591
|
-
node: node2
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
};
|
|
1596
|
-
},
|
|
1597
|
-
defaultOptions: [
|
|
1598
|
-
{
|
|
1599
|
-
blocks: ["describe", "it", "test"],
|
|
1600
|
-
focus: ["only"]
|
|
1601
|
-
}
|
|
1602
|
-
],
|
|
1603
|
-
meta: {
|
|
1604
|
-
docs: {
|
|
1605
|
-
description: "disallow .only blocks in tests",
|
|
1606
|
-
recommended: "recommended"
|
|
1607
|
-
},
|
|
1608
|
-
messages: {
|
|
1609
|
-
"not-permitted": "{{ block }}.{{ focus }} not permitted"
|
|
1610
|
-
},
|
|
1611
|
-
schema: [
|
|
1612
|
-
{
|
|
1613
|
-
additionalProperties: false,
|
|
1614
|
-
properties: {
|
|
1615
|
-
blocks: {
|
|
1616
|
-
items: {
|
|
1617
|
-
type: "string"
|
|
1618
|
-
},
|
|
1619
|
-
type: "array",
|
|
1620
|
-
uniqueItems: true
|
|
1621
|
-
},
|
|
1622
|
-
focus: {
|
|
1623
|
-
items: {
|
|
1624
|
-
type: "string"
|
|
1625
|
-
},
|
|
1626
|
-
type: "array",
|
|
1627
|
-
uniqueItems: true
|
|
1628
|
-
}
|
|
1629
|
-
},
|
|
1630
|
-
type: "object"
|
|
1631
|
-
}
|
|
1632
|
-
],
|
|
1633
|
-
type: "layout"
|
|
1634
|
-
}
|
|
1635
|
-
});
|
|
1636
|
-
|
|
1637
1494
|
// src/configs/test.ts
|
|
1638
1495
|
async function test(options = {}) {
|
|
1639
1496
|
const {
|
|
@@ -1653,8 +1510,7 @@ async function test(options = {}) {
|
|
|
1653
1510
|
test: {
|
|
1654
1511
|
...pluginVitest,
|
|
1655
1512
|
rules: {
|
|
1656
|
-
...pluginVitest.rules
|
|
1657
|
-
"no-only-tests": noOnlyTests
|
|
1513
|
+
...pluginVitest.rules
|
|
1658
1514
|
}
|
|
1659
1515
|
}
|
|
1660
1516
|
}
|
|
@@ -1668,7 +1524,7 @@ async function test(options = {}) {
|
|
|
1668
1524
|
{ fn: "it", withinDescribe: "it" }
|
|
1669
1525
|
],
|
|
1670
1526
|
"test/no-identical-title": "error",
|
|
1671
|
-
"test/no-
|
|
1527
|
+
"test/no-focused-tests": editor ? "off" : "error",
|
|
1672
1528
|
"test/prefer-hooks-in-order": "error",
|
|
1673
1529
|
"test/prefer-lowercase-title": "error",
|
|
1674
1530
|
...overrides
|
|
@@ -1794,7 +1650,7 @@ async function nextjs(options = {}) {
|
|
|
1794
1650
|
}
|
|
1795
1651
|
|
|
1796
1652
|
// src/configs/frameworks/react.ts
|
|
1797
|
-
|
|
1653
|
+
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
1798
1654
|
async function react(options = {}) {
|
|
1799
1655
|
const {
|
|
1800
1656
|
a11y = false,
|
|
@@ -1819,7 +1675,7 @@ async function react(options = {}) {
|
|
|
1819
1675
|
interop(import("eslint-plugin-react-refresh")),
|
|
1820
1676
|
...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
|
|
1821
1677
|
]);
|
|
1822
|
-
const isAllowConstantExport = (
|
|
1678
|
+
const isAllowConstantExport = isPackageExists2("vite");
|
|
1823
1679
|
return [
|
|
1824
1680
|
{
|
|
1825
1681
|
name: "luxass:react:setup",
|
|
@@ -2078,15 +1934,18 @@ async function astro(options) {
|
|
|
2078
1934
|
a11y = false,
|
|
2079
1935
|
files = [GLOB_ASTRO],
|
|
2080
1936
|
overrides = {},
|
|
2081
|
-
typescript: typescript2 = true
|
|
1937
|
+
typescript: typescript2 = true,
|
|
1938
|
+
stylistic: stylistic2 = true
|
|
2082
1939
|
} = options;
|
|
2083
1940
|
const [
|
|
2084
1941
|
pluginAstro,
|
|
2085
1942
|
parserAstro,
|
|
1943
|
+
parserTs,
|
|
2086
1944
|
pluginA11y
|
|
2087
1945
|
] = await Promise.all([
|
|
2088
1946
|
interop(import("eslint-plugin-astro")),
|
|
2089
1947
|
interop(import("astro-eslint-parser")),
|
|
1948
|
+
interop(import("@typescript-eslint/parser")),
|
|
2090
1949
|
...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
|
|
2091
1950
|
]);
|
|
2092
1951
|
return [
|
|
@@ -2101,15 +1960,10 @@ async function astro(options) {
|
|
|
2101
1960
|
name: "luxass:astro:rules",
|
|
2102
1961
|
files,
|
|
2103
1962
|
languageOptions: {
|
|
2104
|
-
globals: {
|
|
2105
|
-
"astro/astro": true,
|
|
2106
|
-
"es2020": true,
|
|
2107
|
-
"node": true
|
|
2108
|
-
},
|
|
2109
1963
|
parser: parserAstro,
|
|
2110
1964
|
parserOptions: {
|
|
2111
1965
|
extraFileExtensions: [".astro"],
|
|
2112
|
-
parser: typescript2 ?
|
|
1966
|
+
parser: typescript2 ? parserTs : null,
|
|
2113
1967
|
sourceType: "module"
|
|
2114
1968
|
}
|
|
2115
1969
|
},
|
|
@@ -2117,28 +1971,16 @@ async function astro(options) {
|
|
|
2117
1971
|
// Disallow conflicting set directives and child contents
|
|
2118
1972
|
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-conflict-set-directives/
|
|
2119
1973
|
"astro/no-conflict-set-directives": "error",
|
|
2120
|
-
// Disallow
|
|
2121
|
-
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-
|
|
2122
|
-
"astro/no-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-deprecated-getentrybyslug/
|
|
2131
|
-
"astro/no-deprecated-getentrybyslug": "error",
|
|
2132
|
-
// Disallow unused define:vars={...} in style tag
|
|
2133
|
-
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-unused-define-vars-in-style/
|
|
2134
|
-
"astro/no-unused-define-vars-in-style": "error",
|
|
2135
|
-
// Disallow warnings when compiling
|
|
2136
|
-
// https://ota-meshi.github.io/eslint-plugin-astro/rules/valid-compile/
|
|
2137
|
-
"astro/valid-compile": "error",
|
|
2138
|
-
"style/jsx-closing-tag-location": "off",
|
|
2139
|
-
"style/jsx-indent": "off",
|
|
2140
|
-
"style/jsx-one-expression-per-line": "off",
|
|
2141
|
-
"style/multiline-ternary": ["error", "never"],
|
|
1974
|
+
// Disallow use of `set:html` directive
|
|
1975
|
+
// https://ota-meshi.github.io/eslint-plugin-astro/rules/no-set-html-directive/
|
|
1976
|
+
"astro/no-set-html-directive": "off",
|
|
1977
|
+
...stylistic2 ? {
|
|
1978
|
+
"style/indent": "off",
|
|
1979
|
+
"style/jsx-indent": "off",
|
|
1980
|
+
"style/jsx-closing-tag-location": "off",
|
|
1981
|
+
"style/jsx-one-expression-per-line": "off",
|
|
1982
|
+
"style/no-multiple-empty-lines": "off"
|
|
1983
|
+
} : {},
|
|
2142
1984
|
...overrides
|
|
2143
1985
|
}
|
|
2144
1986
|
},
|
|
@@ -2169,7 +2011,7 @@ async function astro(options) {
|
|
|
2169
2011
|
browser: true,
|
|
2170
2012
|
es2020: true
|
|
2171
2013
|
},
|
|
2172
|
-
parser: typescript2 ?
|
|
2014
|
+
parser: typescript2 ? parserTs : null,
|
|
2173
2015
|
parserOptions: {
|
|
2174
2016
|
project: null,
|
|
2175
2017
|
sourceType: "module"
|
|
@@ -2232,7 +2074,7 @@ async function tailwindcss(options = {}) {
|
|
|
2232
2074
|
}
|
|
2233
2075
|
|
|
2234
2076
|
// src/configs/formatters.ts
|
|
2235
|
-
|
|
2077
|
+
import * as parserPlain2 from "eslint-parser-plain";
|
|
2236
2078
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
2237
2079
|
await ensure([
|
|
2238
2080
|
"eslint-plugin-format"
|
|
@@ -2455,291 +2297,241 @@ async function toml(options = {}) {
|
|
|
2455
2297
|
];
|
|
2456
2298
|
}
|
|
2457
2299
|
|
|
2458
|
-
// src/
|
|
2459
|
-
|
|
2300
|
+
// src/factory.ts
|
|
2301
|
+
var FLAT_CONFIG_PROPS = [
|
|
2302
|
+
"name",
|
|
2303
|
+
"files",
|
|
2304
|
+
"ignores",
|
|
2305
|
+
"languageOptions",
|
|
2306
|
+
"linterOptions",
|
|
2307
|
+
"processor",
|
|
2308
|
+
"plugins",
|
|
2309
|
+
"rules",
|
|
2310
|
+
"settings"
|
|
2311
|
+
];
|
|
2312
|
+
var VuePackages = [
|
|
2313
|
+
"vue",
|
|
2314
|
+
"nuxt",
|
|
2315
|
+
"vitepress",
|
|
2316
|
+
"@slidev/cli"
|
|
2317
|
+
];
|
|
2318
|
+
async function luxass(options = {}, ...userConfigs) {
|
|
2460
2319
|
const {
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2320
|
+
astro: enableAstro = false,
|
|
2321
|
+
editor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI),
|
|
2322
|
+
exts = [],
|
|
2323
|
+
gitignore: enableGitignore = true,
|
|
2324
|
+
nextjs: enableNextJS = false,
|
|
2325
|
+
react: enableReact = false,
|
|
2326
|
+
tailwindcss: enableTailwindCSS = false,
|
|
2327
|
+
typescript: enableTypeScript = isPackageExists3("typescript"),
|
|
2328
|
+
unocss: enableUnoCSS = false,
|
|
2329
|
+
vue: enableVue = VuePackages.some((i) => isPackageExists3(i))
|
|
2465
2330
|
} = options;
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
plugins: {
|
|
2478
|
-
solid: pluginSolid
|
|
2479
|
-
}
|
|
2480
|
-
},
|
|
2481
|
-
{
|
|
2482
|
-
name: "luxass:solid:rules",
|
|
2483
|
-
files,
|
|
2484
|
-
languageOptions: {
|
|
2485
|
-
parserOptions: {
|
|
2486
|
-
ecmaFeatures: {
|
|
2487
|
-
jsx: true
|
|
2488
|
-
}
|
|
2489
|
-
},
|
|
2490
|
-
sourceType: "module"
|
|
2491
|
-
},
|
|
2492
|
-
rules: {
|
|
2493
|
-
...a11y ? {
|
|
2494
|
-
// recommended rules for jsx-a11y
|
|
2495
|
-
"jsx-a11y/alt-text": "error",
|
|
2496
|
-
"jsx-a11y/anchor-ambiguous-text": "off",
|
|
2497
|
-
"jsx-a11y/anchor-has-content": "error",
|
|
2498
|
-
"jsx-a11y/anchor-is-valid": "error",
|
|
2499
|
-
"jsx-a11y/aria-activedescendant-has-tabindex": "error",
|
|
2500
|
-
"jsx-a11y/aria-props": "error",
|
|
2501
|
-
"jsx-a11y/aria-proptypes": "error",
|
|
2502
|
-
"jsx-a11y/aria-role": "error",
|
|
2503
|
-
"jsx-a11y/aria-unsupported-elements": "error",
|
|
2504
|
-
"jsx-a11y/autocomplete-valid": "error",
|
|
2505
|
-
"jsx-a11y/click-events-have-key-events": "error",
|
|
2506
|
-
"jsx-a11y/control-has-associated-label": [
|
|
2507
|
-
"off",
|
|
2508
|
-
{
|
|
2509
|
-
ignoreElements: [
|
|
2510
|
-
"audio",
|
|
2511
|
-
"canvas",
|
|
2512
|
-
"embed",
|
|
2513
|
-
"input",
|
|
2514
|
-
"textarea",
|
|
2515
|
-
"tr",
|
|
2516
|
-
"video"
|
|
2517
|
-
],
|
|
2518
|
-
ignoreRoles: [
|
|
2519
|
-
"grid",
|
|
2520
|
-
"listbox",
|
|
2521
|
-
"menu",
|
|
2522
|
-
"menubar",
|
|
2523
|
-
"radiogroup",
|
|
2524
|
-
"row",
|
|
2525
|
-
"tablist",
|
|
2526
|
-
"toolbar",
|
|
2527
|
-
"tree",
|
|
2528
|
-
"treegrid"
|
|
2529
|
-
],
|
|
2530
|
-
includeRoles: [
|
|
2531
|
-
"alert",
|
|
2532
|
-
"dialog"
|
|
2533
|
-
]
|
|
2534
|
-
}
|
|
2535
|
-
],
|
|
2536
|
-
"jsx-a11y/heading-has-content": "error",
|
|
2537
|
-
"jsx-a11y/html-has-lang": "error",
|
|
2538
|
-
"jsx-a11y/iframe-has-title": "error",
|
|
2539
|
-
"jsx-a11y/img-redundant-alt": "error",
|
|
2540
|
-
"jsx-a11y/interactive-supports-focus": [
|
|
2541
|
-
"error",
|
|
2542
|
-
{
|
|
2543
|
-
tabbable: [
|
|
2544
|
-
"button",
|
|
2545
|
-
"checkbox",
|
|
2546
|
-
"link",
|
|
2547
|
-
"searchbox",
|
|
2548
|
-
"spinbutton",
|
|
2549
|
-
"switch",
|
|
2550
|
-
"textbox"
|
|
2551
|
-
]
|
|
2552
|
-
}
|
|
2553
|
-
],
|
|
2554
|
-
"jsx-a11y/label-has-associated-control": "error",
|
|
2555
|
-
"jsx-a11y/label-has-for": "off",
|
|
2556
|
-
"jsx-a11y/media-has-caption": "error",
|
|
2557
|
-
"jsx-a11y/mouse-events-have-key-events": "error",
|
|
2558
|
-
"jsx-a11y/no-access-key": "error",
|
|
2559
|
-
"jsx-a11y/no-autofocus": "error",
|
|
2560
|
-
"jsx-a11y/no-distracting-elements": "error",
|
|
2561
|
-
"jsx-a11y/no-interactive-element-to-noninteractive-role": [
|
|
2562
|
-
"error",
|
|
2563
|
-
{
|
|
2564
|
-
canvas: [
|
|
2565
|
-
"img"
|
|
2566
|
-
],
|
|
2567
|
-
tr: [
|
|
2568
|
-
"none",
|
|
2569
|
-
"presentation"
|
|
2570
|
-
]
|
|
2571
|
-
}
|
|
2572
|
-
],
|
|
2573
|
-
"jsx-a11y/no-noninteractive-element-interactions": [
|
|
2574
|
-
"error",
|
|
2575
|
-
{
|
|
2576
|
-
alert: [
|
|
2577
|
-
"onKeyUp",
|
|
2578
|
-
"onKeyDown",
|
|
2579
|
-
"onKeyPress"
|
|
2580
|
-
],
|
|
2581
|
-
body: [
|
|
2582
|
-
"onError",
|
|
2583
|
-
"onLoad"
|
|
2584
|
-
],
|
|
2585
|
-
dialog: [
|
|
2586
|
-
"onKeyUp",
|
|
2587
|
-
"onKeyDown",
|
|
2588
|
-
"onKeyPress"
|
|
2589
|
-
],
|
|
2590
|
-
handlers: [
|
|
2591
|
-
"onClick",
|
|
2592
|
-
"onError",
|
|
2593
|
-
"onLoad",
|
|
2594
|
-
"onMouseDown",
|
|
2595
|
-
"onMouseUp",
|
|
2596
|
-
"onKeyPress",
|
|
2597
|
-
"onKeyDown",
|
|
2598
|
-
"onKeyUp"
|
|
2599
|
-
],
|
|
2600
|
-
iframe: [
|
|
2601
|
-
"onError",
|
|
2602
|
-
"onLoad"
|
|
2603
|
-
],
|
|
2604
|
-
img: [
|
|
2605
|
-
"onError",
|
|
2606
|
-
"onLoad"
|
|
2607
|
-
]
|
|
2608
|
-
}
|
|
2609
|
-
],
|
|
2610
|
-
"jsx-a11y/no-noninteractive-element-to-interactive-role": [
|
|
2611
|
-
"error",
|
|
2612
|
-
{
|
|
2613
|
-
fieldset: [
|
|
2614
|
-
"radiogroup",
|
|
2615
|
-
"presentation"
|
|
2616
|
-
],
|
|
2617
|
-
li: [
|
|
2618
|
-
"menuitem",
|
|
2619
|
-
"option",
|
|
2620
|
-
"row",
|
|
2621
|
-
"tab",
|
|
2622
|
-
"treeitem"
|
|
2623
|
-
],
|
|
2624
|
-
ol: [
|
|
2625
|
-
"listbox",
|
|
2626
|
-
"menu",
|
|
2627
|
-
"menubar",
|
|
2628
|
-
"radiogroup",
|
|
2629
|
-
"tablist",
|
|
2630
|
-
"tree",
|
|
2631
|
-
"treegrid"
|
|
2632
|
-
],
|
|
2633
|
-
table: [
|
|
2634
|
-
"grid"
|
|
2635
|
-
],
|
|
2636
|
-
td: [
|
|
2637
|
-
"gridcell"
|
|
2638
|
-
],
|
|
2639
|
-
ul: [
|
|
2640
|
-
"listbox",
|
|
2641
|
-
"menu",
|
|
2642
|
-
"menubar",
|
|
2643
|
-
"radiogroup",
|
|
2644
|
-
"tablist",
|
|
2645
|
-
"tree",
|
|
2646
|
-
"treegrid"
|
|
2647
|
-
]
|
|
2648
|
-
}
|
|
2649
|
-
],
|
|
2650
|
-
"jsx-a11y/no-noninteractive-tabindex": [
|
|
2651
|
-
"error",
|
|
2652
|
-
{
|
|
2653
|
-
allowExpressionValues: true,
|
|
2654
|
-
roles: [
|
|
2655
|
-
"tabpanel"
|
|
2656
|
-
],
|
|
2657
|
-
tags: []
|
|
2658
|
-
}
|
|
2659
|
-
],
|
|
2660
|
-
"jsx-a11y/no-redundant-roles": "error",
|
|
2661
|
-
"jsx-a11y/no-static-element-interactions": [
|
|
2662
|
-
"error",
|
|
2663
|
-
{
|
|
2664
|
-
allowExpressionValues: true,
|
|
2665
|
-
handlers: [
|
|
2666
|
-
"onClick",
|
|
2667
|
-
"onMouseDown",
|
|
2668
|
-
"onMouseUp",
|
|
2669
|
-
"onKeyPress",
|
|
2670
|
-
"onKeyDown",
|
|
2671
|
-
"onKeyUp"
|
|
2672
|
-
]
|
|
2673
|
-
}
|
|
2674
|
-
],
|
|
2675
|
-
"jsx-a11y/role-has-required-aria-props": "error",
|
|
2676
|
-
"jsx-a11y/role-supports-aria-props": "error",
|
|
2677
|
-
"jsx-a11y/scope": "error",
|
|
2678
|
-
"jsx-a11y/tabindex-no-positive": "error"
|
|
2679
|
-
} : {},
|
|
2680
|
-
// solid recommended rules
|
|
2681
|
-
// reactivity
|
|
2682
|
-
"solid/components-return-once": 1,
|
|
2683
|
-
"solid/event-handlers": 1,
|
|
2684
|
-
// these rules are mostly style suggestions
|
|
2685
|
-
"solid/imports": 1,
|
|
2686
|
-
// identifier usage is important
|
|
2687
|
-
"solid/jsx-no-duplicate-props": 2,
|
|
2688
|
-
"solid/jsx-no-script-url": 2,
|
|
2689
|
-
"solid/jsx-no-undef": 2,
|
|
2690
|
-
"solid/jsx-uses-vars": 2,
|
|
2691
|
-
"solid/no-array-handlers": 0,
|
|
2692
|
-
"solid/no-destructure": 2,
|
|
2693
|
-
// security problems
|
|
2694
|
-
"solid/no-innerhtml": 2,
|
|
2695
|
-
// only necessary for resource-constrained environments
|
|
2696
|
-
"solid/no-proxy-apis": 0,
|
|
2697
|
-
"solid/no-react-deps": 1,
|
|
2698
|
-
"solid/no-react-specific-props": 1,
|
|
2699
|
-
"solid/no-unknown-namespaces": 2,
|
|
2700
|
-
// deprecated
|
|
2701
|
-
"solid/prefer-classlist": 0,
|
|
2702
|
-
"solid/prefer-for": 2,
|
|
2703
|
-
// handled by Solid compiler, opt-in style suggestion
|
|
2704
|
-
"solid/prefer-show": 0,
|
|
2705
|
-
"solid/reactivity": 1,
|
|
2706
|
-
"solid/self-closing-comp": 1,
|
|
2707
|
-
"solid/style-prop": 1,
|
|
2708
|
-
...typescript2 ? {
|
|
2709
|
-
"solid/jsx-no-undef": [2, { typescriptEnabled: true }],
|
|
2710
|
-
// namespaces taken care of by TS
|
|
2711
|
-
"solid/no-unknown-namespaces": 0
|
|
2712
|
-
} : {},
|
|
2713
|
-
// overrides
|
|
2714
|
-
...overrides
|
|
2331
|
+
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2332
|
+
if (stylisticOptions && !("jsx" in stylisticOptions)) {
|
|
2333
|
+
stylisticOptions.jsx = options.jsx ?? true;
|
|
2334
|
+
}
|
|
2335
|
+
const configs = [];
|
|
2336
|
+
if (enableGitignore) {
|
|
2337
|
+
if (typeof enableGitignore !== "boolean") {
|
|
2338
|
+
configs.push(interop(import("eslint-config-flat-gitignore")).then((plugin) => [plugin(enableGitignore)]));
|
|
2339
|
+
} else {
|
|
2340
|
+
if (existsSync(".gitignore")) {
|
|
2341
|
+
configs.push(interop(import("eslint-config-flat-gitignore")).then((plugin) => [plugin()]));
|
|
2715
2342
|
}
|
|
2716
2343
|
}
|
|
2717
|
-
|
|
2344
|
+
}
|
|
2345
|
+
configs.push(
|
|
2346
|
+
ignores(),
|
|
2347
|
+
javascript({
|
|
2348
|
+
editor,
|
|
2349
|
+
overrides: getOverrides(options, "javascript")
|
|
2350
|
+
}),
|
|
2351
|
+
comments(),
|
|
2352
|
+
node(),
|
|
2353
|
+
jsdoc({
|
|
2354
|
+
stylistic: stylisticOptions
|
|
2355
|
+
}),
|
|
2356
|
+
imports({
|
|
2357
|
+
stylistic: stylisticOptions
|
|
2358
|
+
}),
|
|
2359
|
+
unicorn()
|
|
2360
|
+
);
|
|
2361
|
+
if (enableVue) {
|
|
2362
|
+
exts.push("vue");
|
|
2363
|
+
}
|
|
2364
|
+
if (enableTypeScript) {
|
|
2365
|
+
configs.push(typescript({
|
|
2366
|
+
...resolveSubOptions(options, "typescript"),
|
|
2367
|
+
exts,
|
|
2368
|
+
overrides: getOverrides(options, "typescript")
|
|
2369
|
+
}));
|
|
2370
|
+
}
|
|
2371
|
+
if (stylisticOptions) {
|
|
2372
|
+
configs.push(stylistic({
|
|
2373
|
+
...stylisticOptions,
|
|
2374
|
+
overrides: getOverrides(options, "stylistic")
|
|
2375
|
+
}));
|
|
2376
|
+
}
|
|
2377
|
+
if (options.test ?? true) {
|
|
2378
|
+
configs.push(test({
|
|
2379
|
+
editor,
|
|
2380
|
+
overrides: getOverrides(options, "test")
|
|
2381
|
+
}));
|
|
2382
|
+
}
|
|
2383
|
+
if (enableReact || enableNextJS) {
|
|
2384
|
+
configs.push(react({
|
|
2385
|
+
overrides: getOverrides(options, "react"),
|
|
2386
|
+
typescript: !!enableTypeScript
|
|
2387
|
+
}));
|
|
2388
|
+
}
|
|
2389
|
+
if (enableNextJS) {
|
|
2390
|
+
configs.push(
|
|
2391
|
+
nextjs({
|
|
2392
|
+
...resolveSubOptions(options, "nextjs"),
|
|
2393
|
+
overrides: getOverrides(options, "nextjs")
|
|
2394
|
+
})
|
|
2395
|
+
);
|
|
2396
|
+
}
|
|
2397
|
+
if (enableVue) {
|
|
2398
|
+
configs.push(
|
|
2399
|
+
vue({
|
|
2400
|
+
...resolveSubOptions(options, "vue"),
|
|
2401
|
+
overrides: getOverrides(options, "vue"),
|
|
2402
|
+
stylistic: stylisticOptions,
|
|
2403
|
+
typescript: !!enableTypeScript
|
|
2404
|
+
})
|
|
2405
|
+
);
|
|
2406
|
+
}
|
|
2407
|
+
if (enableAstro) {
|
|
2408
|
+
configs.push(
|
|
2409
|
+
astro({
|
|
2410
|
+
...resolveSubOptions(options, "astro"),
|
|
2411
|
+
overrides: getOverrides(options, "astro"),
|
|
2412
|
+
typescript: !!enableTypeScript
|
|
2413
|
+
})
|
|
2414
|
+
);
|
|
2415
|
+
}
|
|
2416
|
+
if (enableUnoCSS) {
|
|
2417
|
+
configs.push(unocss({
|
|
2418
|
+
...resolveSubOptions(options, "unocss"),
|
|
2419
|
+
overrides: getOverrides(options, "unocss")
|
|
2420
|
+
}));
|
|
2421
|
+
}
|
|
2422
|
+
if (enableTailwindCSS) {
|
|
2423
|
+
configs.push(tailwindcss({
|
|
2424
|
+
...resolveSubOptions(options, "tailwindcss"),
|
|
2425
|
+
overrides: getOverrides(options, "tailwindcss")
|
|
2426
|
+
}));
|
|
2427
|
+
}
|
|
2428
|
+
if (options.jsonc ?? true) {
|
|
2429
|
+
configs.push(
|
|
2430
|
+
jsonc({
|
|
2431
|
+
overrides: getOverrides(options, "jsonc"),
|
|
2432
|
+
stylistic: stylisticOptions
|
|
2433
|
+
}),
|
|
2434
|
+
sortPackageJson(),
|
|
2435
|
+
sortTsconfig()
|
|
2436
|
+
);
|
|
2437
|
+
}
|
|
2438
|
+
if (options.yaml ?? true) {
|
|
2439
|
+
configs.push(yaml({
|
|
2440
|
+
overrides: getOverrides(options, "yaml"),
|
|
2441
|
+
stylistic: stylisticOptions
|
|
2442
|
+
}));
|
|
2443
|
+
}
|
|
2444
|
+
if (options.toml ?? true) {
|
|
2445
|
+
configs.push(toml({
|
|
2446
|
+
overrides: getOverrides(options, "toml"),
|
|
2447
|
+
stylistic: stylisticOptions
|
|
2448
|
+
}));
|
|
2449
|
+
}
|
|
2450
|
+
if (options.markdown ?? true) {
|
|
2451
|
+
configs.push(
|
|
2452
|
+
markdown({
|
|
2453
|
+
exts,
|
|
2454
|
+
overrides: getOverrides(options, "markdown")
|
|
2455
|
+
})
|
|
2456
|
+
);
|
|
2457
|
+
}
|
|
2458
|
+
if (options.formatters) {
|
|
2459
|
+
configs.push(formatters(
|
|
2460
|
+
options.formatters,
|
|
2461
|
+
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2462
|
+
));
|
|
2463
|
+
}
|
|
2464
|
+
const fusedConfig = FLAT_CONFIG_PROPS.reduce((acc, key) => {
|
|
2465
|
+
if (key in options) {
|
|
2466
|
+
acc[key] = options[key];
|
|
2467
|
+
}
|
|
2468
|
+
return acc;
|
|
2469
|
+
}, {});
|
|
2470
|
+
if (Object.keys(fusedConfig).length) {
|
|
2471
|
+
configs.push([fusedConfig]);
|
|
2472
|
+
}
|
|
2473
|
+
const merged = combine(
|
|
2474
|
+
...configs,
|
|
2475
|
+
...userConfigs
|
|
2476
|
+
);
|
|
2477
|
+
return merged;
|
|
2718
2478
|
}
|
|
2719
|
-
|
|
2720
|
-
|
|
2479
|
+
export {
|
|
2480
|
+
GLOB_ASTRO,
|
|
2481
|
+
GLOB_CSS,
|
|
2482
|
+
GLOB_EXCLUDE,
|
|
2483
|
+
GLOB_HTML,
|
|
2484
|
+
GLOB_JS,
|
|
2485
|
+
GLOB_JSON,
|
|
2486
|
+
GLOB_JSON5,
|
|
2487
|
+
GLOB_JSONC,
|
|
2488
|
+
GLOB_JSX,
|
|
2489
|
+
GLOB_LESS,
|
|
2490
|
+
GLOB_MARKDOWN,
|
|
2491
|
+
GLOB_MARKDOWN_CODE,
|
|
2492
|
+
GLOB_MARKDOWN_IN_MARKDOWN,
|
|
2493
|
+
GLOB_NEXTJS_OG,
|
|
2494
|
+
GLOB_NEXTJS_ROUTES,
|
|
2495
|
+
GLOB_POSTCSS,
|
|
2496
|
+
GLOB_SCSS,
|
|
2497
|
+
GLOB_SRC,
|
|
2498
|
+
GLOB_SRC_EXT,
|
|
2499
|
+
GLOB_STYLE,
|
|
2500
|
+
GLOB_TESTS,
|
|
2501
|
+
GLOB_TOML,
|
|
2502
|
+
GLOB_TS,
|
|
2503
|
+
GLOB_TSX,
|
|
2504
|
+
GLOB_VUE,
|
|
2505
|
+
GLOB_YAML,
|
|
2721
2506
|
astro,
|
|
2507
|
+
combine,
|
|
2722
2508
|
comments,
|
|
2509
|
+
ensure,
|
|
2723
2510
|
formatters,
|
|
2511
|
+
getOverrides,
|
|
2724
2512
|
ignores,
|
|
2725
2513
|
imports,
|
|
2514
|
+
interop,
|
|
2726
2515
|
javascript,
|
|
2727
2516
|
jsdoc,
|
|
2728
2517
|
jsonc,
|
|
2518
|
+
luxass,
|
|
2729
2519
|
markdown,
|
|
2730
2520
|
nextjs,
|
|
2731
2521
|
node,
|
|
2732
2522
|
react,
|
|
2733
|
-
|
|
2523
|
+
renameRules,
|
|
2524
|
+
resolveSubOptions,
|
|
2734
2525
|
sortPackageJson,
|
|
2735
2526
|
sortTsconfig,
|
|
2736
2527
|
stylistic,
|
|
2737
2528
|
tailwindcss,
|
|
2738
2529
|
test,
|
|
2530
|
+
toArray,
|
|
2739
2531
|
toml,
|
|
2740
2532
|
typescript,
|
|
2741
2533
|
unicorn,
|
|
2742
2534
|
unocss,
|
|
2743
2535
|
vue,
|
|
2744
2536
|
yaml
|
|
2745
|
-
}
|
|
2537
|
+
};
|