@luxass/eslint-config 4.0.0-beta.9 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +351 -48
- package/dist/{chunk-TQ476NL2.mjs → chunk-4YBQZLPS.mjs} +13 -2
- package/dist/{chunk-NDNDG7BH.mjs → chunk-5NK24IKQ.mjs} +2 -5
- package/dist/{chunk-2SW2E3TH.mjs → chunk-5SDSWPKR.mjs} +14 -4
- package/dist/chunk-6T7MXPCT.mjs +17 -0
- package/dist/{chunk-ADP4MYOS.mjs → chunk-ANUYBAYV.mjs} +1 -1
- package/dist/{chunk-R4NSLRAE.mjs → chunk-ATRL3UZP.mjs} +14 -8
- package/dist/{chunk-P3N5WLFL.mjs → chunk-BXBN56WI.mjs} +11 -7
- package/dist/chunk-CJ3ZUYUJ.mjs +183 -0
- package/dist/chunk-DAJA5AV3.mjs +29 -0
- package/dist/{chunk-FK567E7G.mjs → chunk-DVQQVCGF.mjs} +7 -3
- package/dist/chunk-DZCXT6HT.mjs +288 -0
- package/dist/chunk-FU5SRKZU.mjs +104 -0
- package/dist/{chunk-LQLF2CMA.mjs → chunk-GBLPCM3X.mjs} +14 -17
- package/dist/chunk-KJ7ZCBK4.mjs +48 -0
- package/dist/{chunk-BAKUP7QM.mjs → chunk-P3QUAOFO.mjs} +36 -34
- package/dist/{chunk-QZTI72NS.mjs → chunk-PYS26PF3.mjs} +13 -9
- package/dist/chunk-Q57BF3CR.mjs +63 -0
- package/dist/{chunk-SPQZTV4E.mjs → chunk-QK56GX3F.mjs} +12 -14
- package/dist/{chunk-3QHLEAXK.mjs → chunk-RDZJT36Z.mjs} +22 -8
- package/dist/{chunk-HE56XDG6.mjs → chunk-RVSUTDCE.mjs} +15 -5
- package/dist/chunk-UMUUVFB7.mjs +69 -0
- package/dist/{chunk-NUG6FLHN.mjs → chunk-VZ2YFMWH.mjs} +54 -11
- package/dist/chunk-WDSV2EFG.mjs +7 -0
- package/dist/{chunk-M5WNLLBT.mjs → chunk-WOYZWHPM.mjs} +20 -7
- package/dist/chunk-WRURTO5T.mjs +144 -0
- package/dist/configs/astro.cjs +11 -21
- package/dist/configs/astro.d.cts +3 -6
- package/dist/configs/astro.d.ts +3 -6
- package/dist/configs/astro.mjs +3 -3
- package/dist/configs/comments.cjs +9 -12
- package/dist/configs/comments.d.cts +3 -2
- package/dist/configs/comments.d.ts +3 -2
- package/dist/configs/comments.mjs +1 -2
- package/dist/configs/formatters.cjs +274 -0
- package/dist/configs/formatters.d.cts +11 -0
- package/dist/configs/formatters.d.ts +11 -0
- package/dist/configs/formatters.mjs +9 -0
- package/dist/configs/ignores.cjs +1 -8
- package/dist/configs/ignores.d.cts +3 -2
- package/dist/configs/ignores.d.ts +3 -2
- package/dist/configs/ignores.mjs +2 -2
- package/dist/configs/imports.cjs +35 -9
- package/dist/configs/imports.d.cts +13 -4
- package/dist/configs/imports.d.ts +13 -4
- package/dist/configs/imports.mjs +2 -2
- package/dist/configs/index.cjs +1104 -710
- package/dist/configs/index.d.cts +7 -18
- package/dist/configs/index.d.ts +7 -18
- package/dist/configs/index.mjs +40 -36
- package/dist/configs/javascript.cjs +9 -23
- package/dist/configs/javascript.d.cts +3 -6
- package/dist/configs/javascript.d.ts +3 -6
- package/dist/configs/javascript.mjs +2 -3
- package/dist/configs/jsdoc.cjs +6 -2
- package/dist/configs/jsdoc.d.cts +17 -4
- package/dist/configs/jsdoc.d.ts +17 -4
- package/dist/configs/jsdoc.mjs +2 -2
- package/dist/configs/jsonc.cjs +8 -11
- package/dist/configs/jsonc.d.cts +3 -6
- package/dist/configs/jsonc.d.ts +3 -6
- package/dist/configs/jsonc.mjs +3 -3
- package/dist/configs/markdown.cjs +46 -35
- package/dist/configs/markdown.d.cts +25 -4
- package/dist/configs/markdown.d.ts +25 -4
- package/dist/configs/markdown.mjs +3 -3
- package/dist/configs/nextjs.cjs +13 -11
- package/dist/configs/nextjs.d.cts +3 -6
- package/dist/configs/nextjs.d.ts +3 -6
- package/dist/configs/nextjs.mjs +3 -3
- package/dist/configs/node.cjs +0 -10
- package/dist/configs/node.d.cts +3 -2
- package/dist/configs/node.d.ts +3 -2
- package/dist/configs/node.mjs +1 -2
- package/dist/configs/perfectionist.cjs +2 -20
- package/dist/configs/perfectionist.d.cts +4 -3
- package/dist/configs/perfectionist.d.ts +4 -3
- package/dist/configs/perfectionist.mjs +1 -2
- package/dist/configs/react.cjs +201 -203
- package/dist/configs/react.d.cts +3 -6
- package/dist/configs/react.d.ts +3 -6
- package/dist/configs/react.mjs +3 -3
- package/dist/configs/sort.cjs +6 -6
- package/dist/configs/sort.d.cts +3 -2
- package/dist/configs/sort.d.ts +3 -2
- package/dist/configs/sort.mjs +1 -1
- package/dist/configs/stylistic.cjs +20 -11
- package/dist/configs/stylistic.d.cts +4 -7
- package/dist/configs/stylistic.d.ts +4 -7
- package/dist/configs/stylistic.mjs +4 -3
- package/dist/configs/tailwindcss.cjs +33 -47
- package/dist/configs/tailwindcss.d.cts +3 -6
- package/dist/configs/tailwindcss.d.ts +3 -6
- package/dist/configs/tailwindcss.mjs +3 -3
- package/dist/configs/test.cjs +103 -16
- package/dist/configs/test.d.cts +3 -6
- package/dist/configs/test.d.ts +3 -6
- package/dist/configs/test.mjs +4 -3
- package/dist/configs/toml.cjs +131 -0
- package/dist/configs/toml.d.cts +11 -0
- package/dist/configs/toml.d.ts +11 -0
- package/dist/configs/toml.mjs +8 -0
- package/dist/configs/typescript.cjs +32 -43
- package/dist/configs/typescript.d.cts +3 -6
- package/dist/configs/typescript.d.ts +3 -6
- package/dist/configs/typescript.mjs +3 -4
- package/dist/configs/unicorn.cjs +13 -10
- package/dist/configs/unicorn.d.cts +3 -2
- package/dist/configs/unicorn.d.ts +3 -2
- package/dist/configs/unicorn.mjs +1 -2
- package/dist/configs/unocss.cjs +48 -20
- package/dist/configs/unocss.d.cts +3 -6
- package/dist/configs/unocss.d.ts +3 -6
- package/dist/configs/unocss.mjs +3 -3
- package/dist/configs/vue.cjs +51 -15
- package/dist/configs/vue.d.cts +3 -6
- package/dist/configs/vue.d.ts +3 -6
- package/dist/configs/vue.mjs +3 -3
- package/dist/configs/yaml.cjs +17 -11
- package/dist/configs/yaml.d.cts +3 -6
- package/dist/configs/yaml.d.ts +3 -6
- package/dist/configs/yaml.mjs +3 -3
- package/dist/custom-rules/utils.cjs +31 -0
- package/dist/custom-rules/utils.d.cts +6 -0
- package/dist/custom-rules/utils.d.ts +6 -0
- package/dist/custom-rules/utils.mjs +6 -0
- package/dist/globs.cjs +157 -0
- package/dist/globs.d.cts +28 -0
- package/dist/globs.d.ts +28 -0
- package/dist/globs.mjs +56 -0
- package/dist/index.cjs +1246 -837
- package/dist/index.d.cts +10 -44
- package/dist/index.d.ts +10 -44
- package/dist/index.mjs +107 -147
- package/dist/types-spTEGSaV.d.cts +632 -0
- package/dist/types-spTEGSaV.d.ts +632 -0
- package/package.json +69 -37
- package/dist/chunk-24KJPXII.mjs +0 -51
- package/dist/chunk-4HH6LYJ6.mjs +0 -25
- package/dist/chunk-AL47KNVD.mjs +0 -37
- package/dist/chunk-C5VMTRKT.mjs +0 -18
- package/dist/chunk-ERFDRAGW.mjs +0 -86
- package/dist/chunk-HLDEUDLN.mjs +0 -28
- package/dist/chunk-O4O6V7LI.mjs +0 -70
- package/dist/chunk-UBPIYSHC.mjs +0 -284
- package/dist/types-h9izbkUX.d.cts +0 -241
- package/dist/types-h9izbkUX.d.ts +0 -241
- package/dist/{chunk-FKAOMYGL.mjs → chunk-ME2OAMS3.mjs} +0 -0
- package/dist/{chunk-FOIFEV73.mjs → chunk-XBASVDU6.mjs} +6 -6
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GLOB_ASTRO
|
|
3
|
-
} from "./chunk-R4NSLRAE.mjs";
|
|
4
1
|
import {
|
|
5
2
|
interop
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4YBQZLPS.mjs";
|
|
4
|
+
import {
|
|
5
|
+
GLOB_ASTRO
|
|
6
|
+
} from "./chunk-ATRL3UZP.mjs";
|
|
7
7
|
|
|
8
8
|
// src/configs/astro.ts
|
|
9
9
|
async function astro(options) {
|
|
10
10
|
const {
|
|
11
11
|
a11y = false,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
files = [GLOB_ASTRO],
|
|
13
|
+
overrides = {},
|
|
14
|
+
typescript = true
|
|
14
15
|
} = options;
|
|
15
|
-
await interop([
|
|
16
|
-
"eslint-plugin-astro",
|
|
17
|
-
"astro-eslint-parser",
|
|
18
|
-
...options.a11y ? ["eslint-plugin-jsx-a11y"] : []
|
|
19
|
-
]);
|
|
20
16
|
const [
|
|
21
17
|
pluginAstro,
|
|
22
18
|
parserAstro,
|
|
@@ -24,7 +20,7 @@ async function astro(options) {
|
|
|
24
20
|
] = await Promise.all([
|
|
25
21
|
interop(import("eslint-plugin-astro")),
|
|
26
22
|
interop(import("astro-eslint-parser")),
|
|
27
|
-
...
|
|
23
|
+
...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
|
|
28
24
|
]);
|
|
29
25
|
return [
|
|
30
26
|
{
|
|
@@ -35,7 +31,8 @@ async function astro(options) {
|
|
|
35
31
|
}
|
|
36
32
|
},
|
|
37
33
|
{
|
|
38
|
-
|
|
34
|
+
name: "luxass:astro:rules",
|
|
35
|
+
files,
|
|
39
36
|
languageOptions: {
|
|
40
37
|
// @ts-expect-error hmmm
|
|
41
38
|
globals: {
|
|
@@ -44,21 +41,22 @@ async function astro(options) {
|
|
|
44
41
|
parser: parserAstro,
|
|
45
42
|
parserOptions: {
|
|
46
43
|
extraFileExtensions: [".astro"],
|
|
47
|
-
parser:
|
|
44
|
+
parser: typescript ? await interop(import("@typescript-eslint/parser")) : null,
|
|
48
45
|
sourceType: "module"
|
|
49
46
|
}
|
|
50
47
|
},
|
|
51
|
-
name: "luxass:astro:rules",
|
|
52
48
|
// @ts-expect-error hmmm
|
|
53
49
|
rules: {
|
|
54
50
|
"style/jsx-closing-tag-location": "off",
|
|
55
51
|
"style/jsx-indent": "off",
|
|
56
52
|
"style/jsx-one-expression-per-line": "off",
|
|
57
53
|
...pluginAstro.configs.all.rules,
|
|
54
|
+
"style/multiline-ternary": ["error", "never"],
|
|
58
55
|
...overrides
|
|
59
56
|
}
|
|
60
57
|
},
|
|
61
58
|
{
|
|
59
|
+
name: "luxass:astro:rules:scripts",
|
|
62
60
|
files: [
|
|
63
61
|
"**/*.astro/*.js",
|
|
64
62
|
"*.astro/*.js"
|
|
@@ -71,8 +69,7 @@ async function astro(options) {
|
|
|
71
69
|
parserOptions: {
|
|
72
70
|
sourceType: "module"
|
|
73
71
|
}
|
|
74
|
-
}
|
|
75
|
-
name: "luxass:astro:rules:scripts"
|
|
72
|
+
}
|
|
76
73
|
}
|
|
77
74
|
];
|
|
78
75
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ensure,
|
|
3
|
+
interop
|
|
4
|
+
} from "./chunk-4YBQZLPS.mjs";
|
|
5
|
+
import {
|
|
6
|
+
GLOB_SRC
|
|
7
|
+
} from "./chunk-ATRL3UZP.mjs";
|
|
8
|
+
|
|
9
|
+
// src/configs/unocss.ts
|
|
10
|
+
async function unocss(options = {}) {
|
|
11
|
+
const {
|
|
12
|
+
attributify = true,
|
|
13
|
+
files = [GLOB_SRC],
|
|
14
|
+
overrides,
|
|
15
|
+
strict = false
|
|
16
|
+
} = options;
|
|
17
|
+
await ensure([
|
|
18
|
+
"@unocss/eslint-plugin"
|
|
19
|
+
]);
|
|
20
|
+
const [
|
|
21
|
+
pluginUnoCSS
|
|
22
|
+
] = await Promise.all([
|
|
23
|
+
interop(import("@unocss/eslint-plugin"))
|
|
24
|
+
]);
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
name: "luxass:unocss",
|
|
28
|
+
files,
|
|
29
|
+
plugins: {
|
|
30
|
+
unocss: pluginUnoCSS
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
"unocss/order": "warn",
|
|
34
|
+
...attributify ? {
|
|
35
|
+
"unocss/order-attributify": "warn"
|
|
36
|
+
} : {},
|
|
37
|
+
...strict ? {
|
|
38
|
+
"unocss/blocklist": "error"
|
|
39
|
+
} : {},
|
|
40
|
+
...overrides
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
unocss
|
|
48
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GLOB_SRC
|
|
3
|
-
} from "./chunk-R4NSLRAE.mjs";
|
|
4
|
-
import {
|
|
5
|
-
default as default2
|
|
6
|
-
} from "./chunk-C5VMTRKT.mjs";
|
|
7
1
|
import {
|
|
8
2
|
interop,
|
|
9
3
|
renameRules,
|
|
10
4
|
toArray
|
|
11
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4YBQZLPS.mjs";
|
|
6
|
+
import {
|
|
7
|
+
GLOB_SRC,
|
|
8
|
+
GLOB_TS,
|
|
9
|
+
GLOB_TSX
|
|
10
|
+
} from "./chunk-ATRL3UZP.mjs";
|
|
12
11
|
|
|
13
12
|
// src/configs/typescript.ts
|
|
14
13
|
import process from "node:process";
|
|
15
|
-
|
|
14
|
+
import pluginAntfu from "eslint-plugin-antfu";
|
|
15
|
+
async function typescript(options = {}) {
|
|
16
16
|
const {
|
|
17
|
-
|
|
17
|
+
exts = [],
|
|
18
18
|
overrides = {},
|
|
19
19
|
parserOptions = {}
|
|
20
20
|
} = options ?? {};
|
|
@@ -39,6 +39,11 @@ async function typescript(options) {
|
|
|
39
39
|
"ts/restrict-template-expressions": "error",
|
|
40
40
|
"ts/unbound-method": "error"
|
|
41
41
|
};
|
|
42
|
+
const files = options.files ?? [
|
|
43
|
+
GLOB_SRC,
|
|
44
|
+
...exts.map((ext) => `**/*.${ext}`)
|
|
45
|
+
];
|
|
46
|
+
const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
|
|
42
47
|
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
43
48
|
const [
|
|
44
49
|
pluginTs,
|
|
@@ -52,16 +57,17 @@ async function typescript(options) {
|
|
|
52
57
|
// Install the plugins without globs, so they can be configured separately.
|
|
53
58
|
name: "luxass:typescript:setup",
|
|
54
59
|
plugins: {
|
|
55
|
-
antfu:
|
|
60
|
+
antfu: pluginAntfu,
|
|
56
61
|
ts: pluginTs
|
|
57
62
|
}
|
|
58
63
|
},
|
|
59
64
|
{
|
|
60
|
-
|
|
65
|
+
name: "luxass:typescript:rules",
|
|
66
|
+
files,
|
|
61
67
|
languageOptions: {
|
|
62
68
|
parser: parserTs,
|
|
63
69
|
parserOptions: {
|
|
64
|
-
extraFileExtensions:
|
|
70
|
+
extraFileExtensions: exts.map((ext) => `.${ext}`),
|
|
65
71
|
sourceType: "module",
|
|
66
72
|
...tsconfigPath ? {
|
|
67
73
|
project: tsconfigPath,
|
|
@@ -70,7 +76,6 @@ async function typescript(options) {
|
|
|
70
76
|
...parserOptions
|
|
71
77
|
}
|
|
72
78
|
},
|
|
73
|
-
name: "luxass:typescript:rules",
|
|
74
79
|
rules: {
|
|
75
80
|
...renameRules(
|
|
76
81
|
pluginTs.configs["eslint-recommended"].overrides[0].rules,
|
|
@@ -82,9 +87,6 @@ async function typescript(options) {
|
|
|
82
87
|
"@typescript-eslint/",
|
|
83
88
|
"ts/"
|
|
84
89
|
),
|
|
85
|
-
"antfu/generic-spacing": "error",
|
|
86
|
-
"antfu/named-tuple-spacing": "error",
|
|
87
|
-
"antfu/no-cjs-exports": "error",
|
|
88
90
|
"no-dupe-class-members": "off",
|
|
89
91
|
"no-invalid-this": "off",
|
|
90
92
|
"no-loss-of-precision": "off",
|
|
@@ -98,41 +100,34 @@ async function typescript(options) {
|
|
|
98
100
|
"ts/ban-types": ["error", {
|
|
99
101
|
extendDefaults: false,
|
|
100
102
|
types: {
|
|
101
|
-
|
|
103
|
+
BigInt: {
|
|
102
104
|
fixWith: "bigint",
|
|
103
105
|
message: "Use `bigint` instead."
|
|
104
106
|
},
|
|
105
|
-
|
|
107
|
+
Boolean: {
|
|
106
108
|
fixWith: "boolean",
|
|
107
109
|
message: "Use `boolean` instead."
|
|
108
110
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
Function: "Use a specific function type instead, like `() => void`.",
|
|
112
|
+
Number: {
|
|
111
113
|
fixWith: "number",
|
|
112
114
|
message: "Use `number` instead."
|
|
113
115
|
},
|
|
114
|
-
|
|
116
|
+
Object: {
|
|
115
117
|
fixWith: "Record<string, unknown>",
|
|
116
118
|
message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848"
|
|
117
119
|
},
|
|
118
|
-
|
|
120
|
+
String: {
|
|
119
121
|
fixWith: "string",
|
|
120
122
|
message: "Use `string` instead."
|
|
121
123
|
},
|
|
122
|
-
|
|
124
|
+
Symbol: {
|
|
123
125
|
fixWith: "symbol",
|
|
124
126
|
message: "Use `symbol` instead."
|
|
125
127
|
},
|
|
126
|
-
|
|
127
|
-
message: "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead."
|
|
128
|
-
},
|
|
129
|
-
"object": {
|
|
128
|
+
object: {
|
|
130
129
|
fixWith: "Record<string, unknown>",
|
|
131
130
|
message: "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848"
|
|
132
|
-
},
|
|
133
|
-
"{}": {
|
|
134
|
-
fixWith: "Record<string, unknown>",
|
|
135
|
-
message: "The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead."
|
|
136
131
|
}
|
|
137
132
|
}
|
|
138
133
|
}],
|
|
@@ -161,13 +156,20 @@ async function typescript(options) {
|
|
|
161
156
|
"ts/prefer-ts-expect-error": "error",
|
|
162
157
|
"ts/triple-slash-reference": "off",
|
|
163
158
|
"ts/unified-signatures": "off",
|
|
159
|
+
...overrides
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: "luxass:typescript:rules-type-aware",
|
|
164
|
+
files: filesTypeAware,
|
|
165
|
+
rules: {
|
|
164
166
|
...tsconfigPath ? typeAwareRules : {},
|
|
165
167
|
...overrides
|
|
166
168
|
}
|
|
167
169
|
},
|
|
168
170
|
{
|
|
169
|
-
files: ["**/*.d.ts"],
|
|
170
171
|
name: "luxass:typescript:dts-overrides",
|
|
172
|
+
files: ["**/*.d.ts"],
|
|
171
173
|
rules: {
|
|
172
174
|
"eslint-comments/no-unlimited-disable": "off",
|
|
173
175
|
"import/no-duplicates": "off",
|
|
@@ -176,15 +178,15 @@ async function typescript(options) {
|
|
|
176
178
|
}
|
|
177
179
|
},
|
|
178
180
|
{
|
|
179
|
-
files: ["**/*.{test,spec}.ts?(x)"],
|
|
180
181
|
name: "luxass:typescript:tests-overrides",
|
|
182
|
+
files: ["**/*.{test,spec}.ts?(x)"],
|
|
181
183
|
rules: {
|
|
182
184
|
"no-unused-expressions": "off"
|
|
183
185
|
}
|
|
184
186
|
},
|
|
185
187
|
{
|
|
186
|
-
files: ["**/*.js", "**/*.cjs"],
|
|
187
188
|
name: "luxass:typescript:javascript-overrides",
|
|
189
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
188
190
|
rules: {
|
|
189
191
|
"ts/no-require-imports": "off",
|
|
190
192
|
"ts/no-var-requires": "off"
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ensure,
|
|
3
|
+
interop
|
|
4
|
+
} from "./chunk-4YBQZLPS.mjs";
|
|
1
5
|
import {
|
|
2
6
|
GLOB_NEXTJS_OG,
|
|
3
7
|
GLOB_NEXTJS_ROUTES,
|
|
4
8
|
GLOB_SRC
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
ensure,
|
|
8
|
-
interop
|
|
9
|
-
} from "./chunk-TQ476NL2.mjs";
|
|
9
|
+
} from "./chunk-ATRL3UZP.mjs";
|
|
10
10
|
|
|
11
11
|
// src/configs/nextjs.ts
|
|
12
12
|
async function nextjs(options = {}) {
|
|
13
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
files = [GLOB_SRC],
|
|
15
|
+
overrides,
|
|
16
|
+
rootDir
|
|
17
|
+
} = options;
|
|
14
18
|
await ensure([
|
|
15
19
|
"@next/eslint-plugin-next"
|
|
16
20
|
]);
|
|
@@ -23,8 +27,8 @@ async function nextjs(options = {}) {
|
|
|
23
27
|
}
|
|
24
28
|
},
|
|
25
29
|
{
|
|
26
|
-
files: [GLOB_SRC],
|
|
27
30
|
name: "luxass:nextjs:rules",
|
|
31
|
+
files,
|
|
28
32
|
rules: {
|
|
29
33
|
...pluginNextjs.configs.recommended.rules,
|
|
30
34
|
...pluginNextjs.configs["core-web-vitals"].rules,
|
|
@@ -63,16 +67,16 @@ async function nextjs(options = {}) {
|
|
|
63
67
|
}
|
|
64
68
|
},
|
|
65
69
|
{
|
|
66
|
-
files: GLOB_NEXTJS_ROUTES,
|
|
67
70
|
name: "luxass:nextjs:default-export-override",
|
|
71
|
+
files: GLOB_NEXTJS_ROUTES,
|
|
68
72
|
rules: {
|
|
69
73
|
"import/prefer-default-export": "error",
|
|
70
74
|
"react-refresh/only-export-components": "off"
|
|
71
75
|
}
|
|
72
76
|
},
|
|
73
77
|
{
|
|
74
|
-
files: GLOB_NEXTJS_OG,
|
|
75
78
|
name: "luxass:nextjs:og-override",
|
|
79
|
+
files: GLOB_NEXTJS_OG,
|
|
76
80
|
rules: {
|
|
77
81
|
"@next/next/no-img-element": "off",
|
|
78
82
|
"react/no-unknown-property": ["error", {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ensure,
|
|
3
|
+
interop
|
|
4
|
+
} from "./chunk-4YBQZLPS.mjs";
|
|
5
|
+
import {
|
|
6
|
+
GLOB_SRC
|
|
7
|
+
} from "./chunk-ATRL3UZP.mjs";
|
|
8
|
+
|
|
9
|
+
// src/configs/tailwindcss.ts
|
|
10
|
+
async function tailwindcss(options = {}) {
|
|
11
|
+
const {
|
|
12
|
+
files = [GLOB_SRC],
|
|
13
|
+
overrides
|
|
14
|
+
} = options;
|
|
15
|
+
await ensure([
|
|
16
|
+
"eslint-plugin-tailwindcss"
|
|
17
|
+
]);
|
|
18
|
+
const [
|
|
19
|
+
pluginTailwindCSS
|
|
20
|
+
] = await Promise.all([
|
|
21
|
+
interop(import("eslint-plugin-tailwindcss"))
|
|
22
|
+
]);
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
name: "luxass:tailwindcss:setup",
|
|
26
|
+
languageOptions: {
|
|
27
|
+
parserOptions: {
|
|
28
|
+
ecmaFeatures: {
|
|
29
|
+
jsx: true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
plugins: {
|
|
34
|
+
tailwind: pluginTailwindCSS
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "luxass:tailwindcss:rules",
|
|
39
|
+
files,
|
|
40
|
+
rules: {
|
|
41
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/classnames-order.md
|
|
42
|
+
"tailwind/classnames-order": "warn",
|
|
43
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-negative-arbitrary-values.md
|
|
44
|
+
"tailwind/enforces-negative-arbitrary-values": "warn",
|
|
45
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-shorthand.md
|
|
46
|
+
"tailwind/enforces-shorthand": "warn",
|
|
47
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/migration-from-tailwind-2.md
|
|
48
|
+
"tailwind/migration-from-tailwind-2": "warn",
|
|
49
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-arbitrary-value.md
|
|
50
|
+
"tailwind/no-arbitrary-value": "off",
|
|
51
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-contradicting-classname.md
|
|
52
|
+
"tailwind/no-contradicting-classname": "error",
|
|
53
|
+
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-custom-classname.md
|
|
54
|
+
"tailwind/no-custom-classname": "warn",
|
|
55
|
+
...overrides
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
tailwindcss
|
|
63
|
+
};
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GLOB_SRC,
|
|
3
3
|
GLOB_SRC_EXT
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
default as default2,
|
|
7
|
-
default5 as default3
|
|
8
|
-
} from "./chunk-C5VMTRKT.mjs";
|
|
4
|
+
} from "./chunk-ATRL3UZP.mjs";
|
|
9
5
|
|
|
10
6
|
// src/configs/javascript.ts
|
|
11
7
|
import globals from "globals";
|
|
8
|
+
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
9
|
+
import pluginAntfu from "eslint-plugin-antfu";
|
|
12
10
|
async function javascript(options = {}) {
|
|
13
|
-
const {
|
|
11
|
+
const { editor = false, overrides = {} } = options;
|
|
14
12
|
return [
|
|
15
13
|
{
|
|
14
|
+
name: "luxass:javascript",
|
|
16
15
|
languageOptions: {
|
|
17
16
|
ecmaVersion: 2022,
|
|
18
17
|
globals: {
|
|
@@ -35,10 +34,9 @@ async function javascript(options = {}) {
|
|
|
35
34
|
linterOptions: {
|
|
36
35
|
reportUnusedDisableDirectives: true
|
|
37
36
|
},
|
|
38
|
-
name: "luxass:javascript",
|
|
39
37
|
plugins: {
|
|
40
|
-
"antfu":
|
|
41
|
-
"unused-imports":
|
|
38
|
+
"antfu": pluginAntfu,
|
|
39
|
+
"unused-imports": pluginUnusedImports
|
|
42
40
|
},
|
|
43
41
|
rules: {
|
|
44
42
|
"accessor-pairs": [
|
|
@@ -64,7 +62,7 @@ async function javascript(options = {}) {
|
|
|
64
62
|
"no-compare-neg-zero": "error",
|
|
65
63
|
"no-cond-assign": ["error", "always"],
|
|
66
64
|
"no-console": [
|
|
67
|
-
|
|
65
|
+
editor ? "off" : "error",
|
|
68
66
|
{ allow: ["warn", "error"] }
|
|
69
67
|
],
|
|
70
68
|
"no-const-assign": "error",
|
|
@@ -111,8 +109,8 @@ async function javascript(options = {}) {
|
|
|
111
109
|
"no-regex-spaces": "error",
|
|
112
110
|
"no-restricted-globals": [
|
|
113
111
|
"error",
|
|
114
|
-
{ message: "Use `globalThis` instead."
|
|
115
|
-
{ message: "Use `globalThis` instead."
|
|
112
|
+
{ name: "global", message: "Use `globalThis` instead." },
|
|
113
|
+
{ name: "self", message: "Use `globalThis` instead." }
|
|
116
114
|
],
|
|
117
115
|
"no-restricted-properties": [
|
|
118
116
|
"error",
|
|
@@ -233,7 +231,7 @@ async function javascript(options = {}) {
|
|
|
233
231
|
],
|
|
234
232
|
"symbol-description": "error",
|
|
235
233
|
"unicode-bom": ["error", "never"],
|
|
236
|
-
"unused-imports/no-unused-imports":
|
|
234
|
+
"unused-imports/no-unused-imports": editor ? "off" : "error",
|
|
237
235
|
"unused-imports/no-unused-vars": [
|
|
238
236
|
"error",
|
|
239
237
|
{
|
|
@@ -254,8 +252,8 @@ async function javascript(options = {}) {
|
|
|
254
252
|
}
|
|
255
253
|
},
|
|
256
254
|
{
|
|
257
|
-
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
258
255
|
name: "luxass:scripts-overrides",
|
|
256
|
+
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
259
257
|
rules: {
|
|
260
258
|
"no-console": "off"
|
|
261
259
|
}
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
default as default2
|
|
3
|
-
} from "./chunk-C5VMTRKT.mjs";
|
|
4
1
|
import {
|
|
5
2
|
interop
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4YBQZLPS.mjs";
|
|
7
4
|
|
|
8
5
|
// src/configs/stylistic.ts
|
|
6
|
+
import pluginAntfu from "eslint-plugin-antfu";
|
|
7
|
+
var StylisticConfigDefaults = {
|
|
8
|
+
indent: 2,
|
|
9
|
+
jsx: true,
|
|
10
|
+
quotes: "double",
|
|
11
|
+
semi: true
|
|
12
|
+
};
|
|
9
13
|
async function stylistic(options = {}) {
|
|
10
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
indent,
|
|
16
|
+
jsx,
|
|
17
|
+
overrides = {},
|
|
18
|
+
quotes,
|
|
19
|
+
semi
|
|
20
|
+
} = {
|
|
21
|
+
...StylisticConfigDefaults,
|
|
22
|
+
...options
|
|
23
|
+
};
|
|
11
24
|
const pluginStylistic = await interop(import("@stylistic/eslint-plugin"));
|
|
12
25
|
const config = pluginStylistic.configs.customize({
|
|
13
26
|
flat: true,
|
|
@@ -21,23 +34,24 @@ async function stylistic(options = {}) {
|
|
|
21
34
|
{
|
|
22
35
|
name: "luxass:stylistic",
|
|
23
36
|
plugins: {
|
|
24
|
-
antfu:
|
|
37
|
+
antfu: pluginAntfu,
|
|
25
38
|
style: pluginStylistic
|
|
26
39
|
},
|
|
27
40
|
rules: {
|
|
28
41
|
...config.rules,
|
|
29
42
|
"antfu/consistent-list-newline": "error",
|
|
30
43
|
"antfu/if-newline": "off",
|
|
31
|
-
"antfu/indent-binary-ops": ["error", { indent }],
|
|
32
44
|
"antfu/top-level-function": "error",
|
|
33
45
|
"curly": ["error", "multi-line", "consistent"],
|
|
34
46
|
"style/arrow-parens": ["error", "always", { requireForBlockBody: true }],
|
|
35
|
-
"style/brace-style": ["error", "1tbs", { allowSingleLine: true }]
|
|
47
|
+
"style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
48
|
+
...overrides
|
|
36
49
|
}
|
|
37
50
|
}
|
|
38
51
|
];
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
export {
|
|
55
|
+
StylisticConfigDefaults,
|
|
42
56
|
stylistic
|
|
43
57
|
};
|
|
@@ -1,41 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
default4 as default2
|
|
3
|
-
} from "./chunk-C5VMTRKT.mjs";
|
|
4
|
-
|
|
5
1
|
// src/configs/unicorn.ts
|
|
2
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
6
3
|
function unicorn() {
|
|
7
4
|
return [
|
|
8
5
|
{
|
|
9
6
|
name: "luxass:unicorn",
|
|
10
7
|
plugins: {
|
|
11
|
-
unicorn:
|
|
8
|
+
unicorn: pluginUnicorn
|
|
12
9
|
},
|
|
13
10
|
rules: {
|
|
14
11
|
// Pass error message when throwing errors
|
|
12
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/error-message.md
|
|
15
13
|
"unicorn/error-message": "error",
|
|
16
14
|
// Uppercase regex escapes
|
|
15
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/escape-case.md
|
|
17
16
|
"unicorn/escape-case": "error",
|
|
18
17
|
// Array.isArray instead of instanceof
|
|
18
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-array.md
|
|
19
19
|
"unicorn/no-instanceof-array": "error",
|
|
20
20
|
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
21
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-array.md
|
|
21
22
|
"unicorn/no-new-array": "error",
|
|
22
23
|
// Prevent deprecated `new Buffer()`
|
|
24
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-buffer.md
|
|
23
25
|
"unicorn/no-new-buffer": "error",
|
|
24
26
|
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
27
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/number-literal-case.md
|
|
25
28
|
"unicorn/number-literal-case": "error",
|
|
26
29
|
// textContent instead of innerText
|
|
30
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-text-content.md
|
|
27
31
|
"unicorn/prefer-dom-node-text-content": "error",
|
|
28
32
|
// includes over indexOf when checking for existence
|
|
33
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes.md
|
|
29
34
|
"unicorn/prefer-includes": "error",
|
|
30
35
|
// Prefer using the node: protocol
|
|
36
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
31
37
|
"unicorn/prefer-node-protocol": "error",
|
|
32
38
|
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
39
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-properties.md
|
|
33
40
|
"unicorn/prefer-number-properties": "error",
|
|
34
41
|
// String methods startsWith/endsWith instead of more complicated stuff
|
|
42
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md
|
|
35
43
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
36
44
|
// Enforce throwing type error when throwing error while checking typeof
|
|
45
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-type-error.md
|
|
37
46
|
"unicorn/prefer-type-error": "error",
|
|
38
47
|
// Use new when throwing error
|
|
48
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md
|
|
39
49
|
"unicorn/throw-new-error": "error"
|
|
40
50
|
}
|
|
41
51
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
interop
|
|
3
|
+
} from "./chunk-4YBQZLPS.mjs";
|
|
4
|
+
import {
|
|
5
|
+
GLOB_TOML
|
|
6
|
+
} from "./chunk-ATRL3UZP.mjs";
|
|
7
|
+
|
|
8
|
+
// src/configs/toml.ts
|
|
9
|
+
async function toml(options = {}) {
|
|
10
|
+
const {
|
|
11
|
+
files = [GLOB_TOML],
|
|
12
|
+
overrides = {},
|
|
13
|
+
stylistic = true
|
|
14
|
+
} = options;
|
|
15
|
+
const {
|
|
16
|
+
indent = 2
|
|
17
|
+
} = typeof stylistic === "boolean" ? {} : stylistic;
|
|
18
|
+
const [
|
|
19
|
+
pluginToml,
|
|
20
|
+
parserToml
|
|
21
|
+
] = await Promise.all([
|
|
22
|
+
interop(import("eslint-plugin-toml")),
|
|
23
|
+
interop(import("toml-eslint-parser"))
|
|
24
|
+
]);
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
name: "luxass:toml:setup",
|
|
28
|
+
plugins: {
|
|
29
|
+
toml: pluginToml
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "luxass:toml:rules",
|
|
34
|
+
files,
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parser: parserToml
|
|
37
|
+
},
|
|
38
|
+
rules: {
|
|
39
|
+
"style/spaced-comment": "off",
|
|
40
|
+
"toml/comma-style": "error",
|
|
41
|
+
"toml/keys-order": "error",
|
|
42
|
+
"toml/no-space-dots": "error",
|
|
43
|
+
"toml/no-unreadable-number-separator": "error",
|
|
44
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
45
|
+
"toml/precision-of-integer": "error",
|
|
46
|
+
"toml/tables-order": "error",
|
|
47
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
48
|
+
...stylistic ? {
|
|
49
|
+
"toml/array-bracket-newline": "error",
|
|
50
|
+
"toml/array-bracket-spacing": "error",
|
|
51
|
+
"toml/array-element-newline": "error",
|
|
52
|
+
"toml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
53
|
+
"toml/inline-table-curly-spacing": "error",
|
|
54
|
+
"toml/key-spacing": "error",
|
|
55
|
+
"toml/padding-line-between-pairs": "error",
|
|
56
|
+
"toml/padding-line-between-tables": "error",
|
|
57
|
+
"toml/quoted-keys": "error",
|
|
58
|
+
"toml/spaced-comment": "error",
|
|
59
|
+
"toml/table-bracket-spacing": "error"
|
|
60
|
+
} : {},
|
|
61
|
+
...overrides
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
toml
|
|
69
|
+
};
|