@vinicunca/eslint-config 4.9.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1531 -2491
- package/dist/index.mjs +253 -371
- package/dist/{lib-BY1orQVd.mjs → lib-D13rzY6d.mjs} +3115 -2895
- package/package.json +49 -41
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import
|
|
3
|
+
import fs from "node:fs/promises";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import fs from "node:fs";
|
|
5
|
+
import fs$1 from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { isPackageExists } from "local-pkg";
|
|
8
8
|
import createCommand from "eslint-plugin-command/config";
|
|
@@ -18,24 +18,20 @@ import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
|
18
18
|
import globals from "globals";
|
|
19
19
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
20
20
|
import { configs } from "eslint-plugin-regexp";
|
|
21
|
-
|
|
22
21
|
//#region node_modules/.pnpm/@vinicunca+perkakas@1.13.2/node_modules/@vinicunca/perkakas/dist/is-boolean.js
|
|
23
|
-
function e$2(e
|
|
24
|
-
return typeof e
|
|
22
|
+
function e$2(e) {
|
|
23
|
+
return typeof e == `boolean`;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
26
|
//#region node_modules/.pnpm/@vinicunca+perkakas@1.13.2/node_modules/@vinicunca/perkakas/dist/is-function.js
|
|
29
|
-
function e$1(e
|
|
30
|
-
return typeof e
|
|
27
|
+
function e$1(e) {
|
|
28
|
+
return typeof e == `function`;
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
//#endregion
|
|
34
31
|
//#region node_modules/.pnpm/@vinicunca+perkakas@1.13.2/node_modules/@vinicunca/perkakas/dist/is-number.js
|
|
35
|
-
function e(e
|
|
36
|
-
return typeof e
|
|
32
|
+
function e(e) {
|
|
33
|
+
return typeof e == `number` && !Number.isNaN(e);
|
|
37
34
|
}
|
|
38
|
-
|
|
39
35
|
//#endregion
|
|
40
36
|
//#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
41
37
|
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
@@ -47,7 +43,7 @@ async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {})
|
|
|
47
43
|
while (directory) {
|
|
48
44
|
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
49
45
|
try {
|
|
50
|
-
const stats = await
|
|
46
|
+
const stats = await fs.stat(filePath);
|
|
51
47
|
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
|
|
52
48
|
} catch {}
|
|
53
49
|
if (directory === stopAt || directory === root) break;
|
|
@@ -62,23 +58,20 @@ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
|
62
58
|
while (directory) {
|
|
63
59
|
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
64
60
|
try {
|
|
65
|
-
const stats = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
61
|
+
const stats = fs$1.statSync(filePath, { throwIfNoEntry: false });
|
|
66
62
|
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
67
63
|
} catch {}
|
|
68
64
|
if (directory === stopAt || directory === root) break;
|
|
69
65
|
directory = path.dirname(directory);
|
|
70
66
|
}
|
|
71
67
|
}
|
|
72
|
-
|
|
73
68
|
//#endregion
|
|
74
69
|
//#region src/flags.ts
|
|
75
70
|
const ERROR = "error";
|
|
76
|
-
const OFF = "off";
|
|
77
71
|
const WARN = "warn";
|
|
78
72
|
const CONSISTENT = "consistent";
|
|
79
73
|
const NEVER = "never";
|
|
80
74
|
const ALWAYS = "always";
|
|
81
|
-
|
|
82
75
|
//#endregion
|
|
83
76
|
//#region src/globs.ts
|
|
84
77
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -152,15 +145,18 @@ const GLOB_EXCLUDE = [
|
|
|
152
145
|
"**/.output",
|
|
153
146
|
"**/.vite-inspect",
|
|
154
147
|
"**/.yarn",
|
|
155
|
-
"**/vite.config.*.timestamp-*",
|
|
156
148
|
"**/CHANGELOG*.md",
|
|
157
|
-
"**/*.min.*",
|
|
158
149
|
"**/LICENSE*",
|
|
150
|
+
"**/*.min.*",
|
|
159
151
|
"**/__snapshots__",
|
|
152
|
+
"**/vite.config.*.timestamp-*",
|
|
160
153
|
"**/auto-import?(s).d.ts",
|
|
161
|
-
"**/components.d.ts"
|
|
154
|
+
"**/components.d.ts",
|
|
155
|
+
"**/.context",
|
|
156
|
+
"**/.claude",
|
|
157
|
+
"**/.agents",
|
|
158
|
+
"**/.*/skills"
|
|
162
159
|
];
|
|
163
|
-
|
|
164
160
|
//#endregion
|
|
165
161
|
//#region src/utils.ts
|
|
166
162
|
const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
@@ -187,8 +183,8 @@ const parserPlain = {
|
|
|
187
183
|
/**
|
|
188
184
|
* Combine array and non-array configs into a single array.
|
|
189
185
|
*/
|
|
190
|
-
async function combineConfigs(...configs
|
|
191
|
-
return (await Promise.all(configs
|
|
186
|
+
async function combineConfigs(...configs) {
|
|
187
|
+
return (await Promise.all(configs)).flat();
|
|
192
188
|
}
|
|
193
189
|
/**
|
|
194
190
|
* Rename plugin prefixes in a rule object.
|
|
@@ -228,8 +224,8 @@ function renameRules(rules, map) {
|
|
|
228
224
|
* })
|
|
229
225
|
* ```
|
|
230
226
|
*/
|
|
231
|
-
function renamePluginInConfigs(configs
|
|
232
|
-
return configs
|
|
227
|
+
function renamePluginInConfigs(configs, map) {
|
|
228
|
+
return configs.map((i) => {
|
|
233
229
|
const clone = { ...i };
|
|
234
230
|
if (clone.rules) clone.rules = renameRules(clone.rules, map);
|
|
235
231
|
if (clone.plugins) clone.plugins = Object.fromEntries(Object.entries(clone.plugins).map(([key, value]) => {
|
|
@@ -263,11 +259,10 @@ function isInEditorEnv() {
|
|
|
263
259
|
function isInGitHooksOrLintStaged() {
|
|
264
260
|
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
265
261
|
}
|
|
266
|
-
|
|
267
262
|
//#endregion
|
|
268
263
|
//#region src/configs/astro.ts
|
|
269
264
|
async function astro(options = {}) {
|
|
270
|
-
const { files = [GLOB_ASTRO], overrides = {}, stylistic
|
|
265
|
+
const { files = [GLOB_ASTRO], overrides = {}, stylistic = true } = options;
|
|
271
266
|
const [pluginAstro, parserAstro, parserTs] = await Promise.all([
|
|
272
267
|
interopDefault(import("eslint-plugin-astro")),
|
|
273
268
|
interopDefault(import("astro-eslint-parser")),
|
|
@@ -290,28 +285,27 @@ async function astro(options = {}) {
|
|
|
290
285
|
name: "vinicunca/astro/rules",
|
|
291
286
|
processor: "astro/client-side-ts",
|
|
292
287
|
rules: {
|
|
293
|
-
"antfu/no-top-level-await":
|
|
288
|
+
"antfu/no-top-level-await": "off",
|
|
294
289
|
"astro/missing-client-only-directive-value": ERROR,
|
|
295
290
|
"astro/no-conflict-set-directives": ERROR,
|
|
296
291
|
"astro/no-deprecated-astro-canonicalurl": ERROR,
|
|
297
292
|
"astro/no-deprecated-astro-fetchcontent": ERROR,
|
|
298
293
|
"astro/no-deprecated-astro-resolve": ERROR,
|
|
299
294
|
"astro/no-deprecated-getentrybyslug": ERROR,
|
|
300
|
-
"astro/no-set-html-directive":
|
|
295
|
+
"astro/no-set-html-directive": "off",
|
|
301
296
|
"astro/no-unused-define-vars-in-style": ERROR,
|
|
302
|
-
"astro/semi":
|
|
297
|
+
"astro/semi": "off",
|
|
303
298
|
"astro/valid-compile": ERROR,
|
|
304
|
-
...stylistic
|
|
305
|
-
"style/indent":
|
|
306
|
-
"style/jsx-closing-tag-location":
|
|
307
|
-
"style/jsx-one-expression-per-line":
|
|
308
|
-
"style/no-multiple-empty-lines":
|
|
299
|
+
...stylistic ? {
|
|
300
|
+
"style/indent": "off",
|
|
301
|
+
"style/jsx-closing-tag-location": "off",
|
|
302
|
+
"style/jsx-one-expression-per-line": "off",
|
|
303
|
+
"style/no-multiple-empty-lines": "off"
|
|
309
304
|
} : {},
|
|
310
305
|
...overrides
|
|
311
306
|
}
|
|
312
307
|
}];
|
|
313
308
|
}
|
|
314
|
-
|
|
315
309
|
//#endregion
|
|
316
310
|
//#region src/configs/command.ts
|
|
317
311
|
async function command() {
|
|
@@ -320,7 +314,6 @@ async function command() {
|
|
|
320
314
|
name: "vinicunca/command/rules"
|
|
321
315
|
}];
|
|
322
316
|
}
|
|
323
|
-
|
|
324
317
|
//#endregion
|
|
325
318
|
//#region src/configs/comments.ts
|
|
326
319
|
async function comments() {
|
|
@@ -335,7 +328,6 @@ async function comments() {
|
|
|
335
328
|
}
|
|
336
329
|
}];
|
|
337
330
|
}
|
|
338
|
-
|
|
339
331
|
//#endregion
|
|
340
332
|
//#region src/configs/disables.ts
|
|
341
333
|
async function disables() {
|
|
@@ -344,70 +336,75 @@ async function disables() {
|
|
|
344
336
|
files: [`**/scripts/${GLOB_SRC}`],
|
|
345
337
|
name: "vinicunca/disables/scripts",
|
|
346
338
|
rules: {
|
|
347
|
-
"antfu/no-top-level-await":
|
|
348
|
-
"no-console":
|
|
349
|
-
"ts/explicit-function-return-type":
|
|
339
|
+
"antfu/no-top-level-await": "off",
|
|
340
|
+
"no-console": "off",
|
|
341
|
+
"ts/explicit-function-return-type": "off"
|
|
350
342
|
}
|
|
351
343
|
},
|
|
352
344
|
{
|
|
353
345
|
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
354
346
|
name: "vinicunca/disables/cli",
|
|
355
347
|
rules: {
|
|
356
|
-
"antfu/no-top-level-await":
|
|
357
|
-
"no-console":
|
|
348
|
+
"antfu/no-top-level-await": "off",
|
|
349
|
+
"no-console": "off"
|
|
358
350
|
}
|
|
359
351
|
},
|
|
360
352
|
{
|
|
361
353
|
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
362
354
|
name: "vinicunca/disables/bin",
|
|
363
355
|
rules: {
|
|
364
|
-
"antfu/no-import-dist":
|
|
365
|
-
"antfu/no-import-node-modules-by-path":
|
|
356
|
+
"antfu/no-import-dist": "off",
|
|
357
|
+
"antfu/no-import-node-modules-by-path": "off"
|
|
366
358
|
}
|
|
367
359
|
},
|
|
368
360
|
{
|
|
369
361
|
files: ["**/*.d.?([cm])ts"],
|
|
370
362
|
name: "vinicunca/disables/dts",
|
|
371
363
|
rules: {
|
|
372
|
-
"eslint-comments/no-unlimited-disable":
|
|
373
|
-
"no-restricted-syntax":
|
|
374
|
-
"unused-imports/no-unused-vars":
|
|
364
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
365
|
+
"no-restricted-syntax": "off",
|
|
366
|
+
"unused-imports/no-unused-vars": "off"
|
|
375
367
|
}
|
|
376
368
|
},
|
|
377
369
|
{
|
|
378
370
|
files: ["**/*.js", "**/*.cjs"],
|
|
379
371
|
name: "vinicunca/disables/cjs",
|
|
380
|
-
rules: { "ts/no-require-imports":
|
|
372
|
+
rules: { "ts/no-require-imports": "off" }
|
|
381
373
|
},
|
|
382
374
|
{
|
|
383
375
|
files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
|
|
384
376
|
name: "vinicunca/disables/config-files",
|
|
385
377
|
rules: {
|
|
386
|
-
"antfu/no-top-level-await":
|
|
387
|
-
"no-console":
|
|
388
|
-
"ts/explicit-function-return-type":
|
|
378
|
+
"antfu/no-top-level-await": "off",
|
|
379
|
+
"no-console": "off",
|
|
380
|
+
"ts/explicit-function-return-type": "off"
|
|
389
381
|
}
|
|
390
382
|
}
|
|
391
383
|
];
|
|
392
384
|
}
|
|
393
|
-
|
|
394
385
|
//#endregion
|
|
395
386
|
//#region src/configs/e18e.ts
|
|
396
387
|
async function e18e(options = {}) {
|
|
397
|
-
const { isInEditor = false, modernization = true, moduleReplacements = isInEditor, overrides = {}, performanceImprovements = true } = options;
|
|
398
|
-
const configs
|
|
388
|
+
const { isInEditor = false, modernization = true, type = "app", moduleReplacements = type === "lib" && isInEditor, overrides = {}, performanceImprovements = true } = options;
|
|
389
|
+
const configs = pluginE18e.configs;
|
|
399
390
|
return [{
|
|
400
391
|
name: "vinicunca/e18e/rules",
|
|
401
392
|
plugins: { e18e: pluginE18e },
|
|
402
393
|
rules: {
|
|
403
|
-
...modernization ? { ...configs
|
|
404
|
-
...moduleReplacements ? { ...configs
|
|
405
|
-
...performanceImprovements ? { ...configs
|
|
394
|
+
...modernization ? { ...configs.modernization.rules } : {},
|
|
395
|
+
...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
|
|
396
|
+
...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
|
|
397
|
+
...type === "lib" ? {} : { "e18e/prefer-static-regex": "off" },
|
|
398
|
+
"e18e/prefer-array-at": "off",
|
|
399
|
+
"e18e/prefer-array-from-map": "off",
|
|
400
|
+
"e18e/prefer-array-to-reversed": "off",
|
|
401
|
+
"e18e/prefer-array-to-sorted": "off",
|
|
402
|
+
"e18e/prefer-array-to-spliced": "off",
|
|
403
|
+
"e18e/prefer-spread-syntax": "off",
|
|
406
404
|
...overrides
|
|
407
405
|
}
|
|
408
406
|
}];
|
|
409
407
|
}
|
|
410
|
-
|
|
411
408
|
//#endregion
|
|
412
409
|
//#region src/configs/stylistic.ts
|
|
413
410
|
const STYLISTIC_CONFIG_DEFAULTS = {
|
|
@@ -417,7 +414,7 @@ const STYLISTIC_CONFIG_DEFAULTS = {
|
|
|
417
414
|
semi: true
|
|
418
415
|
};
|
|
419
416
|
async function stylistic(options = {}) {
|
|
420
|
-
const { experimental, indent, jsx
|
|
417
|
+
const { experimental, indent, jsx, overrides = {}, quotes, semi } = {
|
|
421
418
|
...STYLISTIC_CONFIG_DEFAULTS,
|
|
422
419
|
...options
|
|
423
420
|
};
|
|
@@ -425,7 +422,7 @@ async function stylistic(options = {}) {
|
|
|
425
422
|
const config = pluginStylistic.configs.customize({
|
|
426
423
|
experimental,
|
|
427
424
|
indent,
|
|
428
|
-
jsx
|
|
425
|
+
jsx,
|
|
429
426
|
pluginName: "style",
|
|
430
427
|
quotes,
|
|
431
428
|
semi
|
|
@@ -481,7 +478,6 @@ async function stylistic(options = {}) {
|
|
|
481
478
|
}
|
|
482
479
|
}];
|
|
483
480
|
}
|
|
484
|
-
|
|
485
481
|
//#endregion
|
|
486
482
|
//#region src/configs/formatters.ts
|
|
487
483
|
function mergePrettierOptions(options, overrides) {
|
|
@@ -491,7 +487,7 @@ function mergePrettierOptions(options, overrides) {
|
|
|
491
487
|
plugins: [...overrides.plugins || [], ...options.plugins || []]
|
|
492
488
|
};
|
|
493
489
|
}
|
|
494
|
-
async function formatters(options = {}, stylistic
|
|
490
|
+
async function formatters(options = {}, stylistic = {}) {
|
|
495
491
|
if (options === true) {
|
|
496
492
|
const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
|
|
497
493
|
options = {
|
|
@@ -513,7 +509,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
513
509
|
if (options.slidev && options.markdown !== true && options.markdown !== "prettier") throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
|
|
514
510
|
const { indent, quotes, semi } = {
|
|
515
511
|
...STYLISTIC_CONFIG_DEFAULTS,
|
|
516
|
-
...stylistic
|
|
512
|
+
...stylistic
|
|
517
513
|
};
|
|
518
514
|
const prettierOptions = Object.assign({
|
|
519
515
|
endOfLine: "auto",
|
|
@@ -535,11 +531,11 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
535
531
|
useTabs: indent === "tab",
|
|
536
532
|
...options.dprintOptions || {}
|
|
537
533
|
};
|
|
538
|
-
const configs
|
|
534
|
+
const configs = [{
|
|
539
535
|
name: "vinicunca/formatter/setup",
|
|
540
536
|
plugins: { format: await interopDefault(import("eslint-plugin-format")) }
|
|
541
537
|
}];
|
|
542
|
-
if (options.css) configs
|
|
538
|
+
if (options.css) configs.push({
|
|
543
539
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
544
540
|
languageOptions: { parser: parserPlain },
|
|
545
541
|
name: "vinicunca/formatter/css",
|
|
@@ -555,13 +551,13 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
555
551
|
name: "vinicunca/formatter/less",
|
|
556
552
|
rules: { "format/prettier": [ERROR, mergePrettierOptions(prettierOptions, { parser: "less" })] }
|
|
557
553
|
});
|
|
558
|
-
if (options.html) configs
|
|
554
|
+
if (options.html) configs.push({
|
|
559
555
|
files: ["**/*.html"],
|
|
560
556
|
languageOptions: { parser: parserPlain },
|
|
561
557
|
name: "vinicunca/formatter/html",
|
|
562
558
|
rules: { "format/prettier": [ERROR, mergePrettierOptions(prettierOptions, { parser: "html" })] }
|
|
563
559
|
});
|
|
564
|
-
if (options.xml) configs
|
|
560
|
+
if (options.xml) configs.push({
|
|
565
561
|
files: [GLOB_XML],
|
|
566
562
|
languageOptions: { parser: parserPlain },
|
|
567
563
|
name: "vinicunca/formatter/xml",
|
|
@@ -573,7 +569,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
573
569
|
plugins: ["@prettier/plugin-xml"]
|
|
574
570
|
})] }
|
|
575
571
|
});
|
|
576
|
-
if (options.svg) configs
|
|
572
|
+
if (options.svg) configs.push({
|
|
577
573
|
files: [GLOB_SVG],
|
|
578
574
|
languageOptions: { parser: parserPlain },
|
|
579
575
|
name: "vinicunca/formatter/svg",
|
|
@@ -590,7 +586,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
590
586
|
let GLOB_SLIDEV;
|
|
591
587
|
if (options.slidev) GLOB_SLIDEV = options.slidev === true ? ["**/slides.md"] : options.slidev.files;
|
|
592
588
|
else GLOB_SLIDEV = [];
|
|
593
|
-
configs
|
|
589
|
+
configs.push({
|
|
594
590
|
files: [GLOB_MARKDOWN],
|
|
595
591
|
ignores: GLOB_SLIDEV,
|
|
596
592
|
languageOptions: { parser: parserPlain },
|
|
@@ -603,7 +599,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
603
599
|
language: "markdown"
|
|
604
600
|
}] }
|
|
605
601
|
});
|
|
606
|
-
if (options.slidev) configs
|
|
602
|
+
if (options.slidev) configs.push({
|
|
607
603
|
files: GLOB_SLIDEV,
|
|
608
604
|
languageOptions: { parser: parserPlain },
|
|
609
605
|
name: "vinicunca/formatter/slidev",
|
|
@@ -615,7 +611,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
615
611
|
});
|
|
616
612
|
}
|
|
617
613
|
if (options.astro) {
|
|
618
|
-
configs
|
|
614
|
+
configs.push({
|
|
619
615
|
files: [GLOB_ASTRO],
|
|
620
616
|
languageOptions: { parser: parserPlain },
|
|
621
617
|
name: "vinicunca/formatter/astro",
|
|
@@ -624,45 +620,44 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
624
620
|
plugins: ["prettier-plugin-astro"]
|
|
625
621
|
})] }
|
|
626
622
|
});
|
|
627
|
-
configs
|
|
623
|
+
configs.push({
|
|
628
624
|
files: [GLOB_ASTRO, GLOB_ASTRO_TS],
|
|
629
625
|
name: "vinicunca/formatter/astro/disables",
|
|
630
626
|
rules: {
|
|
631
|
-
"style/arrow-parens":
|
|
632
|
-
"style/block-spacing":
|
|
633
|
-
"style/comma-dangle":
|
|
634
|
-
"style/indent":
|
|
635
|
-
"style/no-multi-spaces":
|
|
636
|
-
"style/quotes":
|
|
637
|
-
"style/semi":
|
|
627
|
+
"style/arrow-parens": "off",
|
|
628
|
+
"style/block-spacing": "off",
|
|
629
|
+
"style/comma-dangle": "off",
|
|
630
|
+
"style/indent": "off",
|
|
631
|
+
"style/no-multi-spaces": "off",
|
|
632
|
+
"style/quotes": "off",
|
|
633
|
+
"style/semi": "off"
|
|
638
634
|
}
|
|
639
635
|
});
|
|
640
636
|
}
|
|
641
|
-
if (options.graphql) configs
|
|
637
|
+
if (options.graphql) configs.push({
|
|
642
638
|
files: [GLOB_GRAPHQL],
|
|
643
639
|
languageOptions: { parser: parserPlain },
|
|
644
640
|
name: "vinicunca/formatter/graphql",
|
|
645
641
|
rules: { "format/prettier": [ERROR, mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
|
|
646
642
|
});
|
|
647
|
-
return configs
|
|
643
|
+
return configs;
|
|
648
644
|
}
|
|
649
|
-
|
|
650
645
|
//#endregion
|
|
651
646
|
//#region src/configs/ignores.ts
|
|
652
|
-
async function ignores(userIgnores = []) {
|
|
653
|
-
let ignores
|
|
654
|
-
if (
|
|
655
|
-
|
|
647
|
+
async function ignores(userIgnores = [], ignoreTypeScript = false) {
|
|
648
|
+
let ignores = [...GLOB_EXCLUDE];
|
|
649
|
+
if (ignoreTypeScript) ignores.push(GLOB_TS, GLOB_TSX);
|
|
650
|
+
if (e$1(userIgnores)) ignores = userIgnores(ignores);
|
|
651
|
+
else ignores = [...ignores, ...userIgnores];
|
|
656
652
|
return [{
|
|
657
|
-
ignores
|
|
653
|
+
ignores,
|
|
658
654
|
name: "vinicunca/ignores"
|
|
659
655
|
}];
|
|
660
656
|
}
|
|
661
|
-
|
|
662
657
|
//#endregion
|
|
663
658
|
//#region src/configs/imports.ts
|
|
664
659
|
async function imports(options = {}) {
|
|
665
|
-
const { overrides = {}, stylistic
|
|
660
|
+
const { overrides = {}, stylistic = true } = options;
|
|
666
661
|
return [{
|
|
667
662
|
name: "vinicunca/imports/rules",
|
|
668
663
|
plugins: {
|
|
@@ -678,12 +673,11 @@ async function imports(options = {}) {
|
|
|
678
673
|
"import/no-duplicates": "error",
|
|
679
674
|
"import/no-mutable-exports": "error",
|
|
680
675
|
"import/no-named-default": "error",
|
|
681
|
-
...stylistic
|
|
676
|
+
...stylistic ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
|
|
682
677
|
...overrides
|
|
683
678
|
}
|
|
684
679
|
}];
|
|
685
680
|
}
|
|
686
|
-
|
|
687
681
|
//#endregion
|
|
688
682
|
//#region src/configs/javascript.ts
|
|
689
683
|
async function javascript(options = {}) {
|
|
@@ -924,11 +918,10 @@ async function javascript(options = {}) {
|
|
|
924
918
|
}
|
|
925
919
|
}];
|
|
926
920
|
}
|
|
927
|
-
|
|
928
921
|
//#endregion
|
|
929
922
|
//#region src/configs/jsdoc.ts
|
|
930
923
|
async function jsdoc(options = {}) {
|
|
931
|
-
const { stylistic
|
|
924
|
+
const { stylistic = true } = options;
|
|
932
925
|
return [{
|
|
933
926
|
name: "vinicunca/jsdoc/setup",
|
|
934
927
|
plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) }
|
|
@@ -955,14 +948,13 @@ async function jsdoc(options = {}) {
|
|
|
955
948
|
"jsdoc/require-returns-description": WARN,
|
|
956
949
|
"jsdoc/require-yields-check": WARN,
|
|
957
950
|
"jsdoc/valid-types": WARN,
|
|
958
|
-
...stylistic
|
|
951
|
+
...stylistic ? {
|
|
959
952
|
"jsdoc/check-alignment": WARN,
|
|
960
953
|
"jsdoc/multiline-blocks": WARN
|
|
961
954
|
} : {}
|
|
962
955
|
}
|
|
963
956
|
}];
|
|
964
957
|
}
|
|
965
|
-
|
|
966
958
|
//#endregion
|
|
967
959
|
//#region src/configs/jsonc.ts
|
|
968
960
|
async function jsonc(options = {}) {
|
|
@@ -970,8 +962,8 @@ async function jsonc(options = {}) {
|
|
|
970
962
|
GLOB_JSON,
|
|
971
963
|
GLOB_JSON5,
|
|
972
964
|
GLOB_JSONC
|
|
973
|
-
], overrides = {}, stylistic
|
|
974
|
-
const { indent = 2 } = e$2(stylistic
|
|
965
|
+
], overrides = {}, stylistic = true } = options;
|
|
966
|
+
const { indent = 2 } = e$2(stylistic) ? {} : stylistic;
|
|
975
967
|
return [{
|
|
976
968
|
name: "vinicunca/jsonc/setup",
|
|
977
969
|
plugins: { jsonc: await interopDefault(import("eslint-plugin-jsonc")) }
|
|
@@ -1006,7 +998,7 @@ async function jsonc(options = {}) {
|
|
|
1006
998
|
"jsonc/space-unary-ops": ERROR,
|
|
1007
999
|
"jsonc/valid-json-number": ERROR,
|
|
1008
1000
|
"jsonc/vue-custom-block/no-parsing-error": ERROR,
|
|
1009
|
-
...stylistic
|
|
1001
|
+
...stylistic ? {
|
|
1010
1002
|
"jsonc/array-bracket-spacing": [ERROR, NEVER],
|
|
1011
1003
|
"jsonc/comma-dangle": [ERROR, NEVER],
|
|
1012
1004
|
"jsonc/comma-style": [ERROR, "last"],
|
|
@@ -1028,7 +1020,6 @@ async function jsonc(options = {}) {
|
|
|
1028
1020
|
}
|
|
1029
1021
|
}];
|
|
1030
1022
|
}
|
|
1031
|
-
|
|
1032
1023
|
//#endregion
|
|
1033
1024
|
//#region src/configs/jsx.ts
|
|
1034
1025
|
async function jsx(options = {}) {
|
|
@@ -1067,22 +1058,21 @@ async function jsx(options = {}) {
|
|
|
1067
1058
|
}
|
|
1068
1059
|
}];
|
|
1069
1060
|
}
|
|
1070
|
-
|
|
1071
1061
|
//#endregion
|
|
1072
1062
|
//#region src/configs/markdown.ts
|
|
1073
1063
|
async function markdown(options = {}) {
|
|
1074
1064
|
const { componentExts = [], files = [GLOB_MARKDOWN], gfm = true, overrides = {}, overridesMarkdown = {} } = options;
|
|
1075
|
-
const markdown
|
|
1065
|
+
const markdown = await interopDefault(import("@eslint/markdown"));
|
|
1076
1066
|
return [
|
|
1077
1067
|
{
|
|
1078
1068
|
name: "vinicunca/markdown/setup",
|
|
1079
|
-
plugins: { markdown
|
|
1069
|
+
plugins: { markdown }
|
|
1080
1070
|
},
|
|
1081
1071
|
{
|
|
1082
1072
|
files,
|
|
1083
1073
|
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
1084
1074
|
name: "vinicunca/markdown/processor",
|
|
1085
|
-
processor: mergeProcessors([markdown
|
|
1075
|
+
processor: mergeProcessors([markdown.processors.markdown, processorPassThrough])
|
|
1086
1076
|
},
|
|
1087
1077
|
{
|
|
1088
1078
|
files,
|
|
@@ -1093,8 +1083,8 @@ async function markdown(options = {}) {
|
|
|
1093
1083
|
files,
|
|
1094
1084
|
name: "vinicunca/markdown/rules",
|
|
1095
1085
|
rules: {
|
|
1096
|
-
...markdown
|
|
1097
|
-
"markdown/no-missing-label-refs":
|
|
1086
|
+
...markdown.configs.recommended.at(0)?.rules,
|
|
1087
|
+
"markdown/no-missing-label-refs": "off",
|
|
1098
1088
|
...overridesMarkdown
|
|
1099
1089
|
}
|
|
1100
1090
|
},
|
|
@@ -1102,15 +1092,15 @@ async function markdown(options = {}) {
|
|
|
1102
1092
|
files,
|
|
1103
1093
|
name: "vinicunca/markdown/disables/markdown",
|
|
1104
1094
|
rules: {
|
|
1105
|
-
"command/command":
|
|
1106
|
-
"no-irregular-whitespace":
|
|
1107
|
-
"perfectionist/sort-exports":
|
|
1108
|
-
"perfectionist/sort-imports":
|
|
1109
|
-
"regexp/no-legacy-features":
|
|
1110
|
-
"regexp/no-missing-g-flag":
|
|
1111
|
-
"regexp/no-useless-dollar-replacements":
|
|
1112
|
-
"regexp/no-useless-flag":
|
|
1113
|
-
"style/indent":
|
|
1095
|
+
"command/command": "off",
|
|
1096
|
+
"no-irregular-whitespace": "off",
|
|
1097
|
+
"perfectionist/sort-exports": "off",
|
|
1098
|
+
"perfectionist/sort-imports": "off",
|
|
1099
|
+
"regexp/no-legacy-features": "off",
|
|
1100
|
+
"regexp/no-missing-g-flag": "off",
|
|
1101
|
+
"regexp/no-useless-dollar-replacements": "off",
|
|
1102
|
+
"regexp/no-useless-flag": "off",
|
|
1103
|
+
"style/indent": "off"
|
|
1114
1104
|
}
|
|
1115
1105
|
},
|
|
1116
1106
|
{
|
|
@@ -1118,30 +1108,30 @@ async function markdown(options = {}) {
|
|
|
1118
1108
|
languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
|
|
1119
1109
|
name: "vinicunca/markdown/disables",
|
|
1120
1110
|
rules: {
|
|
1121
|
-
"
|
|
1122
|
-
"no-
|
|
1123
|
-
"no-
|
|
1124
|
-
"no-
|
|
1125
|
-
"no-unused-
|
|
1126
|
-
"
|
|
1127
|
-
"
|
|
1128
|
-
"style/
|
|
1129
|
-
"style/
|
|
1130
|
-
"
|
|
1131
|
-
"ts/
|
|
1132
|
-
"ts/no-
|
|
1133
|
-
"ts/no-
|
|
1134
|
-
"ts/no-
|
|
1135
|
-
"ts/no-
|
|
1136
|
-
"
|
|
1137
|
-
"
|
|
1138
|
-
"unused-imports/no-unused-
|
|
1111
|
+
"e18e/prefer-static-regex": "off",
|
|
1112
|
+
"no-alert": "off",
|
|
1113
|
+
"no-console": "off",
|
|
1114
|
+
"no-undef": "off",
|
|
1115
|
+
"no-unused-expressions": "off",
|
|
1116
|
+
"no-unused-vars": "off",
|
|
1117
|
+
"node/prefer-global/process": "off",
|
|
1118
|
+
"style/comma-dangle": "off",
|
|
1119
|
+
"style/eol-last": "off",
|
|
1120
|
+
"style/padding-line-between-statements": "off",
|
|
1121
|
+
"ts/consistent-type-imports": "off",
|
|
1122
|
+
"ts/no-namespace": "off",
|
|
1123
|
+
"ts/no-redeclare": "off",
|
|
1124
|
+
"ts/no-require-imports": "off",
|
|
1125
|
+
"ts/no-unused-vars": "off",
|
|
1126
|
+
"ts/no-use-before-define": "off",
|
|
1127
|
+
"unicode-bom": "off",
|
|
1128
|
+
"unused-imports/no-unused-imports": "off",
|
|
1129
|
+
"unused-imports/no-unused-vars": "off",
|
|
1139
1130
|
...overrides
|
|
1140
1131
|
}
|
|
1141
1132
|
}
|
|
1142
1133
|
];
|
|
1143
1134
|
}
|
|
1144
|
-
|
|
1145
1135
|
//#endregion
|
|
1146
1136
|
//#region src/configs/nextjs.ts
|
|
1147
1137
|
function normalizeRules(rules) {
|
|
@@ -1174,7 +1164,6 @@ async function nextjs(options = {}) {
|
|
|
1174
1164
|
settings: { react: { version: "detect" } }
|
|
1175
1165
|
}];
|
|
1176
1166
|
}
|
|
1177
|
-
|
|
1178
1167
|
//#endregion
|
|
1179
1168
|
//#region src/configs/node.ts
|
|
1180
1169
|
async function node() {
|
|
@@ -1183,7 +1172,7 @@ async function node() {
|
|
|
1183
1172
|
plugins: { node: pluginNode },
|
|
1184
1173
|
rules: {
|
|
1185
1174
|
"node/handle-callback-err": [ERROR, "^(err|error)$"],
|
|
1186
|
-
"node/no-callback-literal":
|
|
1175
|
+
"node/no-callback-literal": "off",
|
|
1187
1176
|
"node/no-deprecated-api": ERROR,
|
|
1188
1177
|
"node/no-exports-assign": ERROR,
|
|
1189
1178
|
"node/no-new-require": ERROR,
|
|
@@ -1194,7 +1183,6 @@ async function node() {
|
|
|
1194
1183
|
}
|
|
1195
1184
|
}];
|
|
1196
1185
|
}
|
|
1197
|
-
|
|
1198
1186
|
//#endregion
|
|
1199
1187
|
//#region src/configs/perfectionist.ts
|
|
1200
1188
|
/**
|
|
@@ -1247,14 +1235,13 @@ async function perfectionist() {
|
|
|
1247
1235
|
}
|
|
1248
1236
|
}];
|
|
1249
1237
|
}
|
|
1250
|
-
|
|
1251
1238
|
//#endregion
|
|
1252
1239
|
//#region src/configs/pnpm.ts
|
|
1253
1240
|
async function detectCatalogUsage() {
|
|
1254
1241
|
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
1255
1242
|
if (!workspaceFile) return false;
|
|
1256
|
-
const yaml
|
|
1257
|
-
return yaml
|
|
1243
|
+
const yaml = await fs.readFile(workspaceFile, "utf-8");
|
|
1244
|
+
return yaml.includes("catalog:") || yaml.includes("catalogs:");
|
|
1258
1245
|
}
|
|
1259
1246
|
async function pnpm(options) {
|
|
1260
1247
|
const [pluginPnpm, pluginYaml, yamlParser] = await Promise.all([
|
|
@@ -1262,9 +1249,9 @@ async function pnpm(options) {
|
|
|
1262
1249
|
interopDefault(import("eslint-plugin-yml")),
|
|
1263
1250
|
interopDefault(import("yaml-eslint-parser"))
|
|
1264
1251
|
]);
|
|
1265
|
-
const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml
|
|
1266
|
-
const configs
|
|
1267
|
-
if (json) configs
|
|
1252
|
+
const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml = true } = options;
|
|
1253
|
+
const configs = [];
|
|
1254
|
+
if (json) configs.push({
|
|
1268
1255
|
files: ["package.json", "**/package.json"],
|
|
1269
1256
|
language: "jsonc/x",
|
|
1270
1257
|
name: "vinicunca/pnpm/package-json",
|
|
@@ -1278,8 +1265,8 @@ async function pnpm(options) {
|
|
|
1278
1265
|
"pnpm/json-valid-catalog": [ERROR, { autofix: !isInEditor }]
|
|
1279
1266
|
}
|
|
1280
1267
|
});
|
|
1281
|
-
if (yaml
|
|
1282
|
-
configs
|
|
1268
|
+
if (yaml) {
|
|
1269
|
+
configs.push({
|
|
1283
1270
|
files: ["pnpm-workspace.yaml"],
|
|
1284
1271
|
languageOptions: { parser: yamlParser },
|
|
1285
1272
|
name: "vinicunca/pnpm/pnpm-workspace-yaml",
|
|
@@ -1293,7 +1280,7 @@ async function pnpm(options) {
|
|
|
1293
1280
|
"pnpm/yaml-no-unused-catalog-item": ERROR
|
|
1294
1281
|
}
|
|
1295
1282
|
});
|
|
1296
|
-
if (sort) configs
|
|
1283
|
+
if (sort) configs.push({
|
|
1297
1284
|
files: ["pnpm-workspace.yaml"],
|
|
1298
1285
|
languageOptions: { parser: yamlParser },
|
|
1299
1286
|
name: "vinicunca/pnpm/pnpm-workspace-yaml-sort",
|
|
@@ -1372,9 +1359,8 @@ async function pnpm(options) {
|
|
|
1372
1359
|
] }
|
|
1373
1360
|
});
|
|
1374
1361
|
}
|
|
1375
|
-
return configs
|
|
1362
|
+
return configs;
|
|
1376
1363
|
}
|
|
1377
|
-
|
|
1378
1364
|
//#endregion
|
|
1379
1365
|
//#region src/configs/react.ts
|
|
1380
1366
|
const ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
@@ -1391,21 +1377,12 @@ const ReactRouterPackages = [
|
|
|
1391
1377
|
"@react-router/dev"
|
|
1392
1378
|
];
|
|
1393
1379
|
const NextJsPackages = ["next"];
|
|
1394
|
-
const ReactCompilerPackages = ["babel-plugin-react-compiler"];
|
|
1395
1380
|
async function react(options = {}) {
|
|
1396
|
-
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {},
|
|
1397
|
-
await ensurePackages([
|
|
1398
|
-
"@eslint-react/eslint-plugin",
|
|
1399
|
-
"eslint-plugin-react-hooks",
|
|
1400
|
-
"eslint-plugin-react-refresh"
|
|
1401
|
-
]);
|
|
1381
|
+
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, tsconfigPath } = options;
|
|
1382
|
+
await ensurePackages(["@eslint-react/eslint-plugin", "eslint-plugin-react-refresh"]);
|
|
1402
1383
|
const isTypeAware = !!tsconfigPath;
|
|
1403
|
-
const typeAwareRules = { "react/no-leaked-conditional-rendering":
|
|
1404
|
-
const [pluginReact,
|
|
1405
|
-
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1406
|
-
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1407
|
-
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1408
|
-
]);
|
|
1384
|
+
const typeAwareRules = { "react/no-leaked-conditional-rendering": ERROR };
|
|
1385
|
+
const [pluginReact, pluginReactRefresh] = await Promise.all([interopDefault(import("@eslint-react/eslint-plugin")), interopDefault(import("eslint-plugin-react-refresh"))]);
|
|
1409
1386
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists(i));
|
|
1410
1387
|
const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
|
|
1411
1388
|
const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
|
|
@@ -1417,8 +1394,6 @@ async function react(options = {}) {
|
|
|
1417
1394
|
plugins: {
|
|
1418
1395
|
"react": plugins["@eslint-react"],
|
|
1419
1396
|
"react-dom": plugins["@eslint-react/dom"],
|
|
1420
|
-
"react-hooks": pluginReactHooks,
|
|
1421
|
-
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
1422
1397
|
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1423
1398
|
"react-refresh": pluginReactRefresh,
|
|
1424
1399
|
"react-rsc": plugins["@eslint-react/rsc"],
|
|
@@ -1433,89 +1408,9 @@ async function react(options = {}) {
|
|
|
1433
1408
|
},
|
|
1434
1409
|
name: "vinicunca/react/rules",
|
|
1435
1410
|
rules: {
|
|
1436
|
-
|
|
1437
|
-
"react-dom/no-dangerously-set-innerhtml-with-children": ERROR,
|
|
1438
|
-
"react-dom/no-find-dom-node": ERROR,
|
|
1439
|
-
"react-dom/no-flush-sync": ERROR,
|
|
1440
|
-
"react-dom/no-hydrate": ERROR,
|
|
1441
|
-
"react-dom/no-missing-button-type": WARN,
|
|
1442
|
-
"react-dom/no-missing-iframe-sandbox": WARN,
|
|
1443
|
-
"react-dom/no-namespace": ERROR,
|
|
1444
|
-
"react-dom/no-render": ERROR,
|
|
1445
|
-
"react-dom/no-render-return-value": ERROR,
|
|
1446
|
-
"react-dom/no-script-url": WARN,
|
|
1447
|
-
"react-dom/no-unsafe-iframe-sandbox": WARN,
|
|
1448
|
-
"react-dom/no-unsafe-target-blank": WARN,
|
|
1449
|
-
"react-dom/no-use-form-state": ERROR,
|
|
1450
|
-
"react-dom/no-void-elements-with-children": ERROR,
|
|
1451
|
-
"react-hooks-extra/no-direct-set-state-in-use-effect": WARN,
|
|
1452
|
-
"react-hooks/exhaustive-deps": WARN,
|
|
1453
|
-
"react-hooks/rules-of-hooks": ERROR,
|
|
1454
|
-
"react-naming-convention/context-name": WARN,
|
|
1455
|
-
"react-naming-convention/ref-name": WARN,
|
|
1456
|
-
"react-naming-convention/use-state": WARN,
|
|
1457
|
-
"react-rsc/function-definition": ERROR,
|
|
1458
|
-
"react-web-api/no-leaked-event-listener": WARN,
|
|
1459
|
-
"react-web-api/no-leaked-interval": WARN,
|
|
1460
|
-
"react-web-api/no-leaked-resize-observer": WARN,
|
|
1461
|
-
"react-web-api/no-leaked-timeout": WARN,
|
|
1462
|
-
"react/jsx-no-comment-textnodes": WARN,
|
|
1463
|
-
"react/jsx-no-duplicate-props": WARN,
|
|
1464
|
-
"react/jsx-uses-vars": WARN,
|
|
1465
|
-
"react/no-access-state-in-setstate": ERROR,
|
|
1466
|
-
"react/no-array-index-key": WARN,
|
|
1467
|
-
"react/no-children-count": WARN,
|
|
1468
|
-
"react/no-children-for-each": WARN,
|
|
1469
|
-
"react/no-children-map": WARN,
|
|
1470
|
-
"react/no-children-only": WARN,
|
|
1471
|
-
"react/no-children-to-array": WARN,
|
|
1472
|
-
"react/no-clone-element": WARN,
|
|
1473
|
-
"react/no-component-will-mount": ERROR,
|
|
1474
|
-
"react/no-component-will-receive-props": ERROR,
|
|
1475
|
-
"react/no-component-will-update": ERROR,
|
|
1476
|
-
"react/no-context-provider": WARN,
|
|
1477
|
-
"react/no-create-ref": ERROR,
|
|
1478
|
-
"react/no-default-props": ERROR,
|
|
1479
|
-
"react/no-direct-mutation-state": ERROR,
|
|
1480
|
-
"react/no-forward-ref": WARN,
|
|
1481
|
-
"react/no-missing-key": ERROR,
|
|
1482
|
-
"react/no-nested-component-definitions": ERROR,
|
|
1483
|
-
"react/no-prop-types": ERROR,
|
|
1484
|
-
"react/no-redundant-should-component-update": ERROR,
|
|
1485
|
-
"react/no-set-state-in-component-did-mount": WARN,
|
|
1486
|
-
"react/no-set-state-in-component-did-update": WARN,
|
|
1487
|
-
"react/no-set-state-in-component-will-update": WARN,
|
|
1488
|
-
"react/no-string-refs": ERROR,
|
|
1489
|
-
"react/no-unnecessary-use-prefix": WARN,
|
|
1490
|
-
"react/no-unsafe-component-will-mount": WARN,
|
|
1491
|
-
"react/no-unsafe-component-will-receive-props": WARN,
|
|
1492
|
-
"react/no-unsafe-component-will-update": WARN,
|
|
1493
|
-
"react/no-unstable-context-value": WARN,
|
|
1494
|
-
"react/no-unstable-default-props": WARN,
|
|
1495
|
-
"react/no-unused-class-component-members": WARN,
|
|
1496
|
-
"react/no-unused-state": WARN,
|
|
1497
|
-
"react/no-use-context": WARN,
|
|
1498
|
-
"react/no-useless-forward-ref": WARN,
|
|
1411
|
+
...pluginReact.configs.recommended.rules,
|
|
1499
1412
|
"react/prefer-namespace-import": ERROR,
|
|
1500
|
-
"react/
|
|
1501
|
-
...reactCompiler ? {
|
|
1502
|
-
"react-hooks/component-hook-factories": ERROR,
|
|
1503
|
-
"react-hooks/config": ERROR,
|
|
1504
|
-
"react-hooks/error-boundaries": ERROR,
|
|
1505
|
-
"react-hooks/gating": ERROR,
|
|
1506
|
-
"react-hooks/globals": ERROR,
|
|
1507
|
-
"react-hooks/immutability": ERROR,
|
|
1508
|
-
"react-hooks/incompatible-library": WARN,
|
|
1509
|
-
"react-hooks/preserve-manual-memoization": ERROR,
|
|
1510
|
-
"react-hooks/purity": ERROR,
|
|
1511
|
-
"react-hooks/refs": ERROR,
|
|
1512
|
-
"react-hooks/set-state-in-effect": ERROR,
|
|
1513
|
-
"react-hooks/set-state-in-render": ERROR,
|
|
1514
|
-
"react-hooks/static-components": ERROR,
|
|
1515
|
-
"react-hooks/unsupported-syntax": WARN,
|
|
1516
|
-
"react-hooks/use-memo": ERROR
|
|
1517
|
-
} : {},
|
|
1518
|
-
"react-refresh/only-export-components": [WARN, {
|
|
1413
|
+
"react-refresh/only-export-components": [ERROR, {
|
|
1519
1414
|
allowConstantExport: isAllowConstantExport,
|
|
1520
1415
|
allowExportNames: [...isUsingNext ? [
|
|
1521
1416
|
"dynamic",
|
|
@@ -1525,12 +1420,13 @@ async function react(options = {}) {
|
|
|
1525
1420
|
"runtime",
|
|
1526
1421
|
"preferredRegion",
|
|
1527
1422
|
"maxDuration",
|
|
1528
|
-
"config",
|
|
1529
1423
|
"generateStaticParams",
|
|
1530
1424
|
"metadata",
|
|
1531
1425
|
"generateMetadata",
|
|
1532
1426
|
"viewport",
|
|
1533
|
-
"generateViewport"
|
|
1427
|
+
"generateViewport",
|
|
1428
|
+
"generateImageMetadata",
|
|
1429
|
+
"generateSitemaps"
|
|
1534
1430
|
] : [], ...isUsingRemix || isUsingReactRouter ? [
|
|
1535
1431
|
"meta",
|
|
1536
1432
|
"links",
|
|
@@ -1550,12 +1446,8 @@ async function react(options = {}) {
|
|
|
1550
1446
|
files: filesTypeAware,
|
|
1551
1447
|
name: "vinicunca/react/typescript",
|
|
1552
1448
|
rules: {
|
|
1553
|
-
"react-dom/no-string-style-prop":
|
|
1554
|
-
"react-dom/no-unknown-property":
|
|
1555
|
-
"react/jsx-no-duplicate-props": OFF,
|
|
1556
|
-
"react/jsx-no-undef": OFF,
|
|
1557
|
-
"react/jsx-uses-react": OFF,
|
|
1558
|
-
"react/jsx-uses-vars": OFF
|
|
1449
|
+
"react-dom/no-string-style-prop": "off",
|
|
1450
|
+
"react-dom/no-unknown-property": "off"
|
|
1559
1451
|
}
|
|
1560
1452
|
},
|
|
1561
1453
|
...isTypeAware ? [{
|
|
@@ -1566,14 +1458,13 @@ async function react(options = {}) {
|
|
|
1566
1458
|
}] : []
|
|
1567
1459
|
];
|
|
1568
1460
|
}
|
|
1569
|
-
|
|
1570
1461
|
//#endregion
|
|
1571
1462
|
//#region src/configs/regexp.ts
|
|
1572
1463
|
async function regexp(options = {}) {
|
|
1573
1464
|
const config = configs["flat/recommended"];
|
|
1574
1465
|
const rules = { ...config.rules };
|
|
1575
|
-
if (options.level ===
|
|
1576
|
-
for (const key in rules) if (rules[key] ===
|
|
1466
|
+
if (options.level === "warn") {
|
|
1467
|
+
for (const key in rules) if (rules[key] === "error") rules[key] = WARN;
|
|
1577
1468
|
}
|
|
1578
1469
|
return [{
|
|
1579
1470
|
...config,
|
|
@@ -1584,11 +1475,10 @@ async function regexp(options = {}) {
|
|
|
1584
1475
|
}
|
|
1585
1476
|
}];
|
|
1586
1477
|
}
|
|
1587
|
-
|
|
1588
1478
|
//#endregion
|
|
1589
1479
|
//#region src/configs/solid.ts
|
|
1590
1480
|
async function solid(options = {}) {
|
|
1591
|
-
const { files = [GLOB_JSX, GLOB_TSX], overrides = {}, typescript
|
|
1481
|
+
const { files = [GLOB_JSX, GLOB_TSX], overrides = {}, typescript = true } = options;
|
|
1592
1482
|
await ensurePackages(["eslint-plugin-solid"]);
|
|
1593
1483
|
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1594
1484
|
const isTypeAware = !!tsconfigPath;
|
|
@@ -1627,32 +1517,32 @@ async function solid(options = {}) {
|
|
|
1627
1517
|
"solid/reactivity": WARN,
|
|
1628
1518
|
"solid/self-closing-comp": ERROR,
|
|
1629
1519
|
"solid/style-prop": [ERROR, { styleProps: ["style", "css"] }],
|
|
1630
|
-
...typescript
|
|
1520
|
+
...typescript ? {
|
|
1631
1521
|
"solid/jsx-no-undef": [ERROR, { typescriptEnabled: true }],
|
|
1632
|
-
"solid/no-unknown-namespaces":
|
|
1522
|
+
"solid/no-unknown-namespaces": "off"
|
|
1633
1523
|
} : {},
|
|
1634
1524
|
...overrides
|
|
1635
1525
|
}
|
|
1636
1526
|
}];
|
|
1637
1527
|
}
|
|
1638
|
-
|
|
1639
1528
|
//#endregion
|
|
1640
1529
|
//#region src/configs/sonar.ts
|
|
1641
1530
|
async function sonar() {
|
|
1642
1531
|
return [{
|
|
1532
|
+
files: [GLOB_SRC],
|
|
1643
1533
|
name: "vinicunca/sonar/rules",
|
|
1644
1534
|
plugins: { sonar: pluginSonar },
|
|
1645
1535
|
rules: {
|
|
1646
|
-
...pluginSonar.configs
|
|
1647
|
-
"sonar/cognitive-complexity":
|
|
1648
|
-
"sonar/no-unused-
|
|
1649
|
-
"sonar/
|
|
1650
|
-
"sonar/
|
|
1651
|
-
"sonar/
|
|
1536
|
+
...(pluginSonar.configs?.recommended).rules,
|
|
1537
|
+
"sonar/cognitive-complexity": "off",
|
|
1538
|
+
"sonar/no-unused-import": "off",
|
|
1539
|
+
"sonar/no-unused-vars": "off",
|
|
1540
|
+
"sonar/pseudo-random": "off",
|
|
1541
|
+
"sonar/slow-regex": "off",
|
|
1542
|
+
"sonar/todo-tag": "off"
|
|
1652
1543
|
}
|
|
1653
1544
|
}];
|
|
1654
1545
|
}
|
|
1655
|
-
|
|
1656
1546
|
//#endregion
|
|
1657
1547
|
//#region src/configs/sort-package-json.ts
|
|
1658
1548
|
/**
|
|
@@ -1886,12 +1776,11 @@ function sortTsconfig() {
|
|
|
1886
1776
|
] }
|
|
1887
1777
|
}];
|
|
1888
1778
|
}
|
|
1889
|
-
|
|
1890
1779
|
//#endregion
|
|
1891
1780
|
//#region src/configs/svelte.ts
|
|
1892
1781
|
async function svelte(options = {}) {
|
|
1893
|
-
const { files = [GLOB_SVELTE], overrides = {}, stylistic
|
|
1894
|
-
const { indent = 2, quotes = "single" } = e$2(stylistic
|
|
1782
|
+
const { files = [GLOB_SVELTE], overrides = {}, stylistic = true } = options;
|
|
1783
|
+
const { indent = 2, quotes = "single" } = e$2(stylistic) ? {} : stylistic;
|
|
1895
1784
|
await ensurePackages(["eslint-plugin-svelte"]);
|
|
1896
1785
|
const [pluginSvelte, parserSvelte] = await Promise.all([interopDefault(import("eslint-plugin-svelte")), interopDefault(import("svelte-eslint-parser"))]);
|
|
1897
1786
|
return [{
|
|
@@ -1909,7 +1798,7 @@ async function svelte(options = {}) {
|
|
|
1909
1798
|
name: "vinicunca/svelte/rules",
|
|
1910
1799
|
processor: pluginSvelte.processors[".svelte"],
|
|
1911
1800
|
rules: {
|
|
1912
|
-
"no-undef":
|
|
1801
|
+
"no-undef": "off",
|
|
1913
1802
|
"no-unused-vars": [ERROR, {
|
|
1914
1803
|
args: "none",
|
|
1915
1804
|
caughtErrors: "none",
|
|
@@ -1943,9 +1832,9 @@ async function svelte(options = {}) {
|
|
|
1943
1832
|
vars: "all",
|
|
1944
1833
|
varsIgnorePattern: "^(_|\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
|
|
1945
1834
|
}],
|
|
1946
|
-
...stylistic
|
|
1947
|
-
"style/indent":
|
|
1948
|
-
"style/no-trailing-spaces":
|
|
1835
|
+
...stylistic ? {
|
|
1836
|
+
"style/indent": "off",
|
|
1837
|
+
"style/no-trailing-spaces": "off",
|
|
1949
1838
|
"svelte/derived-has-same-inputs-outputs": ERROR,
|
|
1950
1839
|
"svelte/html-closing-bracket-spacing": ERROR,
|
|
1951
1840
|
"svelte/html-quotes": [ERROR, { prefer: quotes }],
|
|
@@ -1962,7 +1851,6 @@ async function svelte(options = {}) {
|
|
|
1962
1851
|
}
|
|
1963
1852
|
}];
|
|
1964
1853
|
}
|
|
1965
|
-
|
|
1966
1854
|
//#endregion
|
|
1967
1855
|
//#region src/configs/test.ts
|
|
1968
1856
|
let _pluginTest;
|
|
@@ -1983,7 +1871,8 @@ async function test(options = {}) {
|
|
|
1983
1871
|
files,
|
|
1984
1872
|
name: "vinicunca/test/rules",
|
|
1985
1873
|
rules: {
|
|
1986
|
-
"
|
|
1874
|
+
"e18e/prefer-static-regex": "off",
|
|
1875
|
+
"sonar/no-duplicate-string": "off",
|
|
1987
1876
|
"test/consistent-test-it": [ERROR, {
|
|
1988
1877
|
fn: "it",
|
|
1989
1878
|
withinDescribe: "it"
|
|
@@ -1993,20 +1882,19 @@ async function test(options = {}) {
|
|
|
1993
1882
|
"test/no-only-tests": isInEditor ? WARN : ERROR,
|
|
1994
1883
|
"test/prefer-hooks-in-order": ERROR,
|
|
1995
1884
|
"test/prefer-lowercase-title": ERROR,
|
|
1996
|
-
"antfu/no-top-level-await":
|
|
1997
|
-
"no-unused-expressions":
|
|
1998
|
-
"node/prefer-global/process":
|
|
1999
|
-
"ts/explicit-function-return-type":
|
|
1885
|
+
"antfu/no-top-level-await": "off",
|
|
1886
|
+
"no-unused-expressions": "off",
|
|
1887
|
+
"node/prefer-global/process": "off",
|
|
1888
|
+
"ts/explicit-function-return-type": "off",
|
|
2000
1889
|
...overrides
|
|
2001
1890
|
}
|
|
2002
1891
|
}];
|
|
2003
1892
|
}
|
|
2004
|
-
|
|
2005
1893
|
//#endregion
|
|
2006
1894
|
//#region src/configs/toml.ts
|
|
2007
1895
|
async function toml(options = {}) {
|
|
2008
|
-
const { files = [GLOB_TOML], overrides = {}, stylistic
|
|
2009
|
-
const { indent = 2 } = e$2(stylistic
|
|
1896
|
+
const { files = [GLOB_TOML], overrides = {}, stylistic = true } = options;
|
|
1897
|
+
const { indent = 2 } = e$2(stylistic) ? {} : stylistic;
|
|
2010
1898
|
const [pluginToml, parserToml] = await Promise.all([interopDefault(import("eslint-plugin-toml")), interopDefault(import("toml-eslint-parser"))]);
|
|
2011
1899
|
return [{
|
|
2012
1900
|
name: "vinicunca/toml/setup",
|
|
@@ -2016,7 +1904,7 @@ async function toml(options = {}) {
|
|
|
2016
1904
|
languageOptions: { parser: parserToml },
|
|
2017
1905
|
name: "vinicunca/toml/rules",
|
|
2018
1906
|
rules: {
|
|
2019
|
-
"style/spaced-comment":
|
|
1907
|
+
"style/spaced-comment": "off",
|
|
2020
1908
|
"toml/comma-style": ERROR,
|
|
2021
1909
|
"toml/keys-order": ERROR,
|
|
2022
1910
|
"toml/no-space-dots": ERROR,
|
|
@@ -2025,7 +1913,7 @@ async function toml(options = {}) {
|
|
|
2025
1913
|
"toml/precision-of-integer": ERROR,
|
|
2026
1914
|
"toml/tables-order": ERROR,
|
|
2027
1915
|
"toml/vue-custom-block/no-parsing-error": ERROR,
|
|
2028
|
-
...stylistic
|
|
1916
|
+
...stylistic ? {
|
|
2029
1917
|
"toml/array-bracket-newline": ERROR,
|
|
2030
1918
|
"toml/array-bracket-spacing": ERROR,
|
|
2031
1919
|
"toml/array-element-newline": ERROR,
|
|
@@ -2042,23 +1930,22 @@ async function toml(options = {}) {
|
|
|
2042
1930
|
}
|
|
2043
1931
|
}];
|
|
2044
1932
|
}
|
|
2045
|
-
|
|
2046
1933
|
//#endregion
|
|
2047
1934
|
//#region src/configs/typescript.ts
|
|
2048
1935
|
async function typescript(options = {}) {
|
|
2049
1936
|
const { componentExts = [], erasableOnly = false, overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options ?? {};
|
|
2050
1937
|
const files = options.files ?? [
|
|
2051
|
-
|
|
2052
|
-
|
|
1938
|
+
"**/*.?([cm])ts",
|
|
1939
|
+
"**/*.?([cm])tsx",
|
|
2053
1940
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
2054
1941
|
];
|
|
2055
|
-
const filesTypeAware = options.filesTypeAware ?? [
|
|
2056
|
-
const ignoresTypeAware = options.ignoresTypeAware ?? [
|
|
1942
|
+
const filesTypeAware = options.filesTypeAware ?? ["**/*.?([cm])ts", "**/*.?([cm])tsx"];
|
|
1943
|
+
const ignoresTypeAware = options.ignoresTypeAware ?? [`**/*.md/**`, "**/*.astro/*.ts"];
|
|
2057
1944
|
const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
|
|
2058
1945
|
const isTypeAware = !!tsconfigPath;
|
|
2059
1946
|
const typeAwareRules = {
|
|
2060
|
-
"dot-notation":
|
|
2061
|
-
"no-implied-eval":
|
|
1947
|
+
"dot-notation": "off",
|
|
1948
|
+
"no-implied-eval": "off",
|
|
2062
1949
|
"ts/await-thenable": ERROR,
|
|
2063
1950
|
"ts/dot-notation": [ERROR, { allowKeywords: true }],
|
|
2064
1951
|
"ts/no-floating-promises": ERROR,
|
|
@@ -2083,10 +1970,10 @@ async function typescript(options = {}) {
|
|
|
2083
1970
|
"ts/unbound-method": ERROR
|
|
2084
1971
|
};
|
|
2085
1972
|
const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
|
|
2086
|
-
function makeParser({ files
|
|
1973
|
+
function makeParser({ files, ignores, typeAware }) {
|
|
2087
1974
|
return {
|
|
2088
|
-
files
|
|
2089
|
-
...ignores
|
|
1975
|
+
files,
|
|
1976
|
+
...ignores ? { ignores } : {},
|
|
2090
1977
|
languageOptions: {
|
|
2091
1978
|
parser: parserTs,
|
|
2092
1979
|
parserOptions: {
|
|
@@ -2130,10 +2017,10 @@ async function typescript(options = {}) {
|
|
|
2130
2017
|
rules: {
|
|
2131
2018
|
...renameRules(pluginTs.configs["eslint-recommended"].overrides[0].rules, { "@typescript-eslint": "ts" }),
|
|
2132
2019
|
...renameRules(pluginTs.configs.strict.rules, { "@typescript-eslint": "ts" }),
|
|
2133
|
-
"no-dupe-class-members":
|
|
2134
|
-
"no-redeclare":
|
|
2135
|
-
"no-use-before-define":
|
|
2136
|
-
"no-useless-constructor":
|
|
2020
|
+
"no-dupe-class-members": "off",
|
|
2021
|
+
"no-redeclare": "off",
|
|
2022
|
+
"no-use-before-define": "off",
|
|
2023
|
+
"no-useless-constructor": "off",
|
|
2137
2024
|
"ts/array-type": [ERROR, { default: "generic" }],
|
|
2138
2025
|
"ts/ban-ts-comment": [ERROR, { "ts-expect-error": "allow-with-description" }],
|
|
2139
2026
|
"ts/consistent-type-definitions": [ERROR, "interface"],
|
|
@@ -2142,19 +2029,19 @@ async function typescript(options = {}) {
|
|
|
2142
2029
|
fixStyle: "separate-type-imports",
|
|
2143
2030
|
prefer: "type-imports"
|
|
2144
2031
|
}],
|
|
2145
|
-
"ts/explicit-member-accessibility":
|
|
2146
|
-
"ts/explicit-module-boundary-types":
|
|
2032
|
+
"ts/explicit-member-accessibility": "off",
|
|
2033
|
+
"ts/explicit-module-boundary-types": "off",
|
|
2147
2034
|
"ts/method-signature-style": [ERROR, "property"],
|
|
2148
|
-
"ts/naming-convention":
|
|
2035
|
+
"ts/naming-convention": "off",
|
|
2149
2036
|
"ts/no-dupe-class-members": ERROR,
|
|
2150
|
-
"ts/no-empty-function":
|
|
2037
|
+
"ts/no-empty-function": "off",
|
|
2151
2038
|
"ts/no-empty-object-type": [ERROR, { allowInterfaces: "always" }],
|
|
2152
|
-
"ts/no-explicit-any":
|
|
2153
|
-
"ts/no-extraneous-class":
|
|
2039
|
+
"ts/no-explicit-any": "off",
|
|
2040
|
+
"ts/no-extraneous-class": "off",
|
|
2154
2041
|
"ts/no-import-type-side-effects": ERROR,
|
|
2155
2042
|
"ts/no-invalid-this": ERROR,
|
|
2156
|
-
"ts/no-invalid-void-type":
|
|
2157
|
-
"ts/no-non-null-assertion":
|
|
2043
|
+
"ts/no-invalid-void-type": "off",
|
|
2044
|
+
"ts/no-non-null-assertion": "off",
|
|
2158
2045
|
"ts/no-redeclare": [ERROR, { builtinGlobals: false }],
|
|
2159
2046
|
"ts/no-require-imports": ERROR,
|
|
2160
2047
|
"ts/no-unused-expressions": [ERROR, {
|
|
@@ -2173,8 +2060,8 @@ async function typescript(options = {}) {
|
|
|
2173
2060
|
functions: false,
|
|
2174
2061
|
variables: true
|
|
2175
2062
|
}],
|
|
2176
|
-
"ts/parameter-properties":
|
|
2177
|
-
"ts/triple-slash-reference":
|
|
2063
|
+
"ts/parameter-properties": "off",
|
|
2064
|
+
"ts/triple-slash-reference": "off",
|
|
2178
2065
|
...type === "lib" ? { "ts/explicit-function-return-type": [ERROR, {
|
|
2179
2066
|
allowExpressions: true,
|
|
2180
2067
|
allowHigherOrderFunctions: true,
|
|
@@ -2194,7 +2081,7 @@ async function typescript(options = {}) {
|
|
|
2194
2081
|
}] : [],
|
|
2195
2082
|
...erasableOnly ? [{
|
|
2196
2083
|
name: "antfu/typescript/erasable-syntax-only",
|
|
2197
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-
|
|
2084
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-D13rzY6d.mjs")) },
|
|
2198
2085
|
rules: {
|
|
2199
2086
|
"erasable-syntax-only/enums": ERROR,
|
|
2200
2087
|
"erasable-syntax-only/import-aliases": ERROR,
|
|
@@ -2204,7 +2091,6 @@ async function typescript(options = {}) {
|
|
|
2204
2091
|
}] : []
|
|
2205
2092
|
];
|
|
2206
2093
|
}
|
|
2207
|
-
|
|
2208
2094
|
//#endregion
|
|
2209
2095
|
//#region src/configs/unicorn.ts
|
|
2210
2096
|
async function unicorn(options = {}) {
|
|
@@ -2229,7 +2115,6 @@ async function unicorn(options = {}) {
|
|
|
2229
2115
|
} }
|
|
2230
2116
|
}];
|
|
2231
2117
|
}
|
|
2232
|
-
|
|
2233
2118
|
//#endregion
|
|
2234
2119
|
//#region src/configs/unocss.ts
|
|
2235
2120
|
async function unocss(options = {}) {
|
|
@@ -2247,13 +2132,12 @@ async function unocss(options = {}) {
|
|
|
2247
2132
|
settings: { unocss: { configPath } }
|
|
2248
2133
|
}];
|
|
2249
2134
|
}
|
|
2250
|
-
|
|
2251
2135
|
//#endregion
|
|
2252
2136
|
//#region src/configs/vue.ts
|
|
2253
2137
|
async function vue(options = {}) {
|
|
2254
|
-
const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic
|
|
2138
|
+
const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic = true } = options;
|
|
2255
2139
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
2256
|
-
const { indent = 2 } = e$2(stylistic
|
|
2140
|
+
const { indent = 2 } = e$2(stylistic) ? {} : stylistic;
|
|
2257
2141
|
if (a11y) await ensurePackages(["eslint-plugin-vuejs-accessibility"]);
|
|
2258
2142
|
const [pluginVue, parserVue, processorVueBlocks, pluginVueA11y] = await Promise.all([
|
|
2259
2143
|
interopDefault(import("eslint-plugin-vue")),
|
|
@@ -2316,9 +2200,9 @@ async function vue(options = {}) {
|
|
|
2316
2200
|
...acc,
|
|
2317
2201
|
...c
|
|
2318
2202
|
}), {}),
|
|
2319
|
-
"antfu/no-top-level-await":
|
|
2320
|
-
"node/prefer-global/process":
|
|
2321
|
-
"ts/explicit-function-return-type":
|
|
2203
|
+
"antfu/no-top-level-await": "off",
|
|
2204
|
+
"node/prefer-global/process": "off",
|
|
2205
|
+
"ts/explicit-function-return-type": "off",
|
|
2322
2206
|
"vue/block-order": [ERROR, { order: [
|
|
2323
2207
|
"script",
|
|
2324
2208
|
"template",
|
|
@@ -2326,7 +2210,7 @@ async function vue(options = {}) {
|
|
|
2326
2210
|
] }],
|
|
2327
2211
|
"vue/component-name-in-template-casing": [ERROR, "PascalCase"],
|
|
2328
2212
|
"vue/component-options-name-casing": [ERROR, "PascalCase"],
|
|
2329
|
-
"vue/component-tags-order":
|
|
2213
|
+
"vue/component-tags-order": "off",
|
|
2330
2214
|
"vue/custom-event-name-casing": [
|
|
2331
2215
|
ERROR,
|
|
2332
2216
|
"camelCase",
|
|
@@ -2344,9 +2228,9 @@ async function vue(options = {}) {
|
|
|
2344
2228
|
"vue/html-indent": [ERROR, indent],
|
|
2345
2229
|
"vue/html-quotes": [ERROR, "double"],
|
|
2346
2230
|
"vue/max-attributes-per-line": [ERROR],
|
|
2347
|
-
"vue/multi-word-component-names":
|
|
2231
|
+
"vue/multi-word-component-names": "off",
|
|
2348
2232
|
"vue/no-constant-condition": WARN,
|
|
2349
|
-
"vue/no-dupe-keys":
|
|
2233
|
+
"vue/no-dupe-keys": "off",
|
|
2350
2234
|
"vue/no-empty-pattern": ERROR,
|
|
2351
2235
|
"vue/no-irregular-whitespace": ERROR,
|
|
2352
2236
|
"vue/no-loss-of-precision": ERROR,
|
|
@@ -2357,12 +2241,12 @@ async function vue(options = {}) {
|
|
|
2357
2241
|
"WithStatement"
|
|
2358
2242
|
],
|
|
2359
2243
|
"vue/no-restricted-v-bind": [ERROR, "/^v-/"],
|
|
2360
|
-
"vue/no-setup-props-reactivity-loss":
|
|
2244
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
2361
2245
|
"vue/no-sparse-arrays": ERROR,
|
|
2362
2246
|
"vue/no-unused-refs": ERROR,
|
|
2363
2247
|
"vue/no-useless-v-bind": ERROR,
|
|
2364
|
-
"vue/no-v-html":
|
|
2365
|
-
"vue/no-v-text-v-html-on-component":
|
|
2248
|
+
"vue/no-v-html": "off",
|
|
2249
|
+
"vue/no-v-text-v-html-on-component": "off",
|
|
2366
2250
|
"vue/object-shorthand": [
|
|
2367
2251
|
ERROR,
|
|
2368
2252
|
ALWAYS,
|
|
@@ -2371,18 +2255,18 @@ async function vue(options = {}) {
|
|
|
2371
2255
|
ignoreConstructors: false
|
|
2372
2256
|
}
|
|
2373
2257
|
],
|
|
2374
|
-
"vue/prefer-import-from-vue":
|
|
2258
|
+
"vue/prefer-import-from-vue": "off",
|
|
2375
2259
|
"vue/prefer-separate-static-class": ERROR,
|
|
2376
2260
|
"vue/prefer-template": ERROR,
|
|
2377
2261
|
"vue/prop-name-casing": [ERROR, "camelCase"],
|
|
2378
|
-
"vue/require-default-prop":
|
|
2379
|
-
"vue/require-prop-types":
|
|
2262
|
+
"vue/require-default-prop": "off",
|
|
2263
|
+
"vue/require-prop-types": "off",
|
|
2380
2264
|
"vue/space-infix-ops": ERROR,
|
|
2381
2265
|
"vue/space-unary-ops": [ERROR, {
|
|
2382
2266
|
nonwords: false,
|
|
2383
2267
|
words: true
|
|
2384
2268
|
}],
|
|
2385
|
-
...stylistic
|
|
2269
|
+
...stylistic ? {
|
|
2386
2270
|
"vue/array-bracket-spacing": [ERROR, NEVER],
|
|
2387
2271
|
"vue/arrow-spacing": [ERROR, {
|
|
2388
2272
|
after: true,
|
|
@@ -2457,12 +2341,11 @@ async function vue(options = {}) {
|
|
|
2457
2341
|
}
|
|
2458
2342
|
}];
|
|
2459
2343
|
}
|
|
2460
|
-
|
|
2461
2344
|
//#endregion
|
|
2462
2345
|
//#region src/configs/yaml.ts
|
|
2463
2346
|
async function yaml(options = {}) {
|
|
2464
|
-
const { files = [GLOB_YAML], overrides = {}, stylistic
|
|
2465
|
-
const { indent = 2, quotes = "single" } = e$2(stylistic
|
|
2347
|
+
const { files = [GLOB_YAML], overrides = {}, stylistic = true } = options;
|
|
2348
|
+
const { indent = 2, quotes = "single" } = e$2(stylistic) ? {} : stylistic;
|
|
2466
2349
|
const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
|
|
2467
2350
|
return [{
|
|
2468
2351
|
name: "vinicunca/yaml/setup",
|
|
@@ -2472,7 +2355,7 @@ async function yaml(options = {}) {
|
|
|
2472
2355
|
languageOptions: { parser: parserYaml },
|
|
2473
2356
|
name: "vinicunca/yaml/rules",
|
|
2474
2357
|
rules: {
|
|
2475
|
-
"style/spaced-comment":
|
|
2358
|
+
"style/spaced-comment": "off",
|
|
2476
2359
|
"yaml/block-mapping": ERROR,
|
|
2477
2360
|
"yaml/block-sequence": ERROR,
|
|
2478
2361
|
"yaml/no-empty-key": ERROR,
|
|
@@ -2480,7 +2363,7 @@ async function yaml(options = {}) {
|
|
|
2480
2363
|
"yaml/no-irregular-whitespace": ERROR,
|
|
2481
2364
|
"yaml/plain-scalar": ERROR,
|
|
2482
2365
|
"yaml/vue-custom-block/no-parsing-error": ERROR,
|
|
2483
|
-
...stylistic
|
|
2366
|
+
...stylistic ? {
|
|
2484
2367
|
"yaml/block-mapping-question-indicator-newline": ERROR,
|
|
2485
2368
|
"yaml/block-sequence-hyphen-indicator-newline": ERROR,
|
|
2486
2369
|
"yaml/flow-mapping-curly-newline": ERROR,
|
|
@@ -2500,7 +2383,6 @@ async function yaml(options = {}) {
|
|
|
2500
2383
|
}
|
|
2501
2384
|
}];
|
|
2502
2385
|
}
|
|
2503
|
-
|
|
2504
2386
|
//#endregion
|
|
2505
2387
|
//#region src/base.ts
|
|
2506
2388
|
const flatConfigProps = [
|
|
@@ -2521,8 +2403,9 @@ const VuePackages = [
|
|
|
2521
2403
|
const defaultPluginRenaming = {
|
|
2522
2404
|
"@eslint-react": "react",
|
|
2523
2405
|
"@eslint-react/dom": "react-dom",
|
|
2524
|
-
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
2525
2406
|
"@eslint-react/naming-convention": "react-naming-convention",
|
|
2407
|
+
"@eslint-react/rsc": "react-rsc",
|
|
2408
|
+
"@eslint-react/web-api": "react-web-api",
|
|
2526
2409
|
"@next/next": "next",
|
|
2527
2410
|
"@stylistic": "style",
|
|
2528
2411
|
"@typescript-eslint": "ts",
|
|
@@ -2543,7 +2426,7 @@ const defaultPluginRenaming = {
|
|
|
2543
2426
|
* The merged ESLint configurations.
|
|
2544
2427
|
*/
|
|
2545
2428
|
function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
2546
|
-
const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = false, node: enableNode = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2429
|
+
const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = false, node: enableNode = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, type: appType = "app", typescript: enableTypeScript = isPackageExists("typescript") || isPackageExists("@typescript/native-preview"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2547
2430
|
let isInEditor = options.isInEditor;
|
|
2548
2431
|
if (isInEditor == null) {
|
|
2549
2432
|
isInEditor = isInEditorEnv();
|
|
@@ -2551,108 +2434,108 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2551
2434
|
}
|
|
2552
2435
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2553
2436
|
if (stylisticOptions && !("jsx" in stylisticOptions)) stylisticOptions.jsx = typeof enableJsx === "object" ? true : enableJsx;
|
|
2554
|
-
const configs
|
|
2555
|
-
if (enableGitignore) if (!e$2(enableGitignore)) configs
|
|
2437
|
+
const configs = [];
|
|
2438
|
+
if (enableGitignore) if (!e$2(enableGitignore)) configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2556
2439
|
name: "vinicunca/gitignore",
|
|
2557
2440
|
...enableGitignore
|
|
2558
2441
|
})]));
|
|
2559
|
-
else configs
|
|
2442
|
+
else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2560
2443
|
name: "vinicunca/gitignore",
|
|
2561
2444
|
strict: false
|
|
2562
2445
|
})]));
|
|
2563
2446
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2564
2447
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2565
|
-
configs
|
|
2448
|
+
configs.push(ignores(userIgnores, !enableTypeScript), javascript({
|
|
2566
2449
|
isInEditor,
|
|
2567
2450
|
overrides: getOverrides(options, "javascript")
|
|
2568
|
-
}), comments(),
|
|
2569
|
-
if (enableNode) configs
|
|
2570
|
-
if (enableJsdoc) configs
|
|
2571
|
-
if (enableImports) configs
|
|
2451
|
+
}), comments(), command(), perfectionist(), sonar());
|
|
2452
|
+
if (enableNode) configs.push(node());
|
|
2453
|
+
if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
|
|
2454
|
+
if (enableImports) configs.push(imports({
|
|
2572
2455
|
stylistic: stylisticOptions,
|
|
2573
2456
|
...resolveSubOptions(options, "imports")
|
|
2574
2457
|
}));
|
|
2575
|
-
if (enableE18e) configs
|
|
2458
|
+
if (enableE18e) configs.push(e18e({
|
|
2576
2459
|
isInEditor,
|
|
2577
2460
|
...enableE18e === true ? {} : enableE18e
|
|
2578
2461
|
}));
|
|
2579
|
-
if (enableUnicorn) configs
|
|
2462
|
+
if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2580
2463
|
if (enableVue) componentExts.push("vue");
|
|
2581
|
-
if (enableJsx) configs
|
|
2582
|
-
if (enableTypeScript) configs
|
|
2464
|
+
if (enableJsx) configs.push(jsx(enableJsx === true ? {} : enableJsx));
|
|
2465
|
+
if (enableTypeScript) configs.push(typescript({
|
|
2583
2466
|
...typescriptOptions,
|
|
2584
2467
|
componentExts,
|
|
2585
2468
|
overrides: getOverrides(options, "typescript"),
|
|
2586
|
-
type:
|
|
2469
|
+
type: appType
|
|
2587
2470
|
}));
|
|
2588
|
-
if (stylisticOptions) configs
|
|
2471
|
+
if (stylisticOptions) configs.push(stylistic({
|
|
2589
2472
|
...stylisticOptions,
|
|
2590
2473
|
lessOpinionated: options.lessOpinionated,
|
|
2591
2474
|
overrides: getOverrides(options, "stylistic")
|
|
2592
2475
|
}));
|
|
2593
|
-
if (enableRegexp) configs
|
|
2594
|
-
if (options.test ?? true) configs
|
|
2476
|
+
if (enableRegexp) configs.push(regexp(e$2(enableRegexp) ? {} : enableRegexp));
|
|
2477
|
+
if (options.test ?? true) configs.push(test({
|
|
2595
2478
|
isInEditor,
|
|
2596
2479
|
overrides: getOverrides(options, "test")
|
|
2597
2480
|
}));
|
|
2598
|
-
if (enableVue) configs
|
|
2481
|
+
if (enableVue) configs.push(vue({
|
|
2599
2482
|
...resolveSubOptions(options, "vue"),
|
|
2600
2483
|
overrides: getOverrides(options, "vue"),
|
|
2601
2484
|
stylistic: stylisticOptions,
|
|
2602
2485
|
typescript: !!enableTypeScript
|
|
2603
2486
|
}));
|
|
2604
|
-
if (enableReact) configs
|
|
2487
|
+
if (enableReact) configs.push(react({
|
|
2605
2488
|
...typescriptOptions,
|
|
2606
2489
|
...resolveSubOptions(options, "react"),
|
|
2607
2490
|
overrides: getOverrides(options, "react"),
|
|
2608
2491
|
tsconfigPath
|
|
2609
2492
|
}));
|
|
2610
|
-
if (enableNextjs) configs
|
|
2611
|
-
if (enableSolid) configs
|
|
2493
|
+
if (enableNextjs) configs.push(nextjs({ overrides: getOverrides(options, "nextjs") }));
|
|
2494
|
+
if (enableSolid) configs.push(solid({
|
|
2612
2495
|
overrides: getOverrides(options, "solid"),
|
|
2613
2496
|
tsconfigPath,
|
|
2614
2497
|
typescript: !!enableTypeScript
|
|
2615
2498
|
}));
|
|
2616
|
-
if (enableSvelte) configs
|
|
2499
|
+
if (enableSvelte) configs.push(svelte({
|
|
2617
2500
|
overrides: getOverrides(options, "svelte"),
|
|
2618
2501
|
stylistic: stylisticOptions,
|
|
2619
2502
|
typescript: !!enableTypeScript
|
|
2620
2503
|
}));
|
|
2621
|
-
if (enableUnoCSS) configs
|
|
2504
|
+
if (enableUnoCSS) configs.push(unocss({
|
|
2622
2505
|
...resolveSubOptions(options, "unocss"),
|
|
2623
2506
|
overrides: getOverrides(options, "unocss")
|
|
2624
2507
|
}));
|
|
2625
|
-
if (enableAstro) configs
|
|
2508
|
+
if (enableAstro) configs.push(astro({
|
|
2626
2509
|
overrides: getOverrides(options, "astro"),
|
|
2627
2510
|
stylistic: stylisticOptions
|
|
2628
2511
|
}));
|
|
2629
|
-
if (options.jsonc ?? true) configs
|
|
2512
|
+
if (options.jsonc ?? true) configs.push(jsonc({
|
|
2630
2513
|
overrides: getOverrides(options, "jsonc"),
|
|
2631
2514
|
stylistic: stylisticOptions
|
|
2632
2515
|
}), sortPackageJson(), sortTsconfig());
|
|
2633
2516
|
if (enableCatalogs) {
|
|
2634
2517
|
const optionsPnpm = resolveSubOptions(options, "pnpm");
|
|
2635
|
-
configs
|
|
2518
|
+
configs.push(pnpm({
|
|
2636
2519
|
isInEditor,
|
|
2637
2520
|
json: options.jsonc !== false,
|
|
2638
2521
|
yaml: options.yaml !== false,
|
|
2639
2522
|
...optionsPnpm
|
|
2640
2523
|
}));
|
|
2641
2524
|
}
|
|
2642
|
-
if (options.yaml ?? true) configs
|
|
2525
|
+
if (options.yaml ?? true) configs.push(yaml({
|
|
2643
2526
|
overrides: getOverrides(options, "yaml"),
|
|
2644
2527
|
stylistic: stylisticOptions
|
|
2645
2528
|
}));
|
|
2646
|
-
if (options.toml ?? true) configs
|
|
2529
|
+
if (options.toml ?? true) configs.push(toml({
|
|
2647
2530
|
overrides: getOverrides(options, "toml"),
|
|
2648
2531
|
stylistic: stylisticOptions
|
|
2649
2532
|
}));
|
|
2650
|
-
if (options.markdown ?? true) configs
|
|
2533
|
+
if (options.markdown ?? true) configs.push(markdown({
|
|
2651
2534
|
componentExts,
|
|
2652
2535
|
overrides: getOverrides(options, "markdown")
|
|
2653
2536
|
}));
|
|
2654
|
-
if (options.formatters) configs
|
|
2655
|
-
configs
|
|
2537
|
+
if (options.formatters) configs.push(formatters(options.formatters, e$2(stylisticOptions) ? {} : stylisticOptions));
|
|
2538
|
+
configs.push(disables());
|
|
2656
2539
|
if ("files" in options) throw new Error("[@vinicunca/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.");
|
|
2657
2540
|
/**
|
|
2658
2541
|
* User can optionally pass a flat config item to the first argument.
|
|
@@ -2662,9 +2545,9 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2662
2545
|
if (key in options) acc[key] = options[key];
|
|
2663
2546
|
return acc;
|
|
2664
2547
|
}, {});
|
|
2665
|
-
if (Object.keys(fusedConfig).length) configs
|
|
2548
|
+
if (Object.keys(fusedConfig).length) configs.push([fusedConfig]);
|
|
2666
2549
|
let composer = new FlatConfigComposer();
|
|
2667
|
-
composer = composer.append(...configs
|
|
2550
|
+
composer = composer.append(...configs, ...userConfigs);
|
|
2668
2551
|
if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
|
|
2669
2552
|
if (isInEditor) composer = composer.disableRulesFix([
|
|
2670
2553
|
"unused-imports/no-unused-imports",
|
|
@@ -2680,6 +2563,5 @@ function getOverrides(options, key) {
|
|
|
2680
2563
|
function resolveSubOptions(options, key) {
|
|
2681
2564
|
return e$2(options[key]) ? {} : options[key] || {};
|
|
2682
2565
|
}
|
|
2683
|
-
|
|
2684
2566
|
//#endregion
|
|
2685
|
-
export { GLOB_ALL_SRC, 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_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, STYLISTIC_CONFIG_DEFAULTS, astro, combineConfigs, command, comments, defaultPluginRenaming, disables, e18e, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginE18e, pluginImportLite, pluginNode, pluginPerfectionist, pluginSonar, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, solid, sonar, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };
|
|
2567
|
+
export { GLOB_ALL_SRC, 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_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, STYLISTIC_CONFIG_DEFAULTS, astro, combineConfigs, command, comments, defaultPluginRenaming, disables, e18e, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginE18e, pluginImportLite, pluginNode, pluginPerfectionist, pluginSonar, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, solid, sonar, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };
|