@luxass/eslint-config 4.18.0 → 4.19.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 +2 -3
- package/dist/index.d.ts +9120 -9820
- package/dist/index.js +2087 -2569
- package/package.json +36 -38
- package/dist/index.cjs +0 -2796
- package/dist/index.d.cts +0 -17519
package/dist/index.js
CHANGED
|
@@ -1,2687 +1,2205 @@
|
|
|
1
|
-
// src/factory.ts
|
|
2
1
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
|
-
import { isPackageExists
|
|
2
|
+
import { isPackageExists } from "local-pkg";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import eslintCommentsPlugin from "@eslint-community/eslint-plugin-eslint-comments";
|
|
6
|
+
import pluginAntfu from "eslint-plugin-antfu";
|
|
7
|
+
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
8
|
+
import globals from "globals";
|
|
9
|
+
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
10
|
+
import pluginNode from "eslint-plugin-n";
|
|
11
|
+
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
12
|
+
import { configs } from "eslint-plugin-regexp";
|
|
13
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
4
14
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
15
|
+
//#region src/globs.ts
|
|
16
|
+
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
17
|
+
const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
18
|
+
const GLOB_JS = "**/*.?([cm])js";
|
|
19
|
+
const GLOB_JSX = "**/*.?([cm])jsx";
|
|
20
|
+
const GLOB_TS = "**/*.?([cm])ts";
|
|
21
|
+
const GLOB_TSX = "**/*.?([cm])tsx";
|
|
22
|
+
const GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
23
|
+
const GLOB_CSS = "**/*.css";
|
|
24
|
+
const GLOB_POSTCSS = "**/*.{p,post}css";
|
|
25
|
+
const GLOB_LESS = "**/*.less";
|
|
26
|
+
const GLOB_SCSS = "**/*.scss";
|
|
27
|
+
const GLOB_JSON = "**/*.json";
|
|
28
|
+
const GLOB_JSON5 = "**/*.json5";
|
|
29
|
+
const GLOB_JSONC = "**/*.jsonc";
|
|
30
|
+
const GLOB_MARKDOWN = "**/*.md";
|
|
31
|
+
const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
32
|
+
const GLOB_SVELTE = "**/*.svelte";
|
|
33
|
+
const GLOB_VUE = "**/*.vue";
|
|
34
|
+
const GLOB_YAML = "**/*.y?(a)ml";
|
|
35
|
+
const GLOB_TOML = "**/*.toml";
|
|
36
|
+
const GLOB_HTML = "**/*.htm?(l)";
|
|
37
|
+
const GLOB_ASTRO = "**/*.astro";
|
|
38
|
+
const GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
39
|
+
const GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
40
|
+
const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
41
|
+
const GLOB_TESTS = [
|
|
42
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
43
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
44
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
45
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
46
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
37
47
|
];
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
const GLOB_NEXTJS_OG = [
|
|
49
|
+
`**/app/**/opengraph-image.[jt]s?(x)`,
|
|
50
|
+
`**/app/**/twitter-image.[jt]s?(x)`,
|
|
51
|
+
`**/app/**/route.[jt]s?(x)`
|
|
42
52
|
];
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
const GLOB_NEXTJS_ROUTES = [
|
|
54
|
+
`**/app/**/page.${GLOB_SRC_EXT}`,
|
|
55
|
+
`**/app/**/layout.${GLOB_SRC_EXT}`,
|
|
56
|
+
`**/app/**/error.${GLOB_SRC_EXT}`,
|
|
57
|
+
`**/app/**/template.${GLOB_SRC_EXT}`,
|
|
58
|
+
`**/app/**/not-found.${GLOB_SRC_EXT}`,
|
|
59
|
+
`**/app/**/loading.${GLOB_SRC_EXT}`,
|
|
60
|
+
`**/app/**/robots.${GLOB_SRC_EXT}`,
|
|
61
|
+
`**/app/**/sitemap.${GLOB_SRC_EXT}`,
|
|
62
|
+
`**/pages/**/*.${GLOB_SRC_EXT}`
|
|
53
63
|
];
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
64
|
+
const GLOB_EXCLUDE = [
|
|
65
|
+
"**/node_modules",
|
|
66
|
+
"**/dist",
|
|
67
|
+
"**/out",
|
|
68
|
+
"**/build",
|
|
69
|
+
"**/package-lock.json",
|
|
70
|
+
"**/yarn.lock",
|
|
71
|
+
"**/pnpm-lock.yaml",
|
|
72
|
+
"**/bun.lockb",
|
|
73
|
+
"**/output",
|
|
74
|
+
"**/coverage",
|
|
75
|
+
"**/temp",
|
|
76
|
+
"**/.temp",
|
|
77
|
+
"**/tmp",
|
|
78
|
+
"**/.tmp",
|
|
79
|
+
"**/.history",
|
|
80
|
+
"**/.vitepress/cache",
|
|
81
|
+
"**/.nuxt",
|
|
82
|
+
"**/.next",
|
|
83
|
+
"**/.vercel",
|
|
84
|
+
"**/.netlify",
|
|
85
|
+
"**/.changeset",
|
|
86
|
+
"**/.idea",
|
|
87
|
+
"**/.cache",
|
|
88
|
+
"**/.output",
|
|
89
|
+
"**/.vite-inspect",
|
|
90
|
+
"**/.astro",
|
|
91
|
+
"**/CHANGELOG*.md",
|
|
92
|
+
"**/*.min.*",
|
|
93
|
+
"**/LICENSE*",
|
|
94
|
+
"**/__snapshots__",
|
|
95
|
+
"**/auto-import?(s).d.ts",
|
|
96
|
+
"**/components.d.ts"
|
|
87
97
|
];
|
|
88
98
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Program: []
|
|
112
|
-
}
|
|
113
|
-
})
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/utils.ts
|
|
101
|
+
const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
102
|
+
const isCwdInScope = isPackageExists("@luxass/eslint-config");
|
|
103
|
+
const parserPlain = {
|
|
104
|
+
meta: { name: "parser-plain" },
|
|
105
|
+
parseForESLint: (code) => ({
|
|
106
|
+
ast: {
|
|
107
|
+
body: [],
|
|
108
|
+
comments: [],
|
|
109
|
+
loc: {
|
|
110
|
+
end: code.length,
|
|
111
|
+
start: 0
|
|
112
|
+
},
|
|
113
|
+
range: [0, code.length],
|
|
114
|
+
tokens: [],
|
|
115
|
+
type: "Program"
|
|
116
|
+
},
|
|
117
|
+
scopeManager: null,
|
|
118
|
+
services: { isPlain: true },
|
|
119
|
+
visitorKeys: { Program: [] }
|
|
120
|
+
})
|
|
114
121
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Combine array and non-array configs into a single array.
|
|
124
|
+
*/
|
|
125
|
+
async function combine(...configs$1) {
|
|
126
|
+
const resolved = await Promise.all(configs$1);
|
|
127
|
+
return resolved.flat();
|
|
118
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Rename plugin prefixes in a rule object.
|
|
131
|
+
* Accepts a map of prefixes to rename.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* import { renameRules } from "@luxass/eslint-config";
|
|
136
|
+
*
|
|
137
|
+
* export default [{
|
|
138
|
+
* rules: renameRules(
|
|
139
|
+
* {
|
|
140
|
+
* "@typescript-eslint/indent": "error"
|
|
141
|
+
* },
|
|
142
|
+
* { "@typescript-eslint": "ts" }
|
|
143
|
+
* )
|
|
144
|
+
* }]
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
119
147
|
function renameRules(rules, map) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return [to + key.slice(from.length), value];
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return [key, value];
|
|
128
|
-
})
|
|
129
|
-
);
|
|
148
|
+
return Object.fromEntries(Object.entries(rules).map(([key, value]) => {
|
|
149
|
+
for (const [from, to] of Object.entries(map)) if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];
|
|
150
|
+
return [key, value];
|
|
151
|
+
}));
|
|
130
152
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Rename plugin names a flat configs array
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* import { renamePluginInConfigs } from "@luxass/eslint-config";
|
|
159
|
+
* import someConfigs from "./some-configs";
|
|
160
|
+
*
|
|
161
|
+
* export default renamePluginInConfigs(someConfigs, {
|
|
162
|
+
* "@typescript-eslint": "ts",
|
|
163
|
+
* "@stylistic": "style",
|
|
164
|
+
* })
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
function renamePluginInConfigs(configs$1, map) {
|
|
168
|
+
return configs$1.map((i) => {
|
|
169
|
+
const clone = { ...i };
|
|
170
|
+
if (clone.rules) clone.rules = renameRules(clone.rules, map);
|
|
171
|
+
if (clone.plugins) clone.plugins = Object.fromEntries(Object.entries(clone.plugins).map(([key, value]) => {
|
|
172
|
+
if (key in map) return [map[key], value];
|
|
173
|
+
return [key, value];
|
|
174
|
+
}));
|
|
175
|
+
return clone;
|
|
176
|
+
});
|
|
149
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Convert a value to an array.
|
|
180
|
+
* If the value is an array, return it as is.
|
|
181
|
+
* Otherwise, return the value as the only element in an array.
|
|
182
|
+
*
|
|
183
|
+
* @param {T | T[]} value - Value to convert to an array.
|
|
184
|
+
* @returns {T[]} - The value as an array.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```ts
|
|
188
|
+
* import { toArray } from "@luxass/eslint-config";
|
|
189
|
+
*
|
|
190
|
+
* toArray("foo") // ["foo"]
|
|
191
|
+
* toArray(["foo"]) // ["foo"]
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
150
194
|
function toArray(value) {
|
|
151
|
-
|
|
195
|
+
return Array.isArray(value) ? value : [value];
|
|
152
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Import a module and return the default export.
|
|
199
|
+
* If the module does not have a default export, return the module itself.
|
|
200
|
+
*
|
|
201
|
+
* @param {Promise<T>} m - Module to import.
|
|
202
|
+
* @returns {Promise<T extends { default: infer U } ? U : T>} - The default export or the module itself.
|
|
203
|
+
* @template T
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```ts
|
|
207
|
+
* import { interop } from "@luxass/eslint-config";
|
|
208
|
+
*
|
|
209
|
+
* const module = await interop(import("module"));
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
153
212
|
async function interop(m) {
|
|
154
|
-
|
|
155
|
-
|
|
213
|
+
const resolved = await m;
|
|
214
|
+
return resolved.default || resolved;
|
|
156
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Ensure that packages are installed.
|
|
218
|
+
* If the packages are not installed, prompt the user to install them.
|
|
219
|
+
*
|
|
220
|
+
* @param {string[]} packages - Packages to ensure are installed.
|
|
221
|
+
* @returns {Promise<void>} - A promise that resolves when the packages are installed.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```ts
|
|
225
|
+
* import { ensure } from "@luxass/eslint-config";
|
|
226
|
+
*
|
|
227
|
+
* await ensure(["eslint-plugin-jsdoc"]);
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
157
230
|
async function ensure(packages) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const p = await import("@clack/prompts");
|
|
167
|
-
const result = await p.confirm({
|
|
168
|
-
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
|
|
169
|
-
});
|
|
170
|
-
if (result) {
|
|
171
|
-
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
172
|
-
}
|
|
231
|
+
if (process.env.CI || process.stdout.isTTY === false || isCwdInScope === false) return;
|
|
232
|
+
const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
|
|
233
|
+
if (nonExistingPackages.length === 0) return;
|
|
234
|
+
const p = await import("@clack/prompts");
|
|
235
|
+
const result = await p.confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` });
|
|
236
|
+
if (result) await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
173
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Resolve sub-options from a config options object.
|
|
240
|
+
*
|
|
241
|
+
* @param {ConfigOptions} options - The config options object.
|
|
242
|
+
* @template K - The key of the sub-options to resolve.
|
|
243
|
+
* @param {K} key - The key of the sub-options to resolve.
|
|
244
|
+
* @returns {ResolvedOptions<ConfigOptions[K]>} - The resolved sub-options.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* import { resolveSubOptions } from "@luxass/eslint-config";
|
|
249
|
+
*
|
|
250
|
+
* const options = {
|
|
251
|
+
* foo: {
|
|
252
|
+
* bar: true,
|
|
253
|
+
* },
|
|
254
|
+
* };
|
|
255
|
+
*
|
|
256
|
+
* const subOptions = resolveSubOptions(options, "foo");
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
174
259
|
function resolveSubOptions(options, key) {
|
|
175
|
-
|
|
260
|
+
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
176
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Get overrides from a config options object.
|
|
264
|
+
* @param {ConfigOptions} options The config options object.
|
|
265
|
+
* @template K The key of the sub-options to resolve.
|
|
266
|
+
* @param {K} key The key of the sub-options to resolve.
|
|
267
|
+
* @returns {Partial<Linter.RulesRecord & RuleOptions>} The overrides.
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```ts
|
|
271
|
+
* import { getOverrides } from "@luxass/eslint-config";
|
|
272
|
+
*
|
|
273
|
+
* const options = {
|
|
274
|
+
* overrides: {
|
|
275
|
+
* rules: {
|
|
276
|
+
* "no-console": "off",
|
|
277
|
+
* },
|
|
278
|
+
* },
|
|
279
|
+
* };
|
|
280
|
+
*
|
|
281
|
+
* const overrides = getOverrides(options, "overrides");
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
177
284
|
function getOverrides(options, key) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
..."overrides" in sub ? sub.overrides : {}
|
|
181
|
-
};
|
|
285
|
+
const sub = resolveSubOptions(options, key);
|
|
286
|
+
return { ..."overrides" in sub ? sub.overrides : {} };
|
|
182
287
|
}
|
|
183
288
|
function isPackageInScope(name) {
|
|
184
|
-
|
|
289
|
+
return isPackageExists(name, { paths: [scopeUrl] });
|
|
185
290
|
}
|
|
186
291
|
function isInEditorEnv() {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (isInGitHooksOrLintStaged()) {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
|
|
292
|
+
if (process.env.CI) return false;
|
|
293
|
+
if (isInGitHooksOrLintStaged()) return false;
|
|
294
|
+
return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
|
|
194
295
|
}
|
|
195
296
|
function isInGitHooksOrLintStaged() {
|
|
196
|
-
|
|
297
|
+
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
197
298
|
}
|
|
198
299
|
|
|
199
|
-
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/configs/astro.ts
|
|
200
302
|
async function astro(options = {}) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
"astro/no-conflict-set-directives": "error",
|
|
246
|
-
"astro/no-deprecated-astro-canonicalurl": "error",
|
|
247
|
-
"astro/no-deprecated-astro-fetchcontent": "error",
|
|
248
|
-
"astro/no-deprecated-astro-resolve": "error",
|
|
249
|
-
"astro/no-deprecated-getentrybyslug": "error",
|
|
250
|
-
"astro/no-set-html-directive": "off",
|
|
251
|
-
"astro/no-unused-define-vars-in-style": "error",
|
|
252
|
-
"astro/semi": "off",
|
|
253
|
-
"astro/valid-compile": "error",
|
|
254
|
-
...stylistic2 ? {
|
|
255
|
-
"style/indent": "off",
|
|
256
|
-
"style/jsx-closing-tag-location": "off",
|
|
257
|
-
"style/jsx-one-expression-per-line": "off",
|
|
258
|
-
"style/no-multiple-empty-lines": "off"
|
|
259
|
-
} : {},
|
|
260
|
-
...overrides
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
];
|
|
303
|
+
const { files = [GLOB_ASTRO], overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
304
|
+
await ensure(["eslint-plugin-astro", "astro-eslint-parser"]);
|
|
305
|
+
const [pluginAstro, parserAstro, parserTs] = await Promise.all([
|
|
306
|
+
interop(import("eslint-plugin-astro")),
|
|
307
|
+
interop(import("astro-eslint-parser")),
|
|
308
|
+
interop(import("@typescript-eslint/parser"))
|
|
309
|
+
]);
|
|
310
|
+
return [{
|
|
311
|
+
name: "luxass/astro/setup",
|
|
312
|
+
plugins: { astro: pluginAstro }
|
|
313
|
+
}, {
|
|
314
|
+
files,
|
|
315
|
+
languageOptions: {
|
|
316
|
+
globals: pluginAstro.environments.astro.globals,
|
|
317
|
+
parser: parserAstro,
|
|
318
|
+
parserOptions: {
|
|
319
|
+
extraFileExtensions: [".astro"],
|
|
320
|
+
parser: parserTs
|
|
321
|
+
},
|
|
322
|
+
sourceType: "module"
|
|
323
|
+
},
|
|
324
|
+
name: "luxass/astro/rules",
|
|
325
|
+
processor: "astro/client-side-ts",
|
|
326
|
+
rules: {
|
|
327
|
+
"antfu/no-top-level-await": "off",
|
|
328
|
+
"astro/missing-client-only-directive-value": "error",
|
|
329
|
+
"astro/no-conflict-set-directives": "error",
|
|
330
|
+
"astro/no-deprecated-astro-canonicalurl": "error",
|
|
331
|
+
"astro/no-deprecated-astro-fetchcontent": "error",
|
|
332
|
+
"astro/no-deprecated-astro-resolve": "error",
|
|
333
|
+
"astro/no-deprecated-getentrybyslug": "error",
|
|
334
|
+
"astro/no-set-html-directive": "off",
|
|
335
|
+
"astro/no-unused-define-vars-in-style": "error",
|
|
336
|
+
"astro/semi": "off",
|
|
337
|
+
"astro/valid-compile": "error",
|
|
338
|
+
...stylistic$1 ? {
|
|
339
|
+
"style/indent": "off",
|
|
340
|
+
"style/jsx-closing-tag-location": "off",
|
|
341
|
+
"style/jsx-one-expression-per-line": "off",
|
|
342
|
+
"style/no-multiple-empty-lines": "off"
|
|
343
|
+
} : {},
|
|
344
|
+
...overrides
|
|
345
|
+
}
|
|
346
|
+
}];
|
|
264
347
|
}
|
|
265
348
|
|
|
266
|
-
|
|
267
|
-
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/configs/comments.ts
|
|
268
351
|
async function comments() {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
"eslint-comments/no-duplicate-disable": "error",
|
|
280
|
-
// https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-unlimited-disable.md
|
|
281
|
-
"eslint-comments/no-unlimited-disable": "error",
|
|
282
|
-
// https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-unused-enable.md
|
|
283
|
-
"eslint-comments/no-unused-enable": "error"
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
];
|
|
352
|
+
return [{
|
|
353
|
+
name: "luxass/eslint-comments",
|
|
354
|
+
plugins: { "eslint-comments": eslintCommentsPlugin },
|
|
355
|
+
rules: {
|
|
356
|
+
"eslint-comments/no-aggregating-enable": "error",
|
|
357
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
358
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
359
|
+
"eslint-comments/no-unused-enable": "error"
|
|
360
|
+
}
|
|
361
|
+
}];
|
|
287
362
|
}
|
|
288
363
|
|
|
289
|
-
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/configs/disables.ts
|
|
290
366
|
async function disables() {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
"antfu/no-top-level-await": "off",
|
|
347
|
-
"no-console": "off",
|
|
348
|
-
"ts/explicit-function-return-type": "off"
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
];
|
|
367
|
+
return [
|
|
368
|
+
{
|
|
369
|
+
files: [`**/scripts/${GLOB_SRC}`],
|
|
370
|
+
name: "luxass/disables/scripts",
|
|
371
|
+
rules: {
|
|
372
|
+
"antfu/no-top-level-await": "off",
|
|
373
|
+
"no-console": "off",
|
|
374
|
+
"ts/explicit-function-return-type": "off"
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
379
|
+
name: "luxass/disables/cli",
|
|
380
|
+
rules: {
|
|
381
|
+
"antfu/no-top-level-await": "off",
|
|
382
|
+
"no-console": "off"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
387
|
+
name: "luxass/disables/bin",
|
|
388
|
+
rules: {
|
|
389
|
+
"antfu/no-import-dist": "off",
|
|
390
|
+
"antfu/no-import-node-modules-by-path": "off"
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
files: ["**/*.d.?([cm])ts"],
|
|
395
|
+
name: "luxass/disables/dts",
|
|
396
|
+
rules: {
|
|
397
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
398
|
+
"no-restricted-syntax": "off",
|
|
399
|
+
"unused-imports/no-unused-vars": "off"
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
404
|
+
name: "luxass/disables/cjs",
|
|
405
|
+
rules: { "ts/no-require-imports": "off" }
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
files: ["**/.github/workflows/*.{yml,yaml}"],
|
|
409
|
+
name: "luxass/disables/github-actions",
|
|
410
|
+
rules: { "yaml/no-empty-mapping-value": "off" }
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
|
|
414
|
+
name: "luxass/disables/config-files",
|
|
415
|
+
rules: {
|
|
416
|
+
"antfu/no-top-level-await": "off",
|
|
417
|
+
"no-console": "off",
|
|
418
|
+
"ts/explicit-function-return-type": "off"
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
];
|
|
352
422
|
}
|
|
353
423
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/configs/stylistic.ts
|
|
426
|
+
const StylisticConfigDefaults = {
|
|
427
|
+
indent: 2,
|
|
428
|
+
jsx: true,
|
|
429
|
+
quotes: "double",
|
|
430
|
+
semi: true
|
|
361
431
|
};
|
|
362
432
|
async function stylistic(options = {}) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
433
|
+
const { indent, jsx: jsx$1, overrides = {}, quotes, semi } = {
|
|
434
|
+
...StylisticConfigDefaults,
|
|
435
|
+
...options
|
|
436
|
+
};
|
|
437
|
+
const pluginStylistic = await interop(import("@stylistic/eslint-plugin"));
|
|
438
|
+
const config = pluginStylistic.configs.customize({
|
|
439
|
+
indent,
|
|
440
|
+
jsx: jsx$1,
|
|
441
|
+
pluginName: "style",
|
|
442
|
+
quotes,
|
|
443
|
+
semi
|
|
444
|
+
});
|
|
445
|
+
return [{
|
|
446
|
+
name: "luxass/stylistic",
|
|
447
|
+
plugins: {
|
|
448
|
+
antfu: pluginAntfu,
|
|
449
|
+
style: pluginStylistic
|
|
450
|
+
},
|
|
451
|
+
rules: {
|
|
452
|
+
...config.rules,
|
|
453
|
+
"antfu/consistent-list-newline": "error",
|
|
454
|
+
"antfu/if-newline": "off",
|
|
455
|
+
"antfu/top-level-function": "error",
|
|
456
|
+
"curly": [
|
|
457
|
+
"error",
|
|
458
|
+
"multi-line",
|
|
459
|
+
"consistent"
|
|
460
|
+
],
|
|
461
|
+
"style/arrow-parens": [
|
|
462
|
+
"error",
|
|
463
|
+
"always",
|
|
464
|
+
{ requireForBlockBody: true }
|
|
465
|
+
],
|
|
466
|
+
"style/brace-style": [
|
|
467
|
+
"error",
|
|
468
|
+
"1tbs",
|
|
469
|
+
{ allowSingleLine: true }
|
|
470
|
+
],
|
|
471
|
+
"style/generator-star-spacing": ["error", {
|
|
472
|
+
after: true,
|
|
473
|
+
before: false
|
|
474
|
+
}],
|
|
475
|
+
"style/padding-line-between-statements": [
|
|
476
|
+
"error",
|
|
477
|
+
{
|
|
478
|
+
blankLine: "always",
|
|
479
|
+
next: "*",
|
|
480
|
+
prev: "import"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
blankLine: "any",
|
|
484
|
+
next: "import",
|
|
485
|
+
prev: "import"
|
|
486
|
+
}
|
|
487
|
+
],
|
|
488
|
+
"style/yield-star-spacing": ["error", {
|
|
489
|
+
after: true,
|
|
490
|
+
before: false
|
|
491
|
+
}],
|
|
492
|
+
...overrides
|
|
493
|
+
}
|
|
494
|
+
}];
|
|
402
495
|
}
|
|
403
496
|
|
|
404
|
-
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/configs/formatters.ts
|
|
405
499
|
function mergePrettierOptions(options, overrides = {}) {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
...options.plugins || []
|
|
412
|
-
]
|
|
413
|
-
};
|
|
500
|
+
return {
|
|
501
|
+
...options,
|
|
502
|
+
...overrides,
|
|
503
|
+
plugins: [...overrides.plugins || [], ...options.plugins || []]
|
|
504
|
+
};
|
|
414
505
|
}
|
|
415
|
-
async function formatters(options = {},
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
languageOptions: {
|
|
501
|
-
parser: parserPlain
|
|
502
|
-
},
|
|
503
|
-
name: "luxass/formatter/less",
|
|
504
|
-
rules: {
|
|
505
|
-
"format/prettier": [
|
|
506
|
-
"error",
|
|
507
|
-
mergePrettierOptions(prettierOptions, {
|
|
508
|
-
parser: "less"
|
|
509
|
-
})
|
|
510
|
-
]
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
);
|
|
514
|
-
}
|
|
515
|
-
if (options.html) {
|
|
516
|
-
configs2.push({
|
|
517
|
-
files: [GLOB_HTML],
|
|
518
|
-
languageOptions: {
|
|
519
|
-
parser: parserPlain
|
|
520
|
-
},
|
|
521
|
-
name: "luxass/formatter/html",
|
|
522
|
-
rules: {
|
|
523
|
-
"format/prettier": [
|
|
524
|
-
"error",
|
|
525
|
-
mergePrettierOptions(prettierOptions, {
|
|
526
|
-
parser: "html"
|
|
527
|
-
})
|
|
528
|
-
]
|
|
529
|
-
}
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
if (options.markdown) {
|
|
533
|
-
const formatter = options.markdown === true ? "prettier" : options.markdown;
|
|
534
|
-
configs2.push({
|
|
535
|
-
files: [GLOB_MARKDOWN],
|
|
536
|
-
languageOptions: {
|
|
537
|
-
parser: parserPlain
|
|
538
|
-
},
|
|
539
|
-
name: "luxass/formatter/markdown",
|
|
540
|
-
rules: {
|
|
541
|
-
[`format/${formatter}`]: [
|
|
542
|
-
"error",
|
|
543
|
-
formatter === "prettier" ? mergePrettierOptions(prettierOptions, {
|
|
544
|
-
embeddedLanguageFormatting: "off",
|
|
545
|
-
parser: "markdown"
|
|
546
|
-
}) : {
|
|
547
|
-
...dprintOptions,
|
|
548
|
-
language: "markdown"
|
|
549
|
-
}
|
|
550
|
-
]
|
|
551
|
-
}
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
if (options.astro) {
|
|
555
|
-
configs2.push({
|
|
556
|
-
files: [GLOB_ASTRO],
|
|
557
|
-
languageOptions: {
|
|
558
|
-
parser: parserPlain
|
|
559
|
-
},
|
|
560
|
-
name: "luxass/formatter/astro",
|
|
561
|
-
rules: {
|
|
562
|
-
"format/prettier": [
|
|
563
|
-
"error",
|
|
564
|
-
mergePrettierOptions(prettierOptions, {
|
|
565
|
-
parser: "astro",
|
|
566
|
-
plugins: [
|
|
567
|
-
"prettier-plugin-astro"
|
|
568
|
-
]
|
|
569
|
-
})
|
|
570
|
-
]
|
|
571
|
-
}
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
if (options.graphql) {
|
|
575
|
-
configs2.push({
|
|
576
|
-
files: [GLOB_GRAPHQL],
|
|
577
|
-
languageOptions: {
|
|
578
|
-
parser: parserPlain
|
|
579
|
-
},
|
|
580
|
-
name: "luxass/formatter/graphql",
|
|
581
|
-
rules: {
|
|
582
|
-
"format/prettier": [
|
|
583
|
-
"error",
|
|
584
|
-
mergePrettierOptions(prettierOptions, {
|
|
585
|
-
parser: "graphql"
|
|
586
|
-
})
|
|
587
|
-
]
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
return configs2;
|
|
506
|
+
async function formatters(options = {}, stylistic$1 = {}) {
|
|
507
|
+
if (options === true) options = {
|
|
508
|
+
astro: isPackageInScope("astro"),
|
|
509
|
+
css: true,
|
|
510
|
+
graphql: true,
|
|
511
|
+
html: true,
|
|
512
|
+
markdown: true
|
|
513
|
+
};
|
|
514
|
+
await ensure(["eslint-plugin-format", options.astro ? "prettier-plugin-astro" : void 0]);
|
|
515
|
+
const { indent, quotes, semi } = {
|
|
516
|
+
...StylisticConfigDefaults,
|
|
517
|
+
...stylistic$1
|
|
518
|
+
};
|
|
519
|
+
const prettierOptions = Object.assign({
|
|
520
|
+
endOfLine: "auto",
|
|
521
|
+
printWidth: 120,
|
|
522
|
+
semi,
|
|
523
|
+
singleQuote: quotes === "single",
|
|
524
|
+
tabWidth: typeof indent === "number" ? indent : 2,
|
|
525
|
+
trailingComma: "all",
|
|
526
|
+
useTabs: indent === "tab"
|
|
527
|
+
}, options.prettierOptions || {});
|
|
528
|
+
const dprintOptions = Object.assign({
|
|
529
|
+
indentWidth: typeof indent === "number" ? indent : 2,
|
|
530
|
+
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
531
|
+
useTabs: indent === "tab"
|
|
532
|
+
}, options.dprintOptions || {});
|
|
533
|
+
const pluginFormat = await interop(import("eslint-plugin-format"));
|
|
534
|
+
const configs$1 = [{
|
|
535
|
+
name: "luxass/formatter/setup",
|
|
536
|
+
plugins: { format: pluginFormat }
|
|
537
|
+
}];
|
|
538
|
+
if (options.css) configs$1.push({
|
|
539
|
+
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
540
|
+
languageOptions: { parser: parserPlain },
|
|
541
|
+
name: "luxass/formatter/css",
|
|
542
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "css" })] }
|
|
543
|
+
}, {
|
|
544
|
+
files: [GLOB_SCSS],
|
|
545
|
+
languageOptions: { parser: parserPlain },
|
|
546
|
+
name: "luxass/formatter/scss",
|
|
547
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "scss" })] }
|
|
548
|
+
}, {
|
|
549
|
+
files: [GLOB_LESS],
|
|
550
|
+
languageOptions: { parser: parserPlain },
|
|
551
|
+
name: "luxass/formatter/less",
|
|
552
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "less" })] }
|
|
553
|
+
});
|
|
554
|
+
if (options.html) configs$1.push({
|
|
555
|
+
files: [GLOB_HTML],
|
|
556
|
+
languageOptions: { parser: parserPlain },
|
|
557
|
+
name: "luxass/formatter/html",
|
|
558
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
|
|
559
|
+
});
|
|
560
|
+
if (options.markdown) {
|
|
561
|
+
const formatter = options.markdown === true ? "prettier" : options.markdown;
|
|
562
|
+
configs$1.push({
|
|
563
|
+
files: [GLOB_MARKDOWN],
|
|
564
|
+
languageOptions: { parser: parserPlain },
|
|
565
|
+
name: "luxass/formatter/markdown",
|
|
566
|
+
rules: { [`format/${formatter}`]: ["error", formatter === "prettier" ? mergePrettierOptions(prettierOptions, {
|
|
567
|
+
embeddedLanguageFormatting: "off",
|
|
568
|
+
parser: "markdown"
|
|
569
|
+
}) : {
|
|
570
|
+
...dprintOptions,
|
|
571
|
+
language: "markdown"
|
|
572
|
+
}] }
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
if (options.astro) configs$1.push({
|
|
576
|
+
files: [GLOB_ASTRO],
|
|
577
|
+
languageOptions: { parser: parserPlain },
|
|
578
|
+
name: "luxass/formatter/astro",
|
|
579
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
|
|
580
|
+
parser: "astro",
|
|
581
|
+
plugins: ["prettier-plugin-astro"]
|
|
582
|
+
})] }
|
|
583
|
+
});
|
|
584
|
+
if (options.graphql) configs$1.push({
|
|
585
|
+
files: [GLOB_GRAPHQL],
|
|
586
|
+
languageOptions: { parser: parserPlain },
|
|
587
|
+
name: "luxass/formatter/graphql",
|
|
588
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
|
|
589
|
+
});
|
|
590
|
+
return configs$1;
|
|
592
591
|
}
|
|
593
592
|
|
|
594
|
-
|
|
593
|
+
//#endregion
|
|
594
|
+
//#region src/configs/ignores.ts
|
|
595
595
|
async function ignores(userIgnores = []) {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
...userIgnores
|
|
601
|
-
],
|
|
602
|
-
name: "luxass/ignores"
|
|
603
|
-
}
|
|
604
|
-
];
|
|
596
|
+
return [{
|
|
597
|
+
ignores: [...GLOB_EXCLUDE, ...userIgnores],
|
|
598
|
+
name: "luxass/ignores"
|
|
599
|
+
}];
|
|
605
600
|
}
|
|
606
601
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
import: pluginImport
|
|
620
|
-
},
|
|
621
|
-
rules: {
|
|
622
|
-
"antfu/import-dedupe": "error",
|
|
623
|
-
"antfu/no-import-dist": "error",
|
|
624
|
-
"antfu/no-import-node-modules-by-path": "error",
|
|
625
|
-
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
626
|
-
"import/first": "error",
|
|
627
|
-
"import/no-duplicates": "error",
|
|
628
|
-
"import/no-mutable-exports": "error",
|
|
629
|
-
"import/no-named-default": "error",
|
|
630
|
-
"import/no-self-import": "error",
|
|
631
|
-
"import/no-webpack-loader-syntax": "error",
|
|
632
|
-
...stylistic2 ? {
|
|
633
|
-
"import/newline-after-import": ["error", { count: 1 }]
|
|
634
|
-
} : {}
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
];
|
|
602
|
+
//#endregion
|
|
603
|
+
//#region src/configs/imports.ts
|
|
604
|
+
async function imports(_options = {}) {
|
|
605
|
+
return [{
|
|
606
|
+
name: "luxass/imports",
|
|
607
|
+
plugins: { antfu: pluginAntfu },
|
|
608
|
+
rules: {
|
|
609
|
+
"antfu/import-dedupe": "error",
|
|
610
|
+
"antfu/no-import-dist": "error",
|
|
611
|
+
"antfu/no-import-node-modules-by-path": "error"
|
|
612
|
+
}
|
|
613
|
+
}];
|
|
638
614
|
}
|
|
639
615
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
643
|
-
import globals from "globals";
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region src/configs/javascript.ts
|
|
644
618
|
async function javascript(options = {}) {
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
},
|
|
881
|
-
{
|
|
882
|
-
files: [
|
|
883
|
-
`scripts/${GLOB_SRC}`,
|
|
884
|
-
`cli.${GLOB_SRC_EXT}`,
|
|
885
|
-
`**/playground.${GLOB_SRC_EXT}`
|
|
886
|
-
],
|
|
887
|
-
name: "luxass/disables/cli",
|
|
888
|
-
rules: {
|
|
889
|
-
"no-console": "off"
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
];
|
|
619
|
+
const { isInEditor = false, overrides = {} } = options;
|
|
620
|
+
return [
|
|
621
|
+
{
|
|
622
|
+
languageOptions: {
|
|
623
|
+
ecmaVersion: 2022,
|
|
624
|
+
globals: {
|
|
625
|
+
...globals.browser,
|
|
626
|
+
...globals.es2021,
|
|
627
|
+
...globals.node,
|
|
628
|
+
document: "readonly",
|
|
629
|
+
navigator: "readonly",
|
|
630
|
+
window: "readonly"
|
|
631
|
+
},
|
|
632
|
+
parserOptions: {
|
|
633
|
+
ecmaFeatures: { jsx: true },
|
|
634
|
+
ecmaVersion: 2022,
|
|
635
|
+
sourceType: "module"
|
|
636
|
+
},
|
|
637
|
+
sourceType: "module"
|
|
638
|
+
},
|
|
639
|
+
linterOptions: { reportUnusedDisableDirectives: true },
|
|
640
|
+
name: "luxass/javascript/setup"
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
name: "luxass/javascript/rules",
|
|
644
|
+
plugins: {
|
|
645
|
+
"antfu": pluginAntfu,
|
|
646
|
+
"unused-imports": pluginUnusedImports
|
|
647
|
+
},
|
|
648
|
+
rules: {
|
|
649
|
+
"accessor-pairs": ["error", {
|
|
650
|
+
enforceForClassMembers: true,
|
|
651
|
+
setWithoutGet: true
|
|
652
|
+
}],
|
|
653
|
+
"antfu/no-top-level-await": "error",
|
|
654
|
+
"array-callback-return": "error",
|
|
655
|
+
"block-scoped-var": "error",
|
|
656
|
+
"constructor-super": "error",
|
|
657
|
+
"default-case-last": "error",
|
|
658
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
659
|
+
"eqeqeq": ["error", "smart"],
|
|
660
|
+
"new-cap": ["error", {
|
|
661
|
+
capIsNew: false,
|
|
662
|
+
newIsCap: true,
|
|
663
|
+
properties: true
|
|
664
|
+
}],
|
|
665
|
+
"no-alert": "error",
|
|
666
|
+
"no-array-constructor": "error",
|
|
667
|
+
"no-async-promise-executor": "error",
|
|
668
|
+
"no-caller": "error",
|
|
669
|
+
"no-case-declarations": "error",
|
|
670
|
+
"no-class-assign": "error",
|
|
671
|
+
"no-compare-neg-zero": "error",
|
|
672
|
+
"no-cond-assign": ["error", "always"],
|
|
673
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
674
|
+
"no-const-assign": "error",
|
|
675
|
+
"no-control-regex": "error",
|
|
676
|
+
"no-debugger": "error",
|
|
677
|
+
"no-delete-var": "error",
|
|
678
|
+
"no-dupe-args": "error",
|
|
679
|
+
"no-dupe-class-members": "error",
|
|
680
|
+
"no-dupe-keys": "error",
|
|
681
|
+
"no-duplicate-case": "error",
|
|
682
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
683
|
+
"no-empty-character-class": "error",
|
|
684
|
+
"no-empty-pattern": "error",
|
|
685
|
+
"no-eval": "error",
|
|
686
|
+
"no-ex-assign": "error",
|
|
687
|
+
"no-extend-native": "error",
|
|
688
|
+
"no-extra-bind": "error",
|
|
689
|
+
"no-extra-boolean-cast": "error",
|
|
690
|
+
"no-fallthrough": "error",
|
|
691
|
+
"no-func-assign": "error",
|
|
692
|
+
"no-global-assign": "error",
|
|
693
|
+
"no-implied-eval": "error",
|
|
694
|
+
"no-import-assign": "error",
|
|
695
|
+
"no-invalid-regexp": "error",
|
|
696
|
+
"no-invalid-this": "error",
|
|
697
|
+
"no-irregular-whitespace": "error",
|
|
698
|
+
"no-iterator": "error",
|
|
699
|
+
"no-labels": ["error", {
|
|
700
|
+
allowLoop: false,
|
|
701
|
+
allowSwitch: false
|
|
702
|
+
}],
|
|
703
|
+
"no-lone-blocks": "error",
|
|
704
|
+
"no-loss-of-precision": "error",
|
|
705
|
+
"no-misleading-character-class": "error",
|
|
706
|
+
"no-multi-str": "error",
|
|
707
|
+
"no-new": "error",
|
|
708
|
+
"no-new-func": "error",
|
|
709
|
+
"no-new-native-nonconstructor": "error",
|
|
710
|
+
"no-new-wrappers": "error",
|
|
711
|
+
"no-obj-calls": "error",
|
|
712
|
+
"no-octal": "error",
|
|
713
|
+
"no-octal-escape": "error",
|
|
714
|
+
"no-proto": "error",
|
|
715
|
+
"no-prototype-builtins": "error",
|
|
716
|
+
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
717
|
+
"no-regex-spaces": "error",
|
|
718
|
+
"no-restricted-globals": [
|
|
719
|
+
"error",
|
|
720
|
+
{
|
|
721
|
+
message: "Use `globalThis` instead.",
|
|
722
|
+
name: "global"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
message: "Use `globalThis` instead.",
|
|
726
|
+
name: "self"
|
|
727
|
+
}
|
|
728
|
+
],
|
|
729
|
+
"no-restricted-properties": [
|
|
730
|
+
"error",
|
|
731
|
+
{
|
|
732
|
+
message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
|
|
733
|
+
property: "__proto__"
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
message: "Use `Object.defineProperty` instead.",
|
|
737
|
+
property: "__defineGetter__"
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
message: "Use `Object.defineProperty` instead.",
|
|
741
|
+
property: "__defineSetter__"
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
745
|
+
property: "__lookupGetter__"
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
749
|
+
property: "__lookupSetter__"
|
|
750
|
+
}
|
|
751
|
+
],
|
|
752
|
+
"no-restricted-syntax": [
|
|
753
|
+
"error",
|
|
754
|
+
"DebuggerStatement",
|
|
755
|
+
"LabeledStatement",
|
|
756
|
+
"WithStatement",
|
|
757
|
+
"TSEnumDeclaration[const=true]",
|
|
758
|
+
"TSExportAssignment"
|
|
759
|
+
],
|
|
760
|
+
"no-self-assign": ["error", { props: true }],
|
|
761
|
+
"no-self-compare": "error",
|
|
762
|
+
"no-sequences": "error",
|
|
763
|
+
"no-shadow-restricted-names": "error",
|
|
764
|
+
"no-sparse-arrays": "error",
|
|
765
|
+
"no-template-curly-in-string": "error",
|
|
766
|
+
"no-this-before-super": "error",
|
|
767
|
+
"no-throw-literal": "error",
|
|
768
|
+
"no-undef": "error",
|
|
769
|
+
"no-undef-init": "error",
|
|
770
|
+
"no-unexpected-multiline": "error",
|
|
771
|
+
"no-unmodified-loop-condition": "error",
|
|
772
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
773
|
+
"no-unreachable": "error",
|
|
774
|
+
"no-unreachable-loop": "error",
|
|
775
|
+
"no-unsafe-finally": "error",
|
|
776
|
+
"no-unsafe-negation": "error",
|
|
777
|
+
"no-unused-expressions": ["error", {
|
|
778
|
+
allowShortCircuit: true,
|
|
779
|
+
allowTaggedTemplates: true,
|
|
780
|
+
allowTernary: true
|
|
781
|
+
}],
|
|
782
|
+
"no-unused-vars": ["error", {
|
|
783
|
+
args: "none",
|
|
784
|
+
caughtErrors: "none",
|
|
785
|
+
ignoreRestSiblings: true,
|
|
786
|
+
vars: "all"
|
|
787
|
+
}],
|
|
788
|
+
"no-use-before-define": ["error", {
|
|
789
|
+
classes: false,
|
|
790
|
+
functions: false,
|
|
791
|
+
variables: true
|
|
792
|
+
}],
|
|
793
|
+
"no-useless-backreference": "error",
|
|
794
|
+
"no-useless-call": "error",
|
|
795
|
+
"no-useless-catch": "error",
|
|
796
|
+
"no-useless-computed-key": "error",
|
|
797
|
+
"no-useless-constructor": "error",
|
|
798
|
+
"no-useless-rename": "error",
|
|
799
|
+
"no-useless-return": "error",
|
|
800
|
+
"no-var": "error",
|
|
801
|
+
"no-with": "error",
|
|
802
|
+
"object-shorthand": [
|
|
803
|
+
"error",
|
|
804
|
+
"always",
|
|
805
|
+
{
|
|
806
|
+
avoidQuotes: true,
|
|
807
|
+
ignoreConstructors: false
|
|
808
|
+
}
|
|
809
|
+
],
|
|
810
|
+
"one-var": ["error", { initialized: "never" }],
|
|
811
|
+
"prefer-arrow-callback": ["error", {
|
|
812
|
+
allowNamedFunctions: false,
|
|
813
|
+
allowUnboundThis: true
|
|
814
|
+
}],
|
|
815
|
+
"prefer-const": ["error", {
|
|
816
|
+
destructuring: "all",
|
|
817
|
+
ignoreReadBeforeAssign: true
|
|
818
|
+
}],
|
|
819
|
+
"prefer-exponentiation-operator": "error",
|
|
820
|
+
"prefer-promise-reject-errors": "error",
|
|
821
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
822
|
+
"prefer-rest-params": "error",
|
|
823
|
+
"prefer-spread": "error",
|
|
824
|
+
"prefer-template": "error",
|
|
825
|
+
"symbol-description": "error",
|
|
826
|
+
"unicode-bom": ["error", "never"],
|
|
827
|
+
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
828
|
+
"unused-imports/no-unused-vars": ["error", {
|
|
829
|
+
args: "after-used",
|
|
830
|
+
argsIgnorePattern: "^_",
|
|
831
|
+
vars: "all",
|
|
832
|
+
varsIgnorePattern: "^_"
|
|
833
|
+
}],
|
|
834
|
+
"use-isnan": ["error", {
|
|
835
|
+
enforceForIndexOf: true,
|
|
836
|
+
enforceForSwitchCase: true
|
|
837
|
+
}],
|
|
838
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
839
|
+
"vars-on-top": "error",
|
|
840
|
+
"yoda": ["error", "never"],
|
|
841
|
+
...overrides
|
|
842
|
+
}
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
files: [
|
|
846
|
+
`scripts/${GLOB_SRC}`,
|
|
847
|
+
`cli.${GLOB_SRC_EXT}`,
|
|
848
|
+
`**/playground.${GLOB_SRC_EXT}`
|
|
849
|
+
],
|
|
850
|
+
name: "luxass/disables/cli",
|
|
851
|
+
rules: { "no-console": "off" }
|
|
852
|
+
}
|
|
853
|
+
];
|
|
893
854
|
}
|
|
894
855
|
|
|
895
|
-
|
|
856
|
+
//#endregion
|
|
857
|
+
//#region src/configs/jsdoc.ts
|
|
896
858
|
async function jsdoc(options = {}) {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
"jsdoc/check-alignment": "warn",
|
|
925
|
-
"jsdoc/multiline-blocks": "warn"
|
|
926
|
-
} : {},
|
|
927
|
-
...overrides
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
];
|
|
859
|
+
const { overrides, stylistic: stylistic$1 = true } = options;
|
|
860
|
+
return [{
|
|
861
|
+
name: "luxass/jsdoc/rules",
|
|
862
|
+
plugins: { jsdoc: await interop(import("eslint-plugin-jsdoc")) },
|
|
863
|
+
rules: {
|
|
864
|
+
"jsdoc/check-access": "warn",
|
|
865
|
+
"jsdoc/check-param-names": "warn",
|
|
866
|
+
"jsdoc/check-property-names": "warn",
|
|
867
|
+
"jsdoc/check-types": "warn",
|
|
868
|
+
"jsdoc/empty-tags": "warn",
|
|
869
|
+
"jsdoc/implements-on-classes": "warn",
|
|
870
|
+
"jsdoc/no-defaults": "warn",
|
|
871
|
+
"jsdoc/no-multi-asterisks": "warn",
|
|
872
|
+
"jsdoc/require-param-name": "warn",
|
|
873
|
+
"jsdoc/require-property": "warn",
|
|
874
|
+
"jsdoc/require-property-description": "warn",
|
|
875
|
+
"jsdoc/require-property-name": "warn",
|
|
876
|
+
"jsdoc/require-returns-check": "warn",
|
|
877
|
+
"jsdoc/require-returns-description": "warn",
|
|
878
|
+
"jsdoc/require-yields-check": "warn",
|
|
879
|
+
...stylistic$1 ? {
|
|
880
|
+
"jsdoc/check-alignment": "warn",
|
|
881
|
+
"jsdoc/multiline-blocks": "warn"
|
|
882
|
+
} : {},
|
|
883
|
+
...overrides
|
|
884
|
+
}
|
|
885
|
+
}];
|
|
931
886
|
}
|
|
932
887
|
|
|
933
|
-
|
|
888
|
+
//#endregion
|
|
889
|
+
//#region src/configs/json.ts
|
|
934
890
|
async function jsonc(options = {}) {
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
{ afterColon: true, beforeColon: false }
|
|
998
|
-
],
|
|
999
|
-
"jsonc/object-curly-newline": [
|
|
1000
|
-
"error",
|
|
1001
|
-
{ consistent: true, multiline: true }
|
|
1002
|
-
],
|
|
1003
|
-
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1004
|
-
"jsonc/object-property-newline": [
|
|
1005
|
-
"error",
|
|
1006
|
-
{ allowMultiplePropertiesPerLine: true }
|
|
1007
|
-
],
|
|
1008
|
-
"jsonc/quote-props": "error",
|
|
1009
|
-
"jsonc/quotes": "error"
|
|
1010
|
-
} : {},
|
|
1011
|
-
...overrides
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
];
|
|
891
|
+
const { files = [
|
|
892
|
+
GLOB_JSON,
|
|
893
|
+
GLOB_JSON5,
|
|
894
|
+
GLOB_JSONC
|
|
895
|
+
], overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
896
|
+
const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
|
|
897
|
+
const [pluginJsonc, parserJsonc] = await Promise.all([interop(import("eslint-plugin-jsonc")), interop(import("jsonc-eslint-parser"))]);
|
|
898
|
+
return [{
|
|
899
|
+
name: "luxass/jsonc/setup",
|
|
900
|
+
plugins: { jsonc: pluginJsonc }
|
|
901
|
+
}, {
|
|
902
|
+
files,
|
|
903
|
+
languageOptions: { parser: parserJsonc },
|
|
904
|
+
name: "luxass/jsonc/rules",
|
|
905
|
+
rules: {
|
|
906
|
+
"jsonc/no-bigint-literals": "error",
|
|
907
|
+
"jsonc/no-binary-expression": "error",
|
|
908
|
+
"jsonc/no-binary-numeric-literals": "error",
|
|
909
|
+
"jsonc/no-dupe-keys": "error",
|
|
910
|
+
"jsonc/no-escape-sequence-in-identifier": "error",
|
|
911
|
+
"jsonc/no-floating-decimal": "error",
|
|
912
|
+
"jsonc/no-hexadecimal-numeric-literals": "error",
|
|
913
|
+
"jsonc/no-infinity": "error",
|
|
914
|
+
"jsonc/no-multi-str": "error",
|
|
915
|
+
"jsonc/no-nan": "error",
|
|
916
|
+
"jsonc/no-number-props": "error",
|
|
917
|
+
"jsonc/no-numeric-separators": "error",
|
|
918
|
+
"jsonc/no-octal": "error",
|
|
919
|
+
"jsonc/no-octal-escape": "error",
|
|
920
|
+
"jsonc/no-octal-numeric-literals": "error",
|
|
921
|
+
"jsonc/no-parenthesized": "error",
|
|
922
|
+
"jsonc/no-plus-sign": "error",
|
|
923
|
+
"jsonc/no-regexp-literals": "error",
|
|
924
|
+
"jsonc/no-sparse-arrays": "error",
|
|
925
|
+
"jsonc/no-template-literals": "error",
|
|
926
|
+
"jsonc/no-undefined-value": "error",
|
|
927
|
+
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
928
|
+
"jsonc/no-useless-escape": "error",
|
|
929
|
+
"jsonc/space-unary-ops": "error",
|
|
930
|
+
"jsonc/valid-json-number": "error",
|
|
931
|
+
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
932
|
+
...stylistic$1 ? {
|
|
933
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
934
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
935
|
+
"jsonc/comma-style": ["error", "last"],
|
|
936
|
+
"jsonc/indent": ["error", indent],
|
|
937
|
+
"jsonc/key-spacing": ["error", {
|
|
938
|
+
afterColon: true,
|
|
939
|
+
beforeColon: false
|
|
940
|
+
}],
|
|
941
|
+
"jsonc/object-curly-newline": ["error", {
|
|
942
|
+
consistent: true,
|
|
943
|
+
multiline: true
|
|
944
|
+
}],
|
|
945
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
946
|
+
"jsonc/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
947
|
+
"jsonc/quote-props": "error",
|
|
948
|
+
"jsonc/quotes": "error"
|
|
949
|
+
} : {},
|
|
950
|
+
...overrides
|
|
951
|
+
}
|
|
952
|
+
}];
|
|
1015
953
|
}
|
|
1016
954
|
|
|
1017
|
-
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region src/configs/jsx.ts
|
|
1018
957
|
async function jsx() {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
ecmaFeatures: {
|
|
1025
|
-
jsx: true
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
},
|
|
1029
|
-
name: "luxass/jsx/setup"
|
|
1030
|
-
}
|
|
1031
|
-
];
|
|
958
|
+
return [{
|
|
959
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
960
|
+
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
|
|
961
|
+
name: "luxass/jsx/setup"
|
|
962
|
+
}];
|
|
1032
963
|
}
|
|
1033
964
|
|
|
1034
|
-
|
|
1035
|
-
|
|
965
|
+
//#endregion
|
|
966
|
+
//#region src/configs/markdown.ts
|
|
1036
967
|
async function markdown(options = {}) {
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
"no-undef": "off",
|
|
1091
|
-
"no-unused-expressions": "off",
|
|
1092
|
-
"no-unused-labels": "off",
|
|
1093
|
-
"no-unused-vars": "off",
|
|
1094
|
-
"node/prefer-global/process": "off",
|
|
1095
|
-
"style/comma-dangle": "off",
|
|
1096
|
-
"style/eol-last": "off",
|
|
1097
|
-
"ts/consistent-type-imports": "off",
|
|
1098
|
-
"ts/explicit-function-return-type": "off",
|
|
1099
|
-
"ts/no-namespace": "off",
|
|
1100
|
-
"ts/no-redeclare": "off",
|
|
1101
|
-
"ts/no-require-imports": "off",
|
|
1102
|
-
"ts/no-unused-expressions": "off",
|
|
1103
|
-
"ts/no-unused-vars": "off",
|
|
1104
|
-
"ts/no-use-before-define": "off",
|
|
1105
|
-
"ts/no-var-requires": "off",
|
|
1106
|
-
"unicode-bom": "off",
|
|
1107
|
-
"unused-imports/no-unused-imports": "off",
|
|
1108
|
-
"unused-imports/no-unused-vars": "off",
|
|
1109
|
-
...overrides
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
];
|
|
968
|
+
const { exts = [], files = [GLOB_MARKDOWN], overrides = {} } = options;
|
|
969
|
+
const markdown$1 = await interop(import("@eslint/markdown"));
|
|
970
|
+
return [
|
|
971
|
+
{
|
|
972
|
+
name: "luxass/markdown/setup",
|
|
973
|
+
plugins: { markdown: markdown$1 }
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
files,
|
|
977
|
+
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
978
|
+
name: "luxass/markdown/processor",
|
|
979
|
+
processor: mergeProcessors([markdown$1.processors.markdown, processorPassThrough])
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
files,
|
|
983
|
+
languageOptions: { parser: parserPlain },
|
|
984
|
+
name: "luxass/markdown/parser"
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
files: [GLOB_MARKDOWN_CODE, ...exts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
|
|
988
|
+
languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
|
|
989
|
+
name: "luxass/markdown/disables",
|
|
990
|
+
rules: {
|
|
991
|
+
"antfu/no-top-level-await": "off",
|
|
992
|
+
"no-alert": "off",
|
|
993
|
+
"no-console": "off",
|
|
994
|
+
"no-labels": "off",
|
|
995
|
+
"no-lone-blocks": "off",
|
|
996
|
+
"no-restricted-syntax": "off",
|
|
997
|
+
"no-undef": "off",
|
|
998
|
+
"no-unused-expressions": "off",
|
|
999
|
+
"no-unused-labels": "off",
|
|
1000
|
+
"no-unused-vars": "off",
|
|
1001
|
+
"node/prefer-global/process": "off",
|
|
1002
|
+
"style/comma-dangle": "off",
|
|
1003
|
+
"style/eol-last": "off",
|
|
1004
|
+
"style/padding-line-between-statements": "off",
|
|
1005
|
+
"ts/consistent-type-imports": "off",
|
|
1006
|
+
"ts/explicit-function-return-type": "off",
|
|
1007
|
+
"ts/no-namespace": "off",
|
|
1008
|
+
"ts/no-redeclare": "off",
|
|
1009
|
+
"ts/no-require-imports": "off",
|
|
1010
|
+
"ts/no-unused-expressions": "off",
|
|
1011
|
+
"ts/no-unused-vars": "off",
|
|
1012
|
+
"ts/no-use-before-define": "off",
|
|
1013
|
+
"ts/no-var-requires": "off",
|
|
1014
|
+
"unicode-bom": "off",
|
|
1015
|
+
"unused-imports/no-unused-imports": "off",
|
|
1016
|
+
"unused-imports/no-unused-vars": "off",
|
|
1017
|
+
...overrides
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
];
|
|
1113
1021
|
}
|
|
1114
1022
|
|
|
1115
|
-
|
|
1116
|
-
|
|
1023
|
+
//#endregion
|
|
1024
|
+
//#region src/configs/node.ts
|
|
1117
1025
|
function node() {
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
"node/process-exit-as-throw": "error"
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
];
|
|
1026
|
+
return [{
|
|
1027
|
+
name: "luxass/node",
|
|
1028
|
+
plugins: { node: pluginNode },
|
|
1029
|
+
rules: {
|
|
1030
|
+
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
1031
|
+
"node/no-deprecated-api": "error",
|
|
1032
|
+
"node/no-exports-assign": "error",
|
|
1033
|
+
"node/no-new-require": "error",
|
|
1034
|
+
"node/no-path-concat": "error",
|
|
1035
|
+
"node/prefer-global/buffer": ["error", "never"],
|
|
1036
|
+
"node/prefer-global/process": ["error", "never"],
|
|
1037
|
+
"node/process-exit-as-throw": "error"
|
|
1038
|
+
}
|
|
1039
|
+
}];
|
|
1136
1040
|
}
|
|
1137
1041
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region src/configs/perfectionist.ts
|
|
1044
|
+
/**
|
|
1045
|
+
* Perfectionist plugin for props and items sorting.
|
|
1046
|
+
*
|
|
1047
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
1048
|
+
*/
|
|
1140
1049
|
async function perfectionist() {
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1050
|
+
return [{
|
|
1051
|
+
name: "luxass/perfectionist/setup",
|
|
1052
|
+
plugins: { perfectionist: pluginPerfectionist },
|
|
1053
|
+
rules: {
|
|
1054
|
+
"perfectionist/sort-exports": ["error", {
|
|
1055
|
+
order: "asc",
|
|
1056
|
+
type: "natural"
|
|
1057
|
+
}],
|
|
1058
|
+
"perfectionist/sort-imports": ["error", {
|
|
1059
|
+
groups: [
|
|
1060
|
+
"type",
|
|
1061
|
+
[
|
|
1062
|
+
"parent-type",
|
|
1063
|
+
"sibling-type",
|
|
1064
|
+
"index-type",
|
|
1065
|
+
"internal-type"
|
|
1066
|
+
],
|
|
1067
|
+
"builtin",
|
|
1068
|
+
"external",
|
|
1069
|
+
"internal",
|
|
1070
|
+
[
|
|
1071
|
+
"parent",
|
|
1072
|
+
"sibling",
|
|
1073
|
+
"index"
|
|
1074
|
+
],
|
|
1075
|
+
"side-effect",
|
|
1076
|
+
"object",
|
|
1077
|
+
"unknown"
|
|
1078
|
+
],
|
|
1079
|
+
newlinesBetween: "ignore",
|
|
1080
|
+
order: "asc",
|
|
1081
|
+
type: "natural"
|
|
1082
|
+
}],
|
|
1083
|
+
"perfectionist/sort-named-exports": ["error", {
|
|
1084
|
+
order: "asc",
|
|
1085
|
+
type: "natural"
|
|
1086
|
+
}],
|
|
1087
|
+
"perfectionist/sort-named-imports": ["error", {
|
|
1088
|
+
order: "asc",
|
|
1089
|
+
type: "natural"
|
|
1090
|
+
}]
|
|
1091
|
+
}
|
|
1092
|
+
}];
|
|
1170
1093
|
}
|
|
1171
1094
|
|
|
1172
|
-
|
|
1095
|
+
//#endregion
|
|
1096
|
+
//#region src/configs/pnpm.ts
|
|
1173
1097
|
async function pnpm() {
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
"pnpm/json-valid-catalog": "error"
|
|
1200
|
-
}
|
|
1201
|
-
},
|
|
1202
|
-
{
|
|
1203
|
-
files: ["pnpm-workspace.yaml"],
|
|
1204
|
-
languageOptions: {
|
|
1205
|
-
parser: yamlParser
|
|
1206
|
-
},
|
|
1207
|
-
name: "luxass/pnpm/pnpm-workspace-yaml",
|
|
1208
|
-
plugins: {
|
|
1209
|
-
pnpm: pluginPnpm
|
|
1210
|
-
},
|
|
1211
|
-
rules: {
|
|
1212
|
-
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
1213
|
-
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
];
|
|
1098
|
+
const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
|
|
1099
|
+
interop(import("eslint-plugin-pnpm")),
|
|
1100
|
+
interop(import("yaml-eslint-parser")),
|
|
1101
|
+
interop(import("jsonc-eslint-parser"))
|
|
1102
|
+
]);
|
|
1103
|
+
return [{
|
|
1104
|
+
files: ["package.json", "**/package.json"],
|
|
1105
|
+
languageOptions: { parser: jsoncParser },
|
|
1106
|
+
name: "luxass/pnpm/package-json",
|
|
1107
|
+
plugins: { pnpm: pluginPnpm },
|
|
1108
|
+
rules: {
|
|
1109
|
+
"pnpm/json-enforce-catalog": "error",
|
|
1110
|
+
"pnpm/json-prefer-workspace-settings": "error",
|
|
1111
|
+
"pnpm/json-valid-catalog": "error"
|
|
1112
|
+
}
|
|
1113
|
+
}, {
|
|
1114
|
+
files: ["pnpm-workspace.yaml"],
|
|
1115
|
+
languageOptions: { parser: yamlParser },
|
|
1116
|
+
name: "luxass/pnpm/pnpm-workspace-yaml",
|
|
1117
|
+
plugins: { pnpm: pluginPnpm },
|
|
1118
|
+
rules: {
|
|
1119
|
+
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
1120
|
+
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
1121
|
+
}
|
|
1122
|
+
}];
|
|
1217
1123
|
}
|
|
1218
1124
|
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
"@remix-run/serve",
|
|
1228
|
-
"@remix-run/dev"
|
|
1125
|
+
//#endregion
|
|
1126
|
+
//#region src/configs/react.ts
|
|
1127
|
+
const ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
1128
|
+
const RemixPackages = [
|
|
1129
|
+
"@remix-run/node",
|
|
1130
|
+
"@remix-run/react",
|
|
1131
|
+
"@remix-run/serve",
|
|
1132
|
+
"@remix-run/dev"
|
|
1229
1133
|
];
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
];
|
|
1236
|
-
var NextJsPackages = [
|
|
1237
|
-
"next"
|
|
1134
|
+
const ReactRouterPackages = [
|
|
1135
|
+
"@react-router/node",
|
|
1136
|
+
"@react-router/react",
|
|
1137
|
+
"@react-router/serve",
|
|
1138
|
+
"@react-router/dev"
|
|
1238
1139
|
];
|
|
1140
|
+
const NextJsPackages = ["next"];
|
|
1239
1141
|
async function react(options = {}) {
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
"react/no-nested-component-definitions": "error",
|
|
1381
|
-
"react/no-prop-types": "error",
|
|
1382
|
-
"react/no-redundant-should-component-update": "error",
|
|
1383
|
-
"react/no-set-state-in-component-did-mount": "warn",
|
|
1384
|
-
"react/no-set-state-in-component-did-update": "warn",
|
|
1385
|
-
"react/no-set-state-in-component-will-update": "warn",
|
|
1386
|
-
"react/no-string-refs": "error",
|
|
1387
|
-
"react/no-unsafe-component-will-mount": "warn",
|
|
1388
|
-
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1389
|
-
"react/no-unsafe-component-will-update": "warn",
|
|
1390
|
-
"react/no-unstable-context-value": "warn",
|
|
1391
|
-
"react/no-unstable-default-props": "warn",
|
|
1392
|
-
"react/no-unused-class-component-members": "warn",
|
|
1393
|
-
"react/no-unused-state": "warn",
|
|
1394
|
-
"react/no-use-context": "warn",
|
|
1395
|
-
"react/no-useless-forward-ref": "warn",
|
|
1396
|
-
// overrides
|
|
1397
|
-
...overrides
|
|
1398
|
-
}
|
|
1399
|
-
},
|
|
1400
|
-
...isTypeAware ? [{
|
|
1401
|
-
files: filesTypeAware,
|
|
1402
|
-
ignores: ignoresTypeAware,
|
|
1403
|
-
name: "luxass/react/type-aware-rules",
|
|
1404
|
-
rules: {
|
|
1405
|
-
...typeAwareRules
|
|
1406
|
-
}
|
|
1407
|
-
}] : []
|
|
1408
|
-
];
|
|
1142
|
+
const { files = [
|
|
1143
|
+
GLOB_JS,
|
|
1144
|
+
GLOB_JSX,
|
|
1145
|
+
GLOB_TS,
|
|
1146
|
+
GLOB_TSX
|
|
1147
|
+
], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, tsconfigPath } = options;
|
|
1148
|
+
await ensure([
|
|
1149
|
+
"@eslint-react/eslint-plugin",
|
|
1150
|
+
"eslint-plugin-react-hooks",
|
|
1151
|
+
"eslint-plugin-react-refresh"
|
|
1152
|
+
]);
|
|
1153
|
+
const isTypeAware = !!tsconfigPath;
|
|
1154
|
+
const typeAwareRules = { "react/no-leaked-conditional-rendering": "warn" };
|
|
1155
|
+
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
|
|
1156
|
+
interop(import("@eslint-react/eslint-plugin")),
|
|
1157
|
+
interop(import("eslint-plugin-react-hooks")),
|
|
1158
|
+
interop(import("eslint-plugin-react-refresh"))
|
|
1159
|
+
]);
|
|
1160
|
+
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists(i));
|
|
1161
|
+
const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
|
|
1162
|
+
const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
|
|
1163
|
+
const isUsingNext = NextJsPackages.some((i) => isPackageExists(i));
|
|
1164
|
+
const plugins = pluginReact.configs.all.plugins;
|
|
1165
|
+
return [
|
|
1166
|
+
{
|
|
1167
|
+
name: "luxass/react/setup",
|
|
1168
|
+
plugins: {
|
|
1169
|
+
"react": plugins["@eslint-react"],
|
|
1170
|
+
"react-dom": plugins["@eslint-react/dom"],
|
|
1171
|
+
"react-hooks": pluginReactHooks,
|
|
1172
|
+
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
1173
|
+
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1174
|
+
"react-refresh": pluginReactRefresh,
|
|
1175
|
+
"react-web-api": plugins["@eslint-react/web-api"]
|
|
1176
|
+
}
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
files,
|
|
1180
|
+
languageOptions: {
|
|
1181
|
+
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
1182
|
+
sourceType: "module"
|
|
1183
|
+
},
|
|
1184
|
+
name: "luxass/react/rules",
|
|
1185
|
+
rules: {
|
|
1186
|
+
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
1187
|
+
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
1188
|
+
"react-dom/no-find-dom-node": "error",
|
|
1189
|
+
"react-dom/no-flush-sync": "error",
|
|
1190
|
+
"react-dom/no-hydrate": "error",
|
|
1191
|
+
"react-dom/no-missing-button-type": "warn",
|
|
1192
|
+
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
1193
|
+
"react-dom/no-namespace": "error",
|
|
1194
|
+
"react-dom/no-render": "error",
|
|
1195
|
+
"react-dom/no-render-return-value": "error",
|
|
1196
|
+
"react-dom/no-script-url": "warn",
|
|
1197
|
+
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
1198
|
+
"react-dom/no-unsafe-target-blank": "warn",
|
|
1199
|
+
"react-dom/no-use-form-state": "error",
|
|
1200
|
+
"react-dom/no-void-elements-with-children": "error",
|
|
1201
|
+
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1202
|
+
"react-hooks-extra/no-unnecessary-use-prefix": "warn",
|
|
1203
|
+
"react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
|
|
1204
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
1205
|
+
"react-hooks/rules-of-hooks": "error",
|
|
1206
|
+
"react-refresh/only-export-components": ["warn", {
|
|
1207
|
+
allowConstantExport: isAllowConstantExport,
|
|
1208
|
+
allowExportNames: [...isUsingNext ? [
|
|
1209
|
+
"dynamic",
|
|
1210
|
+
"dynamicParams",
|
|
1211
|
+
"revalidate",
|
|
1212
|
+
"fetchCache",
|
|
1213
|
+
"runtime",
|
|
1214
|
+
"preferredRegion",
|
|
1215
|
+
"maxDuration",
|
|
1216
|
+
"config",
|
|
1217
|
+
"generateStaticParams",
|
|
1218
|
+
"metadata",
|
|
1219
|
+
"generateMetadata",
|
|
1220
|
+
"viewport",
|
|
1221
|
+
"generateViewport"
|
|
1222
|
+
] : [], ...isUsingRemix || isUsingReactRouter ? [
|
|
1223
|
+
"meta",
|
|
1224
|
+
"links",
|
|
1225
|
+
"headers",
|
|
1226
|
+
"loader",
|
|
1227
|
+
"action"
|
|
1228
|
+
] : []]
|
|
1229
|
+
}],
|
|
1230
|
+
"react-web-api/no-leaked-event-listener": "warn",
|
|
1231
|
+
"react-web-api/no-leaked-interval": "warn",
|
|
1232
|
+
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1233
|
+
"react-web-api/no-leaked-timeout": "warn",
|
|
1234
|
+
"react/jsx-no-duplicate-props": "warn",
|
|
1235
|
+
"react/jsx-uses-vars": "warn",
|
|
1236
|
+
"react/no-access-state-in-setstate": "error",
|
|
1237
|
+
"react/no-array-index-key": "warn",
|
|
1238
|
+
"react/no-children-count": "warn",
|
|
1239
|
+
"react/no-children-for-each": "warn",
|
|
1240
|
+
"react/no-children-map": "warn",
|
|
1241
|
+
"react/no-children-only": "warn",
|
|
1242
|
+
"react/no-children-to-array": "warn",
|
|
1243
|
+
"react/no-clone-element": "warn",
|
|
1244
|
+
"react/no-comment-textnodes": "warn",
|
|
1245
|
+
"react/no-component-will-mount": "error",
|
|
1246
|
+
"react/no-component-will-receive-props": "error",
|
|
1247
|
+
"react/no-component-will-update": "error",
|
|
1248
|
+
"react/no-context-provider": "warn",
|
|
1249
|
+
"react/no-create-ref": "error",
|
|
1250
|
+
"react/no-default-props": "error",
|
|
1251
|
+
"react/no-direct-mutation-state": "error",
|
|
1252
|
+
"react/no-duplicate-key": "warn",
|
|
1253
|
+
"react/no-forward-ref": "warn",
|
|
1254
|
+
"react/no-implicit-key": "warn",
|
|
1255
|
+
"react/no-missing-key": "error",
|
|
1256
|
+
"react/no-nested-component-definitions": "error",
|
|
1257
|
+
"react/no-prop-types": "error",
|
|
1258
|
+
"react/no-redundant-should-component-update": "error",
|
|
1259
|
+
"react/no-set-state-in-component-did-mount": "warn",
|
|
1260
|
+
"react/no-set-state-in-component-did-update": "warn",
|
|
1261
|
+
"react/no-set-state-in-component-will-update": "warn",
|
|
1262
|
+
"react/no-string-refs": "error",
|
|
1263
|
+
"react/no-unsafe-component-will-mount": "warn",
|
|
1264
|
+
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1265
|
+
"react/no-unsafe-component-will-update": "warn",
|
|
1266
|
+
"react/no-unstable-context-value": "warn",
|
|
1267
|
+
"react/no-unstable-default-props": "warn",
|
|
1268
|
+
"react/no-unused-class-component-members": "warn",
|
|
1269
|
+
"react/no-unused-state": "warn",
|
|
1270
|
+
"react/no-use-context": "warn",
|
|
1271
|
+
"react/no-useless-forward-ref": "warn",
|
|
1272
|
+
...overrides
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
...isTypeAware ? [{
|
|
1276
|
+
files: filesTypeAware,
|
|
1277
|
+
ignores: ignoresTypeAware,
|
|
1278
|
+
name: "luxass/react/type-aware-rules",
|
|
1279
|
+
rules: { ...typeAwareRules }
|
|
1280
|
+
}] : []
|
|
1281
|
+
];
|
|
1409
1282
|
}
|
|
1410
1283
|
|
|
1411
|
-
|
|
1412
|
-
|
|
1284
|
+
//#endregion
|
|
1285
|
+
//#region src/configs/regexp.ts
|
|
1413
1286
|
async function regexp(options = {}) {
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
...config,
|
|
1428
|
-
name: "luxass/regexp/rules",
|
|
1429
|
-
rules: {
|
|
1430
|
-
...rules,
|
|
1431
|
-
...options.overrides
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
];
|
|
1287
|
+
const config = configs["flat/recommended"];
|
|
1288
|
+
const rules = { ...config.rules };
|
|
1289
|
+
if (options.level === "warn") {
|
|
1290
|
+
for (const key in rules) if (rules[key] === "error") rules[key] = "warn";
|
|
1291
|
+
}
|
|
1292
|
+
return [{
|
|
1293
|
+
...config,
|
|
1294
|
+
name: "luxass/regexp/rules",
|
|
1295
|
+
rules: {
|
|
1296
|
+
...rules,
|
|
1297
|
+
...options.overrides
|
|
1298
|
+
}
|
|
1299
|
+
}];
|
|
1435
1300
|
}
|
|
1436
1301
|
|
|
1437
|
-
|
|
1302
|
+
//#endregion
|
|
1303
|
+
//#region src/configs/sort.ts
|
|
1304
|
+
/**
|
|
1305
|
+
* Sort package.json
|
|
1306
|
+
*
|
|
1307
|
+
* Requires `jsonc` config
|
|
1308
|
+
*/
|
|
1438
1309
|
function sortPackageJson() {
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1310
|
+
return [{
|
|
1311
|
+
files: ["**/package.json"],
|
|
1312
|
+
name: "luxass/sort/package-json",
|
|
1313
|
+
rules: {
|
|
1314
|
+
"jsonc/sort-array-values": ["error", {
|
|
1315
|
+
order: { type: "asc" },
|
|
1316
|
+
pathPattern: "^files$"
|
|
1317
|
+
}],
|
|
1318
|
+
"jsonc/sort-keys": [
|
|
1319
|
+
"error",
|
|
1320
|
+
{
|
|
1321
|
+
order: [
|
|
1322
|
+
"name",
|
|
1323
|
+
"displayName",
|
|
1324
|
+
"version",
|
|
1325
|
+
"description",
|
|
1326
|
+
"type",
|
|
1327
|
+
"private",
|
|
1328
|
+
"author",
|
|
1329
|
+
"contributors",
|
|
1330
|
+
"publisher",
|
|
1331
|
+
"packageManager",
|
|
1332
|
+
"license",
|
|
1333
|
+
"funding",
|
|
1334
|
+
"homepage",
|
|
1335
|
+
"repository",
|
|
1336
|
+
"bugs",
|
|
1337
|
+
"keywords",
|
|
1338
|
+
"categories",
|
|
1339
|
+
"sideEffects",
|
|
1340
|
+
"imports",
|
|
1341
|
+
"exports",
|
|
1342
|
+
"main",
|
|
1343
|
+
"module",
|
|
1344
|
+
"unpkg",
|
|
1345
|
+
"jsdelivr",
|
|
1346
|
+
"types",
|
|
1347
|
+
"typesVersions",
|
|
1348
|
+
"bin",
|
|
1349
|
+
"icon",
|
|
1350
|
+
"files",
|
|
1351
|
+
"engines",
|
|
1352
|
+
"activationEvents",
|
|
1353
|
+
"contributes",
|
|
1354
|
+
"scripts",
|
|
1355
|
+
"peerDependencies",
|
|
1356
|
+
"peerDependenciesMeta",
|
|
1357
|
+
"dependencies",
|
|
1358
|
+
"optionalDependencies",
|
|
1359
|
+
"devDependencies",
|
|
1360
|
+
"pnpm",
|
|
1361
|
+
"overrides",
|
|
1362
|
+
"resolutions",
|
|
1363
|
+
"husky",
|
|
1364
|
+
"simple-git-hooks",
|
|
1365
|
+
"lint-staged",
|
|
1366
|
+
"eslintConfig"
|
|
1367
|
+
],
|
|
1368
|
+
pathPattern: "^$"
|
|
1369
|
+
},
|
|
1370
|
+
{
|
|
1371
|
+
order: { type: "asc" },
|
|
1372
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
order: { type: "asc" },
|
|
1376
|
+
pathPattern: "^resolutions$"
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
order: { type: "asc" },
|
|
1380
|
+
pathPattern: "^pnpm.overrides$"
|
|
1381
|
+
},
|
|
1382
|
+
{
|
|
1383
|
+
order: [
|
|
1384
|
+
"types",
|
|
1385
|
+
"import",
|
|
1386
|
+
"require",
|
|
1387
|
+
"default"
|
|
1388
|
+
],
|
|
1389
|
+
pathPattern: "^exports.*$"
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
order: [
|
|
1393
|
+
"pre-commit",
|
|
1394
|
+
"prepare-commit-msg",
|
|
1395
|
+
"commit-msg",
|
|
1396
|
+
"post-commit",
|
|
1397
|
+
"pre-rebase",
|
|
1398
|
+
"post-rewrite",
|
|
1399
|
+
"post-checkout",
|
|
1400
|
+
"post-merge",
|
|
1401
|
+
"pre-push",
|
|
1402
|
+
"pre-auto-gc"
|
|
1403
|
+
],
|
|
1404
|
+
pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
|
|
1405
|
+
}
|
|
1406
|
+
]
|
|
1407
|
+
}
|
|
1408
|
+
}];
|
|
1538
1409
|
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Sort tsconfig.json
|
|
1412
|
+
*
|
|
1413
|
+
* Requires `jsonc` config
|
|
1414
|
+
*/
|
|
1539
1415
|
function sortTsconfig() {
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
"verbatimModuleSyntax",
|
|
1655
|
-
"erasableSyntaxOnly",
|
|
1656
|
-
/* Completeness */
|
|
1657
|
-
"skipDefaultLibCheck",
|
|
1658
|
-
"skipLibCheck"
|
|
1659
|
-
],
|
|
1660
|
-
pathPattern: "^compilerOptions$"
|
|
1661
|
-
}
|
|
1662
|
-
]
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
];
|
|
1416
|
+
return [{
|
|
1417
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
1418
|
+
name: "luxass/sort/tsconfig",
|
|
1419
|
+
rules: { "jsonc/sort-keys": [
|
|
1420
|
+
"error",
|
|
1421
|
+
{
|
|
1422
|
+
order: [
|
|
1423
|
+
"extends",
|
|
1424
|
+
"compilerOptions",
|
|
1425
|
+
"references",
|
|
1426
|
+
"files",
|
|
1427
|
+
"include",
|
|
1428
|
+
"exclude"
|
|
1429
|
+
],
|
|
1430
|
+
pathPattern: "^$"
|
|
1431
|
+
},
|
|
1432
|
+
{
|
|
1433
|
+
order: [
|
|
1434
|
+
"incremental",
|
|
1435
|
+
"composite",
|
|
1436
|
+
"tsBuildInfoFile",
|
|
1437
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
1438
|
+
"disableSolutionSearching",
|
|
1439
|
+
"disableReferencedProjectLoad",
|
|
1440
|
+
"target",
|
|
1441
|
+
"jsx",
|
|
1442
|
+
"jsxFactory",
|
|
1443
|
+
"jsxFragmentFactory",
|
|
1444
|
+
"jsxImportSource",
|
|
1445
|
+
"lib",
|
|
1446
|
+
"moduleDetection",
|
|
1447
|
+
"noLib",
|
|
1448
|
+
"reactNamespace",
|
|
1449
|
+
"useDefineForClassFields",
|
|
1450
|
+
"emitDecoratorMetadata",
|
|
1451
|
+
"experimentalDecorators",
|
|
1452
|
+
"libReplacement",
|
|
1453
|
+
"baseUrl",
|
|
1454
|
+
"rootDir",
|
|
1455
|
+
"rootDirs",
|
|
1456
|
+
"customConditions",
|
|
1457
|
+
"module",
|
|
1458
|
+
"moduleResolution",
|
|
1459
|
+
"moduleSuffixes",
|
|
1460
|
+
"noResolve",
|
|
1461
|
+
"paths",
|
|
1462
|
+
"resolveJsonModule",
|
|
1463
|
+
"resolvePackageJsonExports",
|
|
1464
|
+
"resolvePackageJsonImports",
|
|
1465
|
+
"typeRoots",
|
|
1466
|
+
"types",
|
|
1467
|
+
"allowArbitraryExtensions",
|
|
1468
|
+
"allowImportingTsExtensions",
|
|
1469
|
+
"allowUmdGlobalAccess",
|
|
1470
|
+
"allowJs",
|
|
1471
|
+
"checkJs",
|
|
1472
|
+
"maxNodeModuleJsDepth",
|
|
1473
|
+
"strict",
|
|
1474
|
+
"strictBindCallApply",
|
|
1475
|
+
"strictFunctionTypes",
|
|
1476
|
+
"strictNullChecks",
|
|
1477
|
+
"strictPropertyInitialization",
|
|
1478
|
+
"allowUnreachableCode",
|
|
1479
|
+
"allowUnusedLabels",
|
|
1480
|
+
"alwaysStrict",
|
|
1481
|
+
"exactOptionalPropertyTypes",
|
|
1482
|
+
"noFallthroughCasesInSwitch",
|
|
1483
|
+
"noImplicitAny",
|
|
1484
|
+
"noImplicitOverride",
|
|
1485
|
+
"noImplicitReturns",
|
|
1486
|
+
"noImplicitThis",
|
|
1487
|
+
"noPropertyAccessFromIndexSignature",
|
|
1488
|
+
"noUncheckedIndexedAccess",
|
|
1489
|
+
"noUnusedLocals",
|
|
1490
|
+
"noUnusedParameters",
|
|
1491
|
+
"useUnknownInCatchVariables",
|
|
1492
|
+
"declaration",
|
|
1493
|
+
"declarationDir",
|
|
1494
|
+
"declarationMap",
|
|
1495
|
+
"downlevelIteration",
|
|
1496
|
+
"emitBOM",
|
|
1497
|
+
"emitDeclarationOnly",
|
|
1498
|
+
"importHelpers",
|
|
1499
|
+
"importsNotUsedAsValues",
|
|
1500
|
+
"inlineSourceMap",
|
|
1501
|
+
"inlineSources",
|
|
1502
|
+
"mapRoot",
|
|
1503
|
+
"newLine",
|
|
1504
|
+
"noEmit",
|
|
1505
|
+
"noEmitHelpers",
|
|
1506
|
+
"noEmitOnError",
|
|
1507
|
+
"outDir",
|
|
1508
|
+
"outFile",
|
|
1509
|
+
"preserveConstEnums",
|
|
1510
|
+
"preserveValueImports",
|
|
1511
|
+
"removeComments",
|
|
1512
|
+
"sourceMap",
|
|
1513
|
+
"sourceRoot",
|
|
1514
|
+
"stripInternal",
|
|
1515
|
+
"allowSyntheticDefaultImports",
|
|
1516
|
+
"esModuleInterop",
|
|
1517
|
+
"forceConsistentCasingInFileNames",
|
|
1518
|
+
"isolatedDeclarations",
|
|
1519
|
+
"isolatedModules",
|
|
1520
|
+
"preserveSymlinks",
|
|
1521
|
+
"verbatimModuleSyntax",
|
|
1522
|
+
"erasableSyntaxOnly",
|
|
1523
|
+
"skipDefaultLibCheck",
|
|
1524
|
+
"skipLibCheck"
|
|
1525
|
+
],
|
|
1526
|
+
pathPattern: "^compilerOptions$"
|
|
1527
|
+
}
|
|
1528
|
+
] }
|
|
1529
|
+
}];
|
|
1666
1530
|
}
|
|
1667
1531
|
|
|
1668
|
-
|
|
1532
|
+
//#endregion
|
|
1533
|
+
//#region src/configs/tailwindcss.ts
|
|
1669
1534
|
async function tailwindcss(options = {}) {
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
}
|
|
1690
|
-
},
|
|
1691
|
-
name: "luxass/tailwindcss",
|
|
1692
|
-
plugins: {
|
|
1693
|
-
tailwindcss: pluginTailwindCSS
|
|
1694
|
-
},
|
|
1695
|
-
rules: {
|
|
1696
|
-
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/classnames-order.md
|
|
1697
|
-
"tailwindcss/classnames-order": "warn",
|
|
1698
|
-
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-negative-arbitrary-values.md
|
|
1699
|
-
"tailwindcss/enforces-negative-arbitrary-values": "warn",
|
|
1700
|
-
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-shorthand.md
|
|
1701
|
-
"tailwindcss/enforces-shorthand": "warn",
|
|
1702
|
-
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/migration-from-tailwind-2.md
|
|
1703
|
-
"tailwindcss/migration-from-tailwind-2": "warn",
|
|
1704
|
-
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-arbitrary-value.md
|
|
1705
|
-
"tailwindcss/no-arbitrary-value": "off",
|
|
1706
|
-
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-contradicting-classname.md
|
|
1707
|
-
"tailwindcss/no-contradicting-classname": "error",
|
|
1708
|
-
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-custom-classname.md
|
|
1709
|
-
"tailwindcss/no-custom-classname": "warn",
|
|
1710
|
-
...overrides
|
|
1711
|
-
},
|
|
1712
|
-
settings: {
|
|
1713
|
-
...configPath != null ? {
|
|
1714
|
-
tailwindcss: {
|
|
1715
|
-
config: configPath
|
|
1716
|
-
}
|
|
1717
|
-
} : {}
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
];
|
|
1535
|
+
const { configPath, overrides } = options;
|
|
1536
|
+
await ensure(["eslint-plugin-tailwindcss"]);
|
|
1537
|
+
const [pluginTailwindCSS] = await Promise.all([interop(import("eslint-plugin-tailwindcss"))]);
|
|
1538
|
+
return [{
|
|
1539
|
+
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
|
|
1540
|
+
name: "luxass/tailwindcss",
|
|
1541
|
+
plugins: { tailwindcss: pluginTailwindCSS },
|
|
1542
|
+
rules: {
|
|
1543
|
+
"tailwindcss/classnames-order": "warn",
|
|
1544
|
+
"tailwindcss/enforces-negative-arbitrary-values": "warn",
|
|
1545
|
+
"tailwindcss/enforces-shorthand": "warn",
|
|
1546
|
+
"tailwindcss/migration-from-tailwind-2": "warn",
|
|
1547
|
+
"tailwindcss/no-arbitrary-value": "off",
|
|
1548
|
+
"tailwindcss/no-contradicting-classname": "error",
|
|
1549
|
+
"tailwindcss/no-custom-classname": "warn",
|
|
1550
|
+
...overrides
|
|
1551
|
+
},
|
|
1552
|
+
settings: { ...configPath != null ? { tailwindcss: { config: configPath } } : {} }
|
|
1553
|
+
}];
|
|
1721
1554
|
}
|
|
1722
1555
|
|
|
1723
|
-
|
|
1724
|
-
|
|
1556
|
+
//#endregion
|
|
1557
|
+
//#region src/configs/test.ts
|
|
1558
|
+
let _pluginTest;
|
|
1725
1559
|
async function test(options = {}) {
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
"test/no-focused-tests": isInEditor ? "off" : ["error", { fixable: true }],
|
|
1753
|
-
"test/no-identical-title": "error",
|
|
1754
|
-
"test/no-import-node-test": "error",
|
|
1755
|
-
"test/prefer-hooks-in-order": "error",
|
|
1756
|
-
"test/prefer-lowercase-title": "error",
|
|
1757
|
-
// Disables
|
|
1758
|
-
...{
|
|
1759
|
-
"antfu/no-top-level-await": "off",
|
|
1760
|
-
"no-unused-expressions": "off",
|
|
1761
|
-
"node/prefer-global/process": "off",
|
|
1762
|
-
"ts/explicit-function-return-type": "off"
|
|
1763
|
-
},
|
|
1764
|
-
...overrides
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
];
|
|
1560
|
+
const { files = GLOB_TESTS, isInEditor = false, overrides = {} } = options;
|
|
1561
|
+
const [pluginVitest] = await Promise.all([interop(import("@vitest/eslint-plugin"))]);
|
|
1562
|
+
_pluginTest = _pluginTest || pluginVitest;
|
|
1563
|
+
return [{
|
|
1564
|
+
name: "luxass/test/setup",
|
|
1565
|
+
plugins: { test: _pluginTest }
|
|
1566
|
+
}, {
|
|
1567
|
+
files,
|
|
1568
|
+
name: "luxass/test/rules",
|
|
1569
|
+
rules: {
|
|
1570
|
+
"test/consistent-test-it": ["error", {
|
|
1571
|
+
fn: "it",
|
|
1572
|
+
withinDescribe: "it"
|
|
1573
|
+
}],
|
|
1574
|
+
"test/no-focused-tests": isInEditor ? "off" : ["error", { fixable: true }],
|
|
1575
|
+
"test/no-identical-title": "error",
|
|
1576
|
+
"test/no-import-node-test": "error",
|
|
1577
|
+
"test/prefer-hooks-in-order": "error",
|
|
1578
|
+
"test/prefer-lowercase-title": "error",
|
|
1579
|
+
"antfu/no-top-level-await": "off",
|
|
1580
|
+
"no-unused-expressions": "off",
|
|
1581
|
+
"node/prefer-global/process": "off",
|
|
1582
|
+
"ts/explicit-function-return-type": "off",
|
|
1583
|
+
...overrides
|
|
1584
|
+
}
|
|
1585
|
+
}];
|
|
1768
1586
|
}
|
|
1769
1587
|
|
|
1770
|
-
|
|
1588
|
+
//#endregion
|
|
1589
|
+
//#region src/configs/toml.ts
|
|
1771
1590
|
async function toml(options = {}) {
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
"toml/tables-order": "error",
|
|
1809
|
-
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1810
|
-
...stylistic2 ? {
|
|
1811
|
-
"toml/array-bracket-newline": "error",
|
|
1812
|
-
"toml/array-bracket-spacing": "error",
|
|
1813
|
-
"toml/array-element-newline": "error",
|
|
1814
|
-
"toml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
1815
|
-
"toml/inline-table-curly-spacing": "error",
|
|
1816
|
-
"toml/key-spacing": "error",
|
|
1817
|
-
"toml/padding-line-between-pairs": "error",
|
|
1818
|
-
"toml/padding-line-between-tables": "error",
|
|
1819
|
-
"toml/quoted-keys": "error",
|
|
1820
|
-
"toml/spaced-comment": "error",
|
|
1821
|
-
"toml/table-bracket-spacing": "error"
|
|
1822
|
-
} : {},
|
|
1823
|
-
...overrides
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
];
|
|
1591
|
+
const { files = [GLOB_TOML], overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
1592
|
+
const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
|
|
1593
|
+
const [pluginToml, parserToml] = await Promise.all([interop(import("eslint-plugin-toml")), interop(import("toml-eslint-parser"))]);
|
|
1594
|
+
return [{
|
|
1595
|
+
name: "luxass/toml/setup",
|
|
1596
|
+
plugins: { toml: pluginToml }
|
|
1597
|
+
}, {
|
|
1598
|
+
files,
|
|
1599
|
+
languageOptions: { parser: parserToml },
|
|
1600
|
+
name: "luxass/toml/rules",
|
|
1601
|
+
rules: {
|
|
1602
|
+
"style/spaced-comment": "off",
|
|
1603
|
+
"toml/comma-style": "error",
|
|
1604
|
+
"toml/keys-order": "error",
|
|
1605
|
+
"toml/no-space-dots": "error",
|
|
1606
|
+
"toml/no-unreadable-number-separator": "error",
|
|
1607
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
1608
|
+
"toml/precision-of-integer": "error",
|
|
1609
|
+
"toml/tables-order": "error",
|
|
1610
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1611
|
+
...stylistic$1 ? {
|
|
1612
|
+
"toml/array-bracket-newline": "error",
|
|
1613
|
+
"toml/array-bracket-spacing": "error",
|
|
1614
|
+
"toml/array-element-newline": "error",
|
|
1615
|
+
"toml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
1616
|
+
"toml/inline-table-curly-spacing": "error",
|
|
1617
|
+
"toml/key-spacing": "error",
|
|
1618
|
+
"toml/padding-line-between-pairs": "error",
|
|
1619
|
+
"toml/padding-line-between-tables": "error",
|
|
1620
|
+
"toml/quoted-keys": "error",
|
|
1621
|
+
"toml/spaced-comment": "error",
|
|
1622
|
+
"toml/table-bracket-spacing": "error"
|
|
1623
|
+
} : {},
|
|
1624
|
+
...overrides
|
|
1625
|
+
}
|
|
1626
|
+
}];
|
|
1827
1627
|
}
|
|
1828
1628
|
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
import pluginAntfu4 from "eslint-plugin-antfu";
|
|
1629
|
+
//#endregion
|
|
1630
|
+
//#region src/configs/typescript.ts
|
|
1832
1631
|
async function typescript(options = {}) {
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
"ts/no-unused-expressions": ["error", {
|
|
1969
|
-
allowShortCircuit: true,
|
|
1970
|
-
allowTaggedTemplates: true,
|
|
1971
|
-
allowTernary: true
|
|
1972
|
-
}],
|
|
1973
|
-
"ts/no-unused-vars": "off",
|
|
1974
|
-
"ts/no-use-before-define": [
|
|
1975
|
-
"error",
|
|
1976
|
-
{ classes: false, functions: false, variables: true }
|
|
1977
|
-
],
|
|
1978
|
-
"ts/no-useless-constructor": "off",
|
|
1979
|
-
"ts/no-wrapper-object-types": "error",
|
|
1980
|
-
"ts/triple-slash-reference": "off",
|
|
1981
|
-
"ts/unified-signatures": "off",
|
|
1982
|
-
...type === "lib" ? {
|
|
1983
|
-
"ts/explicit-function-return-type": ["error", {
|
|
1984
|
-
allowExpressions: true,
|
|
1985
|
-
allowHigherOrderFunctions: true,
|
|
1986
|
-
allowIIFEs: true
|
|
1987
|
-
}]
|
|
1988
|
-
} : {},
|
|
1989
|
-
...overrides
|
|
1990
|
-
}
|
|
1991
|
-
},
|
|
1992
|
-
...isTypeAware ? [{
|
|
1993
|
-
files: filesTypeAware,
|
|
1994
|
-
ignores: ignoresTypeAware,
|
|
1995
|
-
name: "luxass/typescript/rules-type-aware",
|
|
1996
|
-
rules: {
|
|
1997
|
-
...typeAwareRules,
|
|
1998
|
-
...overridesTypeAware
|
|
1999
|
-
}
|
|
2000
|
-
}] : []
|
|
2001
|
-
];
|
|
1632
|
+
const { exts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options ?? {};
|
|
1633
|
+
const files = options.files ?? [
|
|
1634
|
+
GLOB_TS,
|
|
1635
|
+
GLOB_TSX,
|
|
1636
|
+
...exts.map((ext) => `**/*.${ext}`)
|
|
1637
|
+
];
|
|
1638
|
+
const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
|
|
1639
|
+
const ignoresTypeAware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS];
|
|
1640
|
+
const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
|
|
1641
|
+
const isTypeAware = !!tsconfigPath;
|
|
1642
|
+
const typeAwareRules = {
|
|
1643
|
+
"dot-notation": "off",
|
|
1644
|
+
"no-implied-eval": "off",
|
|
1645
|
+
"ts/await-thenable": "error",
|
|
1646
|
+
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1647
|
+
"ts/no-floating-promises": "error",
|
|
1648
|
+
"ts/no-for-in-array": "error",
|
|
1649
|
+
"ts/no-implied-eval": "error",
|
|
1650
|
+
"ts/no-misused-promises": "error",
|
|
1651
|
+
"ts/no-unnecessary-type-assertion": "error",
|
|
1652
|
+
"ts/no-unsafe-argument": "error",
|
|
1653
|
+
"ts/no-unsafe-assignment": "error",
|
|
1654
|
+
"ts/no-unsafe-call": "error",
|
|
1655
|
+
"ts/no-unsafe-member-access": "error",
|
|
1656
|
+
"ts/no-unsafe-return": "error",
|
|
1657
|
+
"ts/promise-function-async": "error",
|
|
1658
|
+
"ts/restrict-plus-operands": "error",
|
|
1659
|
+
"ts/restrict-template-expressions": "error",
|
|
1660
|
+
"ts/return-await": ["error", "in-try-catch"],
|
|
1661
|
+
"ts/strict-boolean-expressions": ["error", {
|
|
1662
|
+
allowNullableBoolean: true,
|
|
1663
|
+
allowNullableObject: true
|
|
1664
|
+
}],
|
|
1665
|
+
"ts/switch-exhaustiveness-check": "error",
|
|
1666
|
+
"ts/unbound-method": "error"
|
|
1667
|
+
};
|
|
1668
|
+
const [pluginTs, parserTs] = await Promise.all([interop(import("@typescript-eslint/eslint-plugin")), interop(import("@typescript-eslint/parser"))]);
|
|
1669
|
+
function makeParser(typeAware, files$1, ignores$1) {
|
|
1670
|
+
return {
|
|
1671
|
+
files: files$1,
|
|
1672
|
+
...ignores$1 ? { ignores: ignores$1 } : {},
|
|
1673
|
+
languageOptions: {
|
|
1674
|
+
parser: parserTs,
|
|
1675
|
+
parserOptions: {
|
|
1676
|
+
extraFileExtensions: exts.map((ext) => `.${ext}`),
|
|
1677
|
+
sourceType: "module",
|
|
1678
|
+
...typeAware ? {
|
|
1679
|
+
projectService: {
|
|
1680
|
+
allowDefaultProject: ["./*.js"],
|
|
1681
|
+
defaultProject: tsconfigPath
|
|
1682
|
+
},
|
|
1683
|
+
tsconfigRootDir: process.cwd()
|
|
1684
|
+
} : {},
|
|
1685
|
+
...parserOptions
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1688
|
+
name: `luxass/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
return [
|
|
1692
|
+
{
|
|
1693
|
+
name: "luxass/typescript/setup",
|
|
1694
|
+
plugins: {
|
|
1695
|
+
antfu: pluginAntfu,
|
|
1696
|
+
ts: pluginTs
|
|
1697
|
+
}
|
|
1698
|
+
},
|
|
1699
|
+
...isTypeAware ? [makeParser(true, filesTypeAware, ignoresTypeAware), makeParser(false, files, filesTypeAware)] : [makeParser(false, files)],
|
|
1700
|
+
{
|
|
1701
|
+
files,
|
|
1702
|
+
name: "luxass/typescript/rules",
|
|
1703
|
+
rules: {
|
|
1704
|
+
...renameRules(pluginTs.configs["eslint-recommended"].overrides[0].rules, { "@typescript-eslint": "ts" }),
|
|
1705
|
+
...renameRules(pluginTs.configs.strict.rules, { "@typescript-eslint": "ts" }),
|
|
1706
|
+
"no-dupe-class-members": "off",
|
|
1707
|
+
"no-invalid-this": "off",
|
|
1708
|
+
"no-loss-of-precision": "error",
|
|
1709
|
+
"no-redeclare": "off",
|
|
1710
|
+
"no-use-before-define": "off",
|
|
1711
|
+
"no-useless-constructor": "off",
|
|
1712
|
+
"ts/ban-ts-comment": ["error", {
|
|
1713
|
+
"ts-expect-error": "allow-with-description",
|
|
1714
|
+
"ts-ignore": "allow-with-description"
|
|
1715
|
+
}],
|
|
1716
|
+
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1717
|
+
"ts/consistent-type-imports": ["error", {
|
|
1718
|
+
disallowTypeAnnotations: false,
|
|
1719
|
+
fixStyle: "separate-type-imports",
|
|
1720
|
+
prefer: "type-imports"
|
|
1721
|
+
}],
|
|
1722
|
+
"ts/method-signature-style": ["error", "property"],
|
|
1723
|
+
"ts/no-dupe-class-members": "error",
|
|
1724
|
+
"ts/no-dynamic-delete": "off",
|
|
1725
|
+
"ts/no-empty-object-type": "error",
|
|
1726
|
+
"ts/no-explicit-any": "off",
|
|
1727
|
+
"ts/no-extraneous-class": "off",
|
|
1728
|
+
"ts/no-import-type-side-effects": "error",
|
|
1729
|
+
"ts/no-invalid-this": "error",
|
|
1730
|
+
"ts/no-invalid-void-type": "off",
|
|
1731
|
+
"ts/no-non-null-assertion": "off",
|
|
1732
|
+
"ts/no-redeclare": ["error", { builtinGlobals: false }],
|
|
1733
|
+
"ts/no-require-imports": "error",
|
|
1734
|
+
"ts/no-unused-expressions": ["error", {
|
|
1735
|
+
allowShortCircuit: true,
|
|
1736
|
+
allowTaggedTemplates: true,
|
|
1737
|
+
allowTernary: true
|
|
1738
|
+
}],
|
|
1739
|
+
"ts/no-unused-vars": "off",
|
|
1740
|
+
"ts/no-use-before-define": ["error", {
|
|
1741
|
+
classes: false,
|
|
1742
|
+
functions: false,
|
|
1743
|
+
variables: true
|
|
1744
|
+
}],
|
|
1745
|
+
"ts/no-useless-constructor": "off",
|
|
1746
|
+
"ts/no-wrapper-object-types": "error",
|
|
1747
|
+
"ts/triple-slash-reference": "off",
|
|
1748
|
+
"ts/unified-signatures": "off",
|
|
1749
|
+
...type === "lib" ? { "ts/explicit-function-return-type": ["error", {
|
|
1750
|
+
allowExpressions: true,
|
|
1751
|
+
allowHigherOrderFunctions: true,
|
|
1752
|
+
allowIIFEs: true
|
|
1753
|
+
}] } : {},
|
|
1754
|
+
...overrides
|
|
1755
|
+
}
|
|
1756
|
+
},
|
|
1757
|
+
...isTypeAware ? [{
|
|
1758
|
+
files: filesTypeAware,
|
|
1759
|
+
ignores: ignoresTypeAware,
|
|
1760
|
+
name: "luxass/typescript/rules-type-aware",
|
|
1761
|
+
rules: {
|
|
1762
|
+
...typeAwareRules,
|
|
1763
|
+
...overridesTypeAware
|
|
1764
|
+
}
|
|
1765
|
+
}] : []
|
|
1766
|
+
];
|
|
2002
1767
|
}
|
|
2003
1768
|
|
|
2004
|
-
|
|
2005
|
-
|
|
1769
|
+
//#endregion
|
|
1770
|
+
//#region src/configs/unicorn.ts
|
|
2006
1771
|
async function unicorn(options = {}) {
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
"unicorn/no-new-array": "error",
|
|
2027
|
-
// Prevent deprecated `new Buffer()`
|
|
2028
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-buffer.md
|
|
2029
|
-
"unicorn/no-new-buffer": "error",
|
|
2030
|
-
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
2031
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/number-literal-case.md
|
|
2032
|
-
"unicorn/number-literal-case": "error",
|
|
2033
|
-
// textContent instead of innerText
|
|
2034
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-text-content.md
|
|
2035
|
-
"unicorn/prefer-dom-node-text-content": "error",
|
|
2036
|
-
// includes over indexOf when checking for existence
|
|
2037
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes.md
|
|
2038
|
-
"unicorn/prefer-includes": "error",
|
|
2039
|
-
// Prefer using the node: protocol
|
|
2040
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
2041
|
-
"unicorn/prefer-node-protocol": "error",
|
|
2042
|
-
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
2043
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-properties.md
|
|
2044
|
-
"unicorn/prefer-number-properties": "error",
|
|
2045
|
-
// String methods startsWith/endsWith instead of more complicated stuff
|
|
2046
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md
|
|
2047
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
2048
|
-
// Enforce throwing type error when throwing error while checking typeof
|
|
2049
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-type-error.md
|
|
2050
|
-
"unicorn/prefer-type-error": "error",
|
|
2051
|
-
// Use new when throwing error
|
|
2052
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md
|
|
2053
|
-
"unicorn/throw-new-error": "error"
|
|
2054
|
-
}
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
];
|
|
1772
|
+
return [{
|
|
1773
|
+
name: "luxass/unicorn/rules",
|
|
1774
|
+
plugins: { unicorn: pluginUnicorn },
|
|
1775
|
+
rules: { ...options.allRecommended ? pluginUnicorn.configs.recommended.rules : {
|
|
1776
|
+
"unicorn/error-message": "error",
|
|
1777
|
+
"unicorn/escape-case": "error",
|
|
1778
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
1779
|
+
"unicorn/no-new-array": "error",
|
|
1780
|
+
"unicorn/no-new-buffer": "error",
|
|
1781
|
+
"unicorn/number-literal-case": "error",
|
|
1782
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
1783
|
+
"unicorn/prefer-includes": "error",
|
|
1784
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1785
|
+
"unicorn/prefer-number-properties": "error",
|
|
1786
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1787
|
+
"unicorn/prefer-type-error": "error",
|
|
1788
|
+
"unicorn/throw-new-error": "error"
|
|
1789
|
+
} }
|
|
1790
|
+
}];
|
|
2058
1791
|
}
|
|
2059
1792
|
|
|
2060
|
-
|
|
1793
|
+
//#endregion
|
|
1794
|
+
//#region src/configs/unocss.ts
|
|
2061
1795
|
async function unocss(options = {}) {
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
return [
|
|
2077
|
-
{
|
|
2078
|
-
name: "luxass/unocss",
|
|
2079
|
-
plugins: {
|
|
2080
|
-
unocss: pluginUnoCSS
|
|
2081
|
-
},
|
|
2082
|
-
rules: {
|
|
2083
|
-
"unocss/order": "warn",
|
|
2084
|
-
...attributify ? {
|
|
2085
|
-
"unocss/order-attributify": "warn"
|
|
2086
|
-
} : {},
|
|
2087
|
-
...strict ? {
|
|
2088
|
-
"unocss/blocklist": "error"
|
|
2089
|
-
} : {},
|
|
2090
|
-
...overrides
|
|
2091
|
-
},
|
|
2092
|
-
settings: {
|
|
2093
|
-
...configPath != null ? {
|
|
2094
|
-
unocss: {
|
|
2095
|
-
configPath
|
|
2096
|
-
}
|
|
2097
|
-
} : {}
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
];
|
|
1796
|
+
const { attributify = true, configPath, overrides, strict = false } = options;
|
|
1797
|
+
await ensure(["@unocss/eslint-plugin"]);
|
|
1798
|
+
const [pluginUnoCSS] = await Promise.all([interop(import("@unocss/eslint-plugin"))]);
|
|
1799
|
+
return [{
|
|
1800
|
+
name: "luxass/unocss",
|
|
1801
|
+
plugins: { unocss: pluginUnoCSS },
|
|
1802
|
+
rules: {
|
|
1803
|
+
"unocss/order": "warn",
|
|
1804
|
+
...attributify ? { "unocss/order-attributify": "warn" } : {},
|
|
1805
|
+
...strict ? { "unocss/blocklist": "error" } : {},
|
|
1806
|
+
...overrides
|
|
1807
|
+
},
|
|
1808
|
+
settings: { ...configPath != null ? { unocss: { configPath } } : {} }
|
|
1809
|
+
}];
|
|
2101
1810
|
}
|
|
2102
1811
|
|
|
2103
|
-
|
|
2104
|
-
|
|
1812
|
+
//#endregion
|
|
1813
|
+
//#region src/configs/vue.ts
|
|
2105
1814
|
async function vue(options = {}) {
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
],
|
|
2273
|
-
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
2274
|
-
"vue/object-curly-newline": "off",
|
|
2275
|
-
"vue/object-curly-spacing": ["error", "always"],
|
|
2276
|
-
"vue/object-property-newline": [
|
|
2277
|
-
"error",
|
|
2278
|
-
{ allowMultiplePropertiesPerLine: true }
|
|
2279
|
-
],
|
|
2280
|
-
"vue/operator-linebreak": ["error", "before"],
|
|
2281
|
-
"vue/padding-line-between-blocks": ["error", "always"],
|
|
2282
|
-
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
2283
|
-
"vue/space-in-parens": ["error", "never"],
|
|
2284
|
-
"vue/template-curly-spacing": "error"
|
|
2285
|
-
} : {},
|
|
2286
|
-
...overrides
|
|
2287
|
-
}
|
|
2288
|
-
}
|
|
2289
|
-
];
|
|
1815
|
+
const { files = [GLOB_VUE], overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
1816
|
+
const [pluginVue, parserVue, processorVueBlocks] = await Promise.all([
|
|
1817
|
+
interop(import("eslint-plugin-vue")),
|
|
1818
|
+
interop(import("vue-eslint-parser")),
|
|
1819
|
+
interop(import("eslint-processor-vue-blocks"))
|
|
1820
|
+
]);
|
|
1821
|
+
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
1822
|
+
const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
|
|
1823
|
+
return [{
|
|
1824
|
+
languageOptions: { globals: {
|
|
1825
|
+
computed: "readonly",
|
|
1826
|
+
defineEmits: "readonly",
|
|
1827
|
+
defineExpose: "readonly",
|
|
1828
|
+
defineProps: "readonly",
|
|
1829
|
+
onMounted: "readonly",
|
|
1830
|
+
onUnmounted: "readonly",
|
|
1831
|
+
reactive: "readonly",
|
|
1832
|
+
ref: "readonly",
|
|
1833
|
+
shallowReactive: "readonly",
|
|
1834
|
+
shallowRef: "readonly",
|
|
1835
|
+
toRef: "readonly",
|
|
1836
|
+
toRefs: "readonly",
|
|
1837
|
+
watch: "readonly",
|
|
1838
|
+
watchEffect: "readonly"
|
|
1839
|
+
} },
|
|
1840
|
+
name: "luxass/vue/setup",
|
|
1841
|
+
plugins: { vue: pluginVue }
|
|
1842
|
+
}, {
|
|
1843
|
+
files,
|
|
1844
|
+
languageOptions: {
|
|
1845
|
+
parser: parserVue,
|
|
1846
|
+
parserOptions: {
|
|
1847
|
+
ecmaFeatures: { jsx: true },
|
|
1848
|
+
extraFileExtensions: [".vue"],
|
|
1849
|
+
parser: options.typescript ? await interop(import("@typescript-eslint/parser")) : null,
|
|
1850
|
+
sourceType: "module"
|
|
1851
|
+
}
|
|
1852
|
+
},
|
|
1853
|
+
name: "luxass/vue/rules",
|
|
1854
|
+
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors([pluginVue.processors[".vue"], processorVueBlocks({
|
|
1855
|
+
...sfcBlocks,
|
|
1856
|
+
blocks: {
|
|
1857
|
+
styles: true,
|
|
1858
|
+
...sfcBlocks.blocks
|
|
1859
|
+
}
|
|
1860
|
+
})]),
|
|
1861
|
+
rules: {
|
|
1862
|
+
...pluginVue.configs.base.rules,
|
|
1863
|
+
...pluginVue.configs["flat/essential"].map((c) => c.rules).reduce((acc, c) => ({
|
|
1864
|
+
...acc,
|
|
1865
|
+
...c
|
|
1866
|
+
}), {}),
|
|
1867
|
+
...pluginVue.configs["flat/strongly-recommended"].map((c) => c.rules).reduce((acc, c) => ({
|
|
1868
|
+
...acc,
|
|
1869
|
+
...c
|
|
1870
|
+
}), {}),
|
|
1871
|
+
...pluginVue.configs["flat/recommended"].map((c) => c.rules).reduce((acc, c) => ({
|
|
1872
|
+
...acc,
|
|
1873
|
+
...c
|
|
1874
|
+
}), {}),
|
|
1875
|
+
"antfu/no-top-level-await": "off",
|
|
1876
|
+
"node/prefer-global/process": "off",
|
|
1877
|
+
"ts/explicit-function-return-type": "off",
|
|
1878
|
+
"vue/block-order": ["error", { order: [
|
|
1879
|
+
"script",
|
|
1880
|
+
"template",
|
|
1881
|
+
"style"
|
|
1882
|
+
] }],
|
|
1883
|
+
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1884
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1885
|
+
"vue/component-tags-order": "off",
|
|
1886
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1887
|
+
"vue/define-macros-order": ["error", { order: [
|
|
1888
|
+
"defineOptions",
|
|
1889
|
+
"defineProps",
|
|
1890
|
+
"defineEmits",
|
|
1891
|
+
"defineSlots"
|
|
1892
|
+
] }],
|
|
1893
|
+
"vue/dot-location": ["error", "property"],
|
|
1894
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1895
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
1896
|
+
"vue/html-indent": ["error", indent],
|
|
1897
|
+
"vue/html-quotes": ["error", "double"],
|
|
1898
|
+
"vue/max-attributes-per-line": "off",
|
|
1899
|
+
"vue/multi-word-component-names": "off",
|
|
1900
|
+
"vue/no-dupe-keys": "off",
|
|
1901
|
+
"vue/no-empty-pattern": "error",
|
|
1902
|
+
"vue/no-irregular-whitespace": "error",
|
|
1903
|
+
"vue/no-loss-of-precision": "error",
|
|
1904
|
+
"vue/no-restricted-syntax": [
|
|
1905
|
+
"error",
|
|
1906
|
+
"DebuggerStatement",
|
|
1907
|
+
"LabeledStatement",
|
|
1908
|
+
"WithStatement"
|
|
1909
|
+
],
|
|
1910
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1911
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
1912
|
+
"vue/no-sparse-arrays": "error",
|
|
1913
|
+
"vue/no-unused-refs": "error",
|
|
1914
|
+
"vue/no-useless-v-bind": "error",
|
|
1915
|
+
"vue/no-v-html": "off",
|
|
1916
|
+
"vue/object-shorthand": [
|
|
1917
|
+
"error",
|
|
1918
|
+
"always",
|
|
1919
|
+
{
|
|
1920
|
+
avoidQuotes: true,
|
|
1921
|
+
ignoreConstructors: false
|
|
1922
|
+
}
|
|
1923
|
+
],
|
|
1924
|
+
"vue/prefer-separate-static-class": "error",
|
|
1925
|
+
"vue/prefer-template": "error",
|
|
1926
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1927
|
+
"vue/require-default-prop": "off",
|
|
1928
|
+
"vue/require-prop-types": "off",
|
|
1929
|
+
"vue/space-infix-ops": "error",
|
|
1930
|
+
"vue/space-unary-ops": ["error", {
|
|
1931
|
+
nonwords: false,
|
|
1932
|
+
words: true
|
|
1933
|
+
}],
|
|
1934
|
+
...stylistic$1 ? {
|
|
1935
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1936
|
+
"vue/arrow-spacing": ["error", {
|
|
1937
|
+
after: true,
|
|
1938
|
+
before: true
|
|
1939
|
+
}],
|
|
1940
|
+
"vue/block-spacing": ["error", "always"],
|
|
1941
|
+
"vue/block-tag-newline": ["error", {
|
|
1942
|
+
multiline: "always",
|
|
1943
|
+
singleline: "always"
|
|
1944
|
+
}],
|
|
1945
|
+
"vue/brace-style": [
|
|
1946
|
+
"error",
|
|
1947
|
+
"stroustrup",
|
|
1948
|
+
{ allowSingleLine: true }
|
|
1949
|
+
],
|
|
1950
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1951
|
+
"vue/comma-spacing": ["error", {
|
|
1952
|
+
after: true,
|
|
1953
|
+
before: false
|
|
1954
|
+
}],
|
|
1955
|
+
"vue/comma-style": ["error", "last"],
|
|
1956
|
+
"vue/html-comment-content-spacing": [
|
|
1957
|
+
"error",
|
|
1958
|
+
"always",
|
|
1959
|
+
{ exceptions: ["-"] }
|
|
1960
|
+
],
|
|
1961
|
+
"vue/key-spacing": ["error", {
|
|
1962
|
+
afterColon: true,
|
|
1963
|
+
beforeColon: false
|
|
1964
|
+
}],
|
|
1965
|
+
"vue/keyword-spacing": ["error", {
|
|
1966
|
+
after: true,
|
|
1967
|
+
before: true
|
|
1968
|
+
}],
|
|
1969
|
+
"vue/object-curly-newline": "off",
|
|
1970
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1971
|
+
"vue/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
1972
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1973
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1974
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1975
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1976
|
+
"vue/template-curly-spacing": "error"
|
|
1977
|
+
} : {},
|
|
1978
|
+
...overrides
|
|
1979
|
+
}
|
|
1980
|
+
}];
|
|
2290
1981
|
}
|
|
2291
1982
|
|
|
2292
|
-
|
|
1983
|
+
//#endregion
|
|
1984
|
+
//#region src/configs/yaml.ts
|
|
2293
1985
|
async function yaml(options = {}) {
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
"onlyBuiltDependencies",
|
|
2370
|
-
"onlyBuiltDependenciesFile",
|
|
2371
|
-
"packageExtensions",
|
|
2372
|
-
"peerDependencyRules",
|
|
2373
|
-
"supportedArchitectures"
|
|
2374
|
-
],
|
|
2375
|
-
pathPattern: "^$"
|
|
2376
|
-
},
|
|
2377
|
-
{
|
|
2378
|
-
order: { type: "asc" },
|
|
2379
|
-
pathPattern: ".*"
|
|
2380
|
-
}
|
|
2381
|
-
]
|
|
2382
|
-
}
|
|
2383
|
-
}
|
|
2384
|
-
];
|
|
1986
|
+
const { files = [GLOB_YAML], overrides = {}, stylistic: stylistic$1 = true } = options;
|
|
1987
|
+
const [pluginYaml, parserYaml] = await Promise.all([interop(import("eslint-plugin-yml")), interop(import("yaml-eslint-parser"))]);
|
|
1988
|
+
const { indent = 2, quotes = "double" } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
|
|
1989
|
+
return [
|
|
1990
|
+
{
|
|
1991
|
+
name: "luxass/yaml/setup",
|
|
1992
|
+
plugins: { yaml: pluginYaml }
|
|
1993
|
+
},
|
|
1994
|
+
{
|
|
1995
|
+
files,
|
|
1996
|
+
languageOptions: { parser: parserYaml },
|
|
1997
|
+
name: "luxass/yaml/rules",
|
|
1998
|
+
rules: {
|
|
1999
|
+
"style/spaced-comment": "off",
|
|
2000
|
+
"yaml/block-mapping": "error",
|
|
2001
|
+
"yaml/block-sequence": "error",
|
|
2002
|
+
"yaml/no-empty-key": "error",
|
|
2003
|
+
"yaml/no-empty-mapping-value": "error",
|
|
2004
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
2005
|
+
"yaml/no-irregular-whitespace": "error",
|
|
2006
|
+
"yaml/plain-scalar": "error",
|
|
2007
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
2008
|
+
...stylistic$1 ? {
|
|
2009
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
2010
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
2011
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
2012
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
2013
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
2014
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
2015
|
+
"yaml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
2016
|
+
"yaml/key-spacing": "error",
|
|
2017
|
+
"yaml/no-tab-indent": "error",
|
|
2018
|
+
"yaml/quotes": ["error", {
|
|
2019
|
+
avoidEscape: true,
|
|
2020
|
+
prefer: quotes === "backtick" ? "single" : quotes
|
|
2021
|
+
}],
|
|
2022
|
+
"yaml/spaced-comment": "error"
|
|
2023
|
+
} : {},
|
|
2024
|
+
...overrides
|
|
2025
|
+
}
|
|
2026
|
+
},
|
|
2027
|
+
{
|
|
2028
|
+
files: ["pnpm-workspace.yaml"],
|
|
2029
|
+
name: "luxass/yaml/pnpm-workspace",
|
|
2030
|
+
rules: { "yaml/sort-keys": [
|
|
2031
|
+
"error",
|
|
2032
|
+
{
|
|
2033
|
+
order: [
|
|
2034
|
+
"packages",
|
|
2035
|
+
"overrides",
|
|
2036
|
+
"patchedDependencies",
|
|
2037
|
+
"hoistPattern",
|
|
2038
|
+
"catalog",
|
|
2039
|
+
"catalogs",
|
|
2040
|
+
"allowedDeprecatedVersions",
|
|
2041
|
+
"allowNonAppliedPatches",
|
|
2042
|
+
"configDependencies",
|
|
2043
|
+
"ignoredBuiltDependencies",
|
|
2044
|
+
"ignoredOptionalDependencies",
|
|
2045
|
+
"neverBuiltDependencies",
|
|
2046
|
+
"onlyBuiltDependencies",
|
|
2047
|
+
"onlyBuiltDependenciesFile",
|
|
2048
|
+
"packageExtensions",
|
|
2049
|
+
"peerDependencyRules",
|
|
2050
|
+
"supportedArchitectures"
|
|
2051
|
+
],
|
|
2052
|
+
pathPattern: "^$"
|
|
2053
|
+
},
|
|
2054
|
+
{
|
|
2055
|
+
order: { type: "asc" },
|
|
2056
|
+
pathPattern: ".*"
|
|
2057
|
+
}
|
|
2058
|
+
] }
|
|
2059
|
+
}
|
|
2060
|
+
];
|
|
2385
2061
|
}
|
|
2386
2062
|
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2063
|
+
//#endregion
|
|
2064
|
+
//#region src/factory.ts
|
|
2065
|
+
const FLAT_CONFIG_PROPS = [
|
|
2066
|
+
"name",
|
|
2067
|
+
"languageOptions",
|
|
2068
|
+
"linterOptions",
|
|
2069
|
+
"processor",
|
|
2070
|
+
"plugins",
|
|
2071
|
+
"rules",
|
|
2072
|
+
"settings"
|
|
2396
2073
|
];
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2074
|
+
const VuePackages = [
|
|
2075
|
+
"vue",
|
|
2076
|
+
"nuxt",
|
|
2077
|
+
"vitepress",
|
|
2078
|
+
"@slidev/cli"
|
|
2402
2079
|
];
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
"yml": "yaml"
|
|
2080
|
+
const defaultPluginRenaming = {
|
|
2081
|
+
"@eslint-react": "react",
|
|
2082
|
+
"@eslint-react/dom": "react-dom",
|
|
2083
|
+
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
2084
|
+
"@eslint-react/naming-convention": "react-naming-convention",
|
|
2085
|
+
"@stylistic": "style",
|
|
2086
|
+
"@typescript-eslint": "ts",
|
|
2087
|
+
"n": "node",
|
|
2088
|
+
"vitest": "test",
|
|
2089
|
+
"yml": "yaml"
|
|
2414
2090
|
};
|
|
2091
|
+
/**
|
|
2092
|
+
* Construct an array of ESLint flat config items.
|
|
2093
|
+
*
|
|
2094
|
+
* @param {OptionsConfig & TypedFlatConfigItem} options
|
|
2095
|
+
* The options for generating the ESLint configurations.
|
|
2096
|
+
* @param {Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>[]} userConfigs
|
|
2097
|
+
* The user configurations to be merged with the generated configurations.
|
|
2098
|
+
* @returns {Promise<TypedFlatConfigItem[]>}
|
|
2099
|
+
* The merged ESLint configurations.
|
|
2100
|
+
*/
|
|
2415
2101
|
function luxass(options = {}, ...userConfigs) {
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
...resolveSubOptions(options, "react"),
|
|
2513
|
-
overrides: getOverrides(options, "react"),
|
|
2514
|
-
tsconfigPath
|
|
2515
|
-
}));
|
|
2516
|
-
}
|
|
2517
|
-
if (enableVue) {
|
|
2518
|
-
configs2.push(
|
|
2519
|
-
vue({
|
|
2520
|
-
...resolveSubOptions(options, "vue"),
|
|
2521
|
-
overrides: getOverrides(options, "vue"),
|
|
2522
|
-
stylistic: stylisticOptions,
|
|
2523
|
-
typescript: !!enableTypeScript
|
|
2524
|
-
})
|
|
2525
|
-
);
|
|
2526
|
-
}
|
|
2527
|
-
if (enableAstro) {
|
|
2528
|
-
configs2.push(
|
|
2529
|
-
astro({
|
|
2530
|
-
...resolveSubOptions(options, "astro"),
|
|
2531
|
-
overrides: getOverrides(options, "astro")
|
|
2532
|
-
})
|
|
2533
|
-
);
|
|
2534
|
-
}
|
|
2535
|
-
if (enableUnoCSS) {
|
|
2536
|
-
configs2.push(unocss({
|
|
2537
|
-
...resolveSubOptions(options, "unocss"),
|
|
2538
|
-
overrides: getOverrides(options, "unocss")
|
|
2539
|
-
}));
|
|
2540
|
-
}
|
|
2541
|
-
if (enableTailwindCSS) {
|
|
2542
|
-
configs2.push(tailwindcss({
|
|
2543
|
-
...resolveSubOptions(options, "tailwindcss"),
|
|
2544
|
-
overrides: getOverrides(options, "tailwindcss")
|
|
2545
|
-
}));
|
|
2546
|
-
}
|
|
2547
|
-
if (options.jsonc ?? true) {
|
|
2548
|
-
configs2.push(
|
|
2549
|
-
jsonc({
|
|
2550
|
-
overrides: getOverrides(options, "jsonc"),
|
|
2551
|
-
stylistic: stylisticOptions
|
|
2552
|
-
}),
|
|
2553
|
-
sortPackageJson(),
|
|
2554
|
-
sortTsconfig()
|
|
2555
|
-
);
|
|
2556
|
-
}
|
|
2557
|
-
if (enableCatalogs) {
|
|
2558
|
-
configs2.push(
|
|
2559
|
-
pnpm()
|
|
2560
|
-
);
|
|
2561
|
-
}
|
|
2562
|
-
if (options.yaml ?? true) {
|
|
2563
|
-
configs2.push(yaml({
|
|
2564
|
-
overrides: getOverrides(options, "yaml"),
|
|
2565
|
-
stylistic: stylisticOptions
|
|
2566
|
-
}));
|
|
2567
|
-
}
|
|
2568
|
-
if (options.toml ?? true) {
|
|
2569
|
-
configs2.push(toml({
|
|
2570
|
-
overrides: getOverrides(options, "toml"),
|
|
2571
|
-
stylistic: stylisticOptions
|
|
2572
|
-
}));
|
|
2573
|
-
}
|
|
2574
|
-
if (options.markdown ?? true) {
|
|
2575
|
-
configs2.push(
|
|
2576
|
-
markdown({
|
|
2577
|
-
exts,
|
|
2578
|
-
overrides: getOverrides(options, "markdown")
|
|
2579
|
-
})
|
|
2580
|
-
);
|
|
2581
|
-
}
|
|
2582
|
-
if (options.formatters) {
|
|
2583
|
-
configs2.push(formatters(
|
|
2584
|
-
options.formatters,
|
|
2585
|
-
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2586
|
-
));
|
|
2587
|
-
}
|
|
2588
|
-
configs2.push(
|
|
2589
|
-
disables()
|
|
2590
|
-
);
|
|
2591
|
-
if ("files" in options) {
|
|
2592
|
-
throw new Error('[@luxass/eslint-config] The first argument should not contain the "files" property as the options are supposed to be global. Place it in the second or later config instead.');
|
|
2593
|
-
}
|
|
2594
|
-
const fusedConfig = FLAT_CONFIG_PROPS.reduce((acc, key) => {
|
|
2595
|
-
if (key in options) {
|
|
2596
|
-
acc[key] = options[key];
|
|
2597
|
-
}
|
|
2598
|
-
return acc;
|
|
2599
|
-
}, {});
|
|
2600
|
-
if (Object.keys(fusedConfig).length) {
|
|
2601
|
-
configs2.push([fusedConfig]);
|
|
2602
|
-
}
|
|
2603
|
-
let composer = new FlatConfigComposer();
|
|
2604
|
-
composer = composer.append(
|
|
2605
|
-
...configs2,
|
|
2606
|
-
...userConfigs
|
|
2607
|
-
);
|
|
2608
|
-
if (autoRenamePlugins) {
|
|
2609
|
-
composer = composer.renamePlugins(defaultPluginRenaming);
|
|
2610
|
-
}
|
|
2611
|
-
return composer;
|
|
2102
|
+
const { astro: enableAstro = false, autoRenamePlugins = true, exts = [], gitignore: enableGitignore = true, jsx: enableJsx = true, pnpm: enableCatalogs = false, react: enableReact = false, regexp: enableRegexp = true, tailwindcss: enableTailwindCSS = false, type: projectType = "app", typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2103
|
+
let isInEditor = options.isInEditor;
|
|
2104
|
+
if (isInEditor == null) {
|
|
2105
|
+
isInEditor = isInEditorEnv();
|
|
2106
|
+
if (isInEditor) console.log("[@luxass/eslint-config] Detected running in editor, some rules are disabled.");
|
|
2107
|
+
}
|
|
2108
|
+
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2109
|
+
if (stylisticOptions && !("jsx" in stylisticOptions)) stylisticOptions.jsx = enableJsx;
|
|
2110
|
+
const configs$1 = [];
|
|
2111
|
+
if (enableGitignore) if (typeof enableGitignore !== "boolean") configs$1.push(interop(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2112
|
+
name: "luxass/gitignore",
|
|
2113
|
+
...enableGitignore
|
|
2114
|
+
})]));
|
|
2115
|
+
else configs$1.push(interop(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2116
|
+
name: "luxass/gitignore",
|
|
2117
|
+
strict: false
|
|
2118
|
+
})]));
|
|
2119
|
+
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2120
|
+
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2121
|
+
configs$1.push(ignores(), javascript({
|
|
2122
|
+
isInEditor,
|
|
2123
|
+
overrides: getOverrides(options, "javascript")
|
|
2124
|
+
}), comments(), node(), jsdoc({ stylistic: stylisticOptions }), imports({ stylistic: stylisticOptions }), perfectionist());
|
|
2125
|
+
if (enableUnicorn) configs$1.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2126
|
+
if (enableVue) exts.push("vue");
|
|
2127
|
+
if (enableJsx) configs$1.push(jsx());
|
|
2128
|
+
if (enableTypeScript) configs$1.push(typescript({
|
|
2129
|
+
...typescriptOptions,
|
|
2130
|
+
exts,
|
|
2131
|
+
overrides: getOverrides(options, "typescript"),
|
|
2132
|
+
type: projectType
|
|
2133
|
+
}));
|
|
2134
|
+
if (stylisticOptions) configs$1.push(stylistic({
|
|
2135
|
+
...stylisticOptions,
|
|
2136
|
+
overrides: getOverrides(options, "stylistic")
|
|
2137
|
+
}));
|
|
2138
|
+
if (enableRegexp) configs$1.push(regexp({
|
|
2139
|
+
...resolveSubOptions(options, "regexp"),
|
|
2140
|
+
overrides: getOverrides(options, "regexp")
|
|
2141
|
+
}));
|
|
2142
|
+
if (options.test ?? true) configs$1.push(test({
|
|
2143
|
+
isInEditor,
|
|
2144
|
+
overrides: getOverrides(options, "test")
|
|
2145
|
+
}));
|
|
2146
|
+
if (enableReact) configs$1.push(react({
|
|
2147
|
+
...resolveSubOptions(options, "react"),
|
|
2148
|
+
overrides: getOverrides(options, "react"),
|
|
2149
|
+
tsconfigPath
|
|
2150
|
+
}));
|
|
2151
|
+
if (enableVue) configs$1.push(vue({
|
|
2152
|
+
...resolveSubOptions(options, "vue"),
|
|
2153
|
+
overrides: getOverrides(options, "vue"),
|
|
2154
|
+
stylistic: stylisticOptions,
|
|
2155
|
+
typescript: !!enableTypeScript
|
|
2156
|
+
}));
|
|
2157
|
+
if (enableAstro) configs$1.push(astro({
|
|
2158
|
+
...resolveSubOptions(options, "astro"),
|
|
2159
|
+
overrides: getOverrides(options, "astro")
|
|
2160
|
+
}));
|
|
2161
|
+
if (enableUnoCSS) configs$1.push(unocss({
|
|
2162
|
+
...resolveSubOptions(options, "unocss"),
|
|
2163
|
+
overrides: getOverrides(options, "unocss")
|
|
2164
|
+
}));
|
|
2165
|
+
if (enableTailwindCSS) configs$1.push(tailwindcss({
|
|
2166
|
+
...resolveSubOptions(options, "tailwindcss"),
|
|
2167
|
+
overrides: getOverrides(options, "tailwindcss")
|
|
2168
|
+
}));
|
|
2169
|
+
if (options.jsonc ?? true) configs$1.push(jsonc({
|
|
2170
|
+
overrides: getOverrides(options, "jsonc"),
|
|
2171
|
+
stylistic: stylisticOptions
|
|
2172
|
+
}), sortPackageJson(), sortTsconfig());
|
|
2173
|
+
if (enableCatalogs) configs$1.push(pnpm());
|
|
2174
|
+
if (options.yaml ?? true) configs$1.push(yaml({
|
|
2175
|
+
overrides: getOverrides(options, "yaml"),
|
|
2176
|
+
stylistic: stylisticOptions
|
|
2177
|
+
}));
|
|
2178
|
+
if (options.toml ?? true) configs$1.push(toml({
|
|
2179
|
+
overrides: getOverrides(options, "toml"),
|
|
2180
|
+
stylistic: stylisticOptions
|
|
2181
|
+
}));
|
|
2182
|
+
if (options.markdown ?? true) configs$1.push(markdown({
|
|
2183
|
+
exts,
|
|
2184
|
+
overrides: getOverrides(options, "markdown")
|
|
2185
|
+
}));
|
|
2186
|
+
if (options.formatters) configs$1.push(formatters(options.formatters, typeof stylisticOptions === "boolean" ? {} : stylisticOptions));
|
|
2187
|
+
configs$1.push(disables());
|
|
2188
|
+
if ("files" in options) throw new Error("[@luxass/eslint-config] The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
|
|
2189
|
+
const fusedConfig = FLAT_CONFIG_PROPS.reduce((acc, key) => {
|
|
2190
|
+
if (key in options) acc[key] = options[key];
|
|
2191
|
+
return acc;
|
|
2192
|
+
}, {});
|
|
2193
|
+
if (Object.keys(fusedConfig).length) configs$1.push([fusedConfig]);
|
|
2194
|
+
let composer = new FlatConfigComposer();
|
|
2195
|
+
composer = composer.append(...configs$1, ...userConfigs);
|
|
2196
|
+
if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
|
|
2197
|
+
return composer;
|
|
2612
2198
|
}
|
|
2613
2199
|
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
GLOB_EXCLUDE,
|
|
2621
|
-
GLOB_GRAPHQL,
|
|
2622
|
-
GLOB_HTML,
|
|
2623
|
-
GLOB_JS,
|
|
2624
|
-
GLOB_JSON,
|
|
2625
|
-
GLOB_JSON5,
|
|
2626
|
-
GLOB_JSONC,
|
|
2627
|
-
GLOB_JSX,
|
|
2628
|
-
GLOB_LESS,
|
|
2629
|
-
GLOB_MARKDOWN,
|
|
2630
|
-
GLOB_MARKDOWN_CODE,
|
|
2631
|
-
GLOB_MARKDOWN_IN_MARKDOWN,
|
|
2632
|
-
GLOB_NEXTJS_OG,
|
|
2633
|
-
GLOB_NEXTJS_ROUTES,
|
|
2634
|
-
GLOB_POSTCSS,
|
|
2635
|
-
GLOB_SCSS,
|
|
2636
|
-
GLOB_SRC,
|
|
2637
|
-
GLOB_SRC_EXT,
|
|
2638
|
-
GLOB_STYLE,
|
|
2639
|
-
GLOB_SVELTE,
|
|
2640
|
-
GLOB_TESTS,
|
|
2641
|
-
GLOB_TOML,
|
|
2642
|
-
GLOB_TS,
|
|
2643
|
-
GLOB_TSX,
|
|
2644
|
-
GLOB_VUE,
|
|
2645
|
-
GLOB_YAML,
|
|
2646
|
-
astro,
|
|
2647
|
-
combine,
|
|
2648
|
-
comments,
|
|
2649
|
-
index_default as default,
|
|
2650
|
-
disables,
|
|
2651
|
-
ensure,
|
|
2652
|
-
formatters,
|
|
2653
|
-
getOverrides,
|
|
2654
|
-
ignores,
|
|
2655
|
-
imports,
|
|
2656
|
-
interop,
|
|
2657
|
-
isInEditorEnv,
|
|
2658
|
-
isInGitHooksOrLintStaged,
|
|
2659
|
-
isPackageInScope,
|
|
2660
|
-
javascript,
|
|
2661
|
-
jsdoc,
|
|
2662
|
-
jsonc,
|
|
2663
|
-
jsx,
|
|
2664
|
-
luxass,
|
|
2665
|
-
markdown,
|
|
2666
|
-
node,
|
|
2667
|
-
parserPlain,
|
|
2668
|
-
perfectionist,
|
|
2669
|
-
pnpm,
|
|
2670
|
-
react,
|
|
2671
|
-
regexp,
|
|
2672
|
-
renamePluginInConfigs,
|
|
2673
|
-
renameRules,
|
|
2674
|
-
resolveSubOptions,
|
|
2675
|
-
sortPackageJson,
|
|
2676
|
-
sortTsconfig,
|
|
2677
|
-
stylistic,
|
|
2678
|
-
tailwindcss,
|
|
2679
|
-
test,
|
|
2680
|
-
toArray,
|
|
2681
|
-
toml,
|
|
2682
|
-
typescript,
|
|
2683
|
-
unicorn,
|
|
2684
|
-
unocss,
|
|
2685
|
-
vue,
|
|
2686
|
-
yaml
|
|
2687
|
-
};
|
|
2200
|
+
//#endregion
|
|
2201
|
+
//#region src/index.ts
|
|
2202
|
+
var src_default = luxass;
|
|
2203
|
+
|
|
2204
|
+
//#endregion
|
|
2205
|
+
export { GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NEXTJS_OG, GLOB_NEXTJS_ROUTES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, astro, combine, comments, src_default as default, disables, ensure, formatters, getOverrides, ignores, imports, interop, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, luxass, markdown, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|