@ariel-salgado/eslint-config 0.3.4 → 0.5.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/LICENSE +2 -2
- package/dist/index.d.mts +1157 -185
- package/dist/index.mjs +150 -87
- package/package.json +122 -57
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
2
2
|
import { findUp, findUpSync } from "find-up-simple";
|
|
3
|
+
import plugin_e18e from "@e18e/eslint-plugin";
|
|
3
4
|
import plugin_comments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
4
5
|
import "eslint-config-flat-gitignore";
|
|
5
6
|
import plugin_ariel from "eslint-plugin-ariel";
|
|
@@ -10,13 +11,12 @@ import plugin_perfectionist from "eslint-plugin-perfectionist";
|
|
|
10
11
|
import { configs as plugin_regexp } from "eslint-plugin-regexp";
|
|
11
12
|
import plugin_unicorn from "eslint-plugin-unicorn";
|
|
12
13
|
import plugin_unused_imports from "eslint-plugin-unused-imports";
|
|
13
|
-
import globals from "globals";
|
|
14
14
|
import process$1 from "node:process";
|
|
15
15
|
import { readFile } from "node:fs/promises";
|
|
16
16
|
import { isPackageExists } from "local-pkg";
|
|
17
|
+
import globals from "globals";
|
|
17
18
|
import { fileURLToPath } from "node:url";
|
|
18
19
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
19
|
-
|
|
20
20
|
//#region src/configs/comments.ts
|
|
21
21
|
async function comments() {
|
|
22
22
|
return [{
|
|
@@ -30,7 +30,6 @@ async function comments() {
|
|
|
30
30
|
}
|
|
31
31
|
}];
|
|
32
32
|
}
|
|
33
|
-
|
|
34
33
|
//#endregion
|
|
35
34
|
//#region src/globs.ts
|
|
36
35
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -102,7 +101,6 @@ const GLOB_EXCLUDE = [
|
|
|
102
101
|
"**/auto-import?(s).d.ts",
|
|
103
102
|
"**/components.d.ts"
|
|
104
103
|
];
|
|
105
|
-
|
|
106
104
|
//#endregion
|
|
107
105
|
//#region src/configs/disables.ts
|
|
108
106
|
async function disables() {
|
|
@@ -139,7 +137,56 @@ async function disables() {
|
|
|
139
137
|
}
|
|
140
138
|
];
|
|
141
139
|
}
|
|
142
|
-
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/env.ts
|
|
142
|
+
function has_typescript() {
|
|
143
|
+
return isPackageExists("typescript");
|
|
144
|
+
}
|
|
145
|
+
function has_svelte() {
|
|
146
|
+
return isPackageExists("svelte") || isPackageExists("@sveltejs/kit");
|
|
147
|
+
}
|
|
148
|
+
function has_tailwindcss() {
|
|
149
|
+
return isPackageExists("tailwindcss") || isPackageExists("@tailwindcss/vite");
|
|
150
|
+
}
|
|
151
|
+
function has_react() {
|
|
152
|
+
return isPackageExists("react") || isPackageExists("react-dom");
|
|
153
|
+
}
|
|
154
|
+
function has_nextjs() {
|
|
155
|
+
return isPackageExists("next");
|
|
156
|
+
}
|
|
157
|
+
function has_solid() {
|
|
158
|
+
return isPackageExists("solid-js");
|
|
159
|
+
}
|
|
160
|
+
async function has_pnpm_catalogs() {
|
|
161
|
+
const workspace_file = await findUp("pnpm-workspace.yaml");
|
|
162
|
+
if (!workspace_file) return false;
|
|
163
|
+
const yaml = await readFile(workspace_file, "utf8");
|
|
164
|
+
return yaml.includes("catalog:") || yaml.includes("catalogs:");
|
|
165
|
+
}
|
|
166
|
+
function is_in_git_hooks_or_lint_staged() {
|
|
167
|
+
return !!(process$1.env.GIT_PARAMS || process$1.env.VSCODE_GIT_COMMAND || process$1.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
168
|
+
}
|
|
169
|
+
function is_in_editor_env() {
|
|
170
|
+
if (process$1.env.CI) return false;
|
|
171
|
+
if (is_in_git_hooks_or_lint_staged()) return false;
|
|
172
|
+
return !!(process$1.env.VSCODE_PID || process$1.env.VSCODE_CWD || process$1.env.JETBRAINS_IDE || process$1.env.VIM || process$1.env.NVIM);
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/configs/e18e.ts
|
|
176
|
+
async function e18e(options = {}) {
|
|
177
|
+
const { modernization = true, moduleReplacements = is_in_editor_env(), overrides = {}, performanceImprovements = true } = options;
|
|
178
|
+
const configs = plugin_e18e.configs;
|
|
179
|
+
return [{
|
|
180
|
+
name: "ariel/e18e/rules",
|
|
181
|
+
plugins: { e18e: plugin_e18e },
|
|
182
|
+
rules: {
|
|
183
|
+
...modernization ? { ...configs.modernization.rules } : {},
|
|
184
|
+
...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
|
|
185
|
+
...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
|
|
186
|
+
...overrides
|
|
187
|
+
}
|
|
188
|
+
}];
|
|
189
|
+
}
|
|
143
190
|
//#endregion
|
|
144
191
|
//#region src/configs/ignores.ts
|
|
145
192
|
async function ignores(userIgnores = []) {
|
|
@@ -151,7 +198,6 @@ async function ignores(userIgnores = []) {
|
|
|
151
198
|
name: "ariel/ignores"
|
|
152
199
|
}];
|
|
153
200
|
}
|
|
154
|
-
|
|
155
201
|
//#endregion
|
|
156
202
|
//#region src/configs/imports.ts
|
|
157
203
|
async function imports(options = {}) {
|
|
@@ -177,42 +223,6 @@ async function imports(options = {}) {
|
|
|
177
223
|
}
|
|
178
224
|
}];
|
|
179
225
|
}
|
|
180
|
-
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region src/env.ts
|
|
183
|
-
function has_typescript() {
|
|
184
|
-
return isPackageExists("typescript");
|
|
185
|
-
}
|
|
186
|
-
function has_svelte() {
|
|
187
|
-
return isPackageExists("svelte") || isPackageExists("@sveltejs/kit");
|
|
188
|
-
}
|
|
189
|
-
function has_tailwindcss() {
|
|
190
|
-
return isPackageExists("tailwindcss") || isPackageExists("@tailwindcss/vite");
|
|
191
|
-
}
|
|
192
|
-
function has_react() {
|
|
193
|
-
return isPackageExists("react") || isPackageExists("react-dom");
|
|
194
|
-
}
|
|
195
|
-
function has_nextjs() {
|
|
196
|
-
return isPackageExists("next");
|
|
197
|
-
}
|
|
198
|
-
function has_solid() {
|
|
199
|
-
return isPackageExists("solid-js");
|
|
200
|
-
}
|
|
201
|
-
async function has_pnpm_catalogs() {
|
|
202
|
-
const workspace_file = await findUp("pnpm-workspace.yaml");
|
|
203
|
-
if (!workspace_file) return false;
|
|
204
|
-
const yaml = await readFile(workspace_file, "utf8");
|
|
205
|
-
return yaml.includes("catalog:") || yaml.includes("catalogs:");
|
|
206
|
-
}
|
|
207
|
-
function is_in_git_hooks_or_lint_staged() {
|
|
208
|
-
return !!(process$1.env.GIT_PARAMS || process$1.env.VSCODE_GIT_COMMAND || process$1.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
209
|
-
}
|
|
210
|
-
function is_in_editor_env() {
|
|
211
|
-
if (process$1.env.CI) return false;
|
|
212
|
-
if (is_in_git_hooks_or_lint_staged()) return false;
|
|
213
|
-
return !!(process$1.env.VSCODE_PID || process$1.env.VSCODE_CWD || process$1.env.JETBRAINS_IDE || process$1.env.VIM || process$1.env.NVIM);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
226
|
//#endregion
|
|
217
227
|
//#region src/configs/javascript.ts
|
|
218
228
|
async function javascript(options = {}) {
|
|
@@ -447,7 +457,6 @@ async function javascript(options = {}) {
|
|
|
447
457
|
}
|
|
448
458
|
}];
|
|
449
459
|
}
|
|
450
|
-
|
|
451
460
|
//#endregion
|
|
452
461
|
//#region src/utils.ts
|
|
453
462
|
const scope_url = fileURLToPath(new URL(".", import.meta.url));
|
|
@@ -507,14 +516,16 @@ async function ensure_packages(packages) {
|
|
|
507
516
|
if (non_existing_packages.length === 0) return;
|
|
508
517
|
if (await (await import("@clack/prompts")).confirm({ message: `${non_existing_packages.length === 1 ? "Package is" : "Packages are"} required for this config: ${non_existing_packages.join(", ")}. Do you want to install them?` })) await import("@antfu/install-pkg").then((i) => i.installPackage(non_existing_packages, { dev: true }));
|
|
509
518
|
}
|
|
510
|
-
|
|
511
519
|
//#endregion
|
|
512
520
|
//#region src/configs/jsdoc.ts
|
|
513
521
|
async function jsdoc(options = {}) {
|
|
514
522
|
const { stylistic = true } = options;
|
|
515
523
|
return [{
|
|
524
|
+
name: "ariel/jsdoc/setup",
|
|
525
|
+
plugins: { jsdoc: await interop_default(import("eslint-plugin-jsdoc")) }
|
|
526
|
+
}, {
|
|
527
|
+
files: [GLOB_SRC],
|
|
516
528
|
name: "ariel/jsdoc/rules",
|
|
517
|
-
plugins: { jsdoc: await interop_default(import("eslint-plugin-jsdoc")) },
|
|
518
529
|
rules: {
|
|
519
530
|
"jsdoc/check-access": "warn",
|
|
520
531
|
"jsdoc/check-param-names": "warn",
|
|
@@ -538,7 +549,6 @@ async function jsdoc(options = {}) {
|
|
|
538
549
|
}
|
|
539
550
|
}];
|
|
540
551
|
}
|
|
541
|
-
|
|
542
552
|
//#endregion
|
|
543
553
|
//#region src/configs/jsonc.ts
|
|
544
554
|
async function jsonc(options = {}) {
|
|
@@ -548,13 +558,12 @@ async function jsonc(options = {}) {
|
|
|
548
558
|
GLOB_JSONC
|
|
549
559
|
], overrides = {}, stylistic = true } = options;
|
|
550
560
|
const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
|
|
551
|
-
const [plugin_jsonc, parser_jsonc] = await Promise.all([interop_default(import("eslint-plugin-jsonc")), interop_default(import("jsonc-eslint-parser"))]);
|
|
552
561
|
return [{
|
|
553
562
|
name: "ariel/jsonc/setup",
|
|
554
|
-
plugins: { jsonc:
|
|
563
|
+
plugins: { jsonc: await interop_default(import("eslint-plugin-jsonc")) }
|
|
555
564
|
}, {
|
|
556
565
|
files,
|
|
557
|
-
|
|
566
|
+
language: "jsonc/x",
|
|
558
567
|
name: "ariel/jsonc/rules",
|
|
559
568
|
rules: {
|
|
560
569
|
"jsonc/no-bigint-literals": "error",
|
|
@@ -605,7 +614,6 @@ async function jsonc(options = {}) {
|
|
|
605
614
|
}
|
|
606
615
|
}];
|
|
607
616
|
}
|
|
608
|
-
|
|
609
617
|
//#endregion
|
|
610
618
|
//#region src/configs/jsx.ts
|
|
611
619
|
async function jsx(options = {}) {
|
|
@@ -644,11 +652,10 @@ async function jsx(options = {}) {
|
|
|
644
652
|
}
|
|
645
653
|
}];
|
|
646
654
|
}
|
|
647
|
-
|
|
648
655
|
//#endregion
|
|
649
656
|
//#region src/configs/markdown.ts
|
|
650
657
|
async function markdown(options = {}) {
|
|
651
|
-
const { componentExts = [], files = [GLOB_MARKDOWN], overrides = {} } = options;
|
|
658
|
+
const { componentExts = [], files = [GLOB_MARKDOWN], gfm = true, overrides = {}, overridesMarkdown = {} } = options;
|
|
652
659
|
const markdown = await interop_default(import("@eslint/markdown"));
|
|
653
660
|
return [
|
|
654
661
|
{
|
|
@@ -663,14 +670,40 @@ async function markdown(options = {}) {
|
|
|
663
670
|
},
|
|
664
671
|
{
|
|
665
672
|
files,
|
|
666
|
-
|
|
673
|
+
language: gfm ? "markdown/gfm" : "markdown/commonmark",
|
|
667
674
|
name: "ariel/markdown/parser"
|
|
668
675
|
},
|
|
676
|
+
{
|
|
677
|
+
files,
|
|
678
|
+
name: "ariel/markdown/rules",
|
|
679
|
+
rules: {
|
|
680
|
+
...markdown.configs.recommended.at(0)?.rules,
|
|
681
|
+
"markdown/fenced-code-language": "off",
|
|
682
|
+
"markdown/no-missing-label-refs": "off",
|
|
683
|
+
...overridesMarkdown
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
files,
|
|
688
|
+
name: "ariel/markdown/disables/markdown",
|
|
689
|
+
rules: {
|
|
690
|
+
"command/command": "off",
|
|
691
|
+
"no-irregular-whitespace": "off",
|
|
692
|
+
"perfectionist/sort-exports": "off",
|
|
693
|
+
"perfectionist/sort-imports": "off",
|
|
694
|
+
"regexp/no-legacy-features": "off",
|
|
695
|
+
"regexp/no-missing-g-flag": "off",
|
|
696
|
+
"regexp/no-useless-dollar-replacements": "off",
|
|
697
|
+
"regexp/no-useless-flag": "off",
|
|
698
|
+
"style/indent": "off"
|
|
699
|
+
}
|
|
700
|
+
},
|
|
669
701
|
{
|
|
670
702
|
files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
|
|
671
703
|
languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
|
|
672
|
-
name: "ariel/markdown/disables",
|
|
704
|
+
name: "ariel/markdown/disables/code",
|
|
673
705
|
rules: {
|
|
706
|
+
"ariel/no-top-level-await": "off",
|
|
674
707
|
"no-alert": "off",
|
|
675
708
|
"no-console": "off",
|
|
676
709
|
"no-labels": "off",
|
|
@@ -700,7 +733,6 @@ async function markdown(options = {}) {
|
|
|
700
733
|
}
|
|
701
734
|
];
|
|
702
735
|
}
|
|
703
|
-
|
|
704
736
|
//#endregion
|
|
705
737
|
//#region src/configs/morgan.ts
|
|
706
738
|
async function morgan() {
|
|
@@ -713,7 +745,6 @@ async function morgan() {
|
|
|
713
745
|
}
|
|
714
746
|
}];
|
|
715
747
|
}
|
|
716
|
-
|
|
717
748
|
//#endregion
|
|
718
749
|
//#region src/configs/nextjs.ts
|
|
719
750
|
function normalize_rules(rules) {
|
|
@@ -746,13 +777,15 @@ async function nextjs(options = {}) {
|
|
|
746
777
|
settings: { react: { version: "detect" } }
|
|
747
778
|
}];
|
|
748
779
|
}
|
|
749
|
-
|
|
750
780
|
//#endregion
|
|
751
781
|
//#region src/configs/node.ts
|
|
752
782
|
async function node() {
|
|
753
783
|
return [{
|
|
784
|
+
name: "ariel/node/setup",
|
|
785
|
+
plugins: { node: plugin_node }
|
|
786
|
+
}, {
|
|
787
|
+
files: [GLOB_SRC],
|
|
754
788
|
name: "ariel/node/rules",
|
|
755
|
-
plugins: { node: plugin_node },
|
|
756
789
|
rules: {
|
|
757
790
|
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
758
791
|
"node/no-deprecated-api": "error",
|
|
@@ -766,7 +799,6 @@ async function node() {
|
|
|
766
799
|
}
|
|
767
800
|
}];
|
|
768
801
|
}
|
|
769
|
-
|
|
770
802
|
//#endregion
|
|
771
803
|
//#region src/configs/perfectionist.ts
|
|
772
804
|
async function perfectionist() {
|
|
@@ -955,21 +987,19 @@ async function perfectionist() {
|
|
|
955
987
|
}
|
|
956
988
|
}];
|
|
957
989
|
}
|
|
958
|
-
|
|
959
990
|
//#endregion
|
|
960
991
|
//#region src/configs/pnpm.ts
|
|
961
992
|
async function pnpm(options) {
|
|
962
|
-
const [plugin_pnpm, plugin_yaml, yaml_parser
|
|
993
|
+
const [plugin_pnpm, plugin_yaml, yaml_parser] = await Promise.all([
|
|
963
994
|
interop_default(import("eslint-plugin-pnpm")),
|
|
964
995
|
interop_default(import("eslint-plugin-yml")),
|
|
965
|
-
interop_default(import("yaml-eslint-parser"))
|
|
966
|
-
interop_default(import("jsonc-eslint-parser"))
|
|
996
|
+
interop_default(import("yaml-eslint-parser"))
|
|
967
997
|
]);
|
|
968
998
|
const { catalogs = await has_pnpm_catalogs(), json = true, sort = true, yaml = true } = options;
|
|
969
999
|
const configs = [];
|
|
970
1000
|
if (json) configs.push({
|
|
971
1001
|
files: ["package.json", "**/package.json"],
|
|
972
|
-
|
|
1002
|
+
language: "jsonc/x",
|
|
973
1003
|
name: "ariel/pnpm/package-json",
|
|
974
1004
|
plugins: { pnpm: plugin_pnpm },
|
|
975
1005
|
rules: {
|
|
@@ -1077,7 +1107,6 @@ async function pnpm(options) {
|
|
|
1077
1107
|
}
|
|
1078
1108
|
return configs;
|
|
1079
1109
|
}
|
|
1080
|
-
|
|
1081
1110
|
//#endregion
|
|
1082
1111
|
//#region src/configs/react.ts
|
|
1083
1112
|
const react_refresh_allow_constant_export_packages = ["vite"];
|
|
@@ -1270,7 +1299,6 @@ async function react(options = {}) {
|
|
|
1270
1299
|
}] : []
|
|
1271
1300
|
];
|
|
1272
1301
|
}
|
|
1273
|
-
|
|
1274
1302
|
//#endregion
|
|
1275
1303
|
//#region src/configs/regexp.ts
|
|
1276
1304
|
async function regexp(options = {}) {
|
|
@@ -1288,7 +1316,6 @@ async function regexp(options = {}) {
|
|
|
1288
1316
|
}
|
|
1289
1317
|
}];
|
|
1290
1318
|
}
|
|
1291
|
-
|
|
1292
1319
|
//#endregion
|
|
1293
1320
|
//#region src/configs/solid.ts
|
|
1294
1321
|
async function solid(options = {}) {
|
|
@@ -1339,7 +1366,6 @@ async function solid(options = {}) {
|
|
|
1339
1366
|
}
|
|
1340
1367
|
}];
|
|
1341
1368
|
}
|
|
1342
|
-
|
|
1343
1369
|
//#endregion
|
|
1344
1370
|
//#region src/configs/sort.ts
|
|
1345
1371
|
async function sort_package_json() {
|
|
@@ -1564,7 +1590,6 @@ async function sort_ts_config() {
|
|
|
1564
1590
|
] }
|
|
1565
1591
|
}];
|
|
1566
1592
|
}
|
|
1567
|
-
|
|
1568
1593
|
//#endregion
|
|
1569
1594
|
//#region src/configs/stylistic.ts
|
|
1570
1595
|
const defaults = {
|
|
@@ -1612,7 +1637,6 @@ async function stylistic(options = {}) {
|
|
|
1612
1637
|
}
|
|
1613
1638
|
}];
|
|
1614
1639
|
}
|
|
1615
|
-
|
|
1616
1640
|
//#endregion
|
|
1617
1641
|
//#region src/configs/svelte.ts
|
|
1618
1642
|
async function svelte(options = {}) {
|
|
@@ -1689,7 +1713,6 @@ async function svelte(options = {}) {
|
|
|
1689
1713
|
}
|
|
1690
1714
|
}];
|
|
1691
1715
|
}
|
|
1692
|
-
|
|
1693
1716
|
//#endregion
|
|
1694
1717
|
//#region src/configs/tailwindcss.ts
|
|
1695
1718
|
async function tailwindcss(options = {}) {
|
|
@@ -1723,7 +1746,6 @@ async function tailwindcss(options = {}) {
|
|
|
1723
1746
|
settings: { "better-tailwindcss": { entryPoint } }
|
|
1724
1747
|
}];
|
|
1725
1748
|
}
|
|
1726
|
-
|
|
1727
1749
|
//#endregion
|
|
1728
1750
|
//#region src/configs/test.ts
|
|
1729
1751
|
let _plugin_test;
|
|
@@ -1761,7 +1783,6 @@ async function test(options = {}) {
|
|
|
1761
1783
|
}
|
|
1762
1784
|
}];
|
|
1763
1785
|
}
|
|
1764
|
-
|
|
1765
1786
|
//#endregion
|
|
1766
1787
|
//#region src/configs/toml.ts
|
|
1767
1788
|
async function toml(options = {}) {
|
|
@@ -1801,18 +1822,17 @@ async function toml(options = {}) {
|
|
|
1801
1822
|
}
|
|
1802
1823
|
}];
|
|
1803
1824
|
}
|
|
1804
|
-
|
|
1805
1825
|
//#endregion
|
|
1806
1826
|
//#region src/configs/typescript.ts
|
|
1807
1827
|
async function typescript(options = {}) {
|
|
1808
1828
|
const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
|
|
1809
1829
|
const files = options.files ?? [
|
|
1810
|
-
|
|
1811
|
-
|
|
1830
|
+
"**/*.?([cm])ts",
|
|
1831
|
+
"**/*.?([cm])jsx",
|
|
1812
1832
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1813
1833
|
];
|
|
1814
|
-
const files_type_aware = options.filesTypeAware ?? [
|
|
1815
|
-
const ignores_type_aware = options.ignoresTypeAware ?? [
|
|
1834
|
+
const files_type_aware = options.filesTypeAware ?? ["**/*.?([cm])ts", "**/*.?([cm])jsx"];
|
|
1835
|
+
const ignores_type_aware = options.ignoresTypeAware ?? [`**/*.md/**`];
|
|
1816
1836
|
const tsconfig_path = options?.tsconfigPath ? options.tsconfigPath : void 0;
|
|
1817
1837
|
const is_type_aware = !!tsconfig_path;
|
|
1818
1838
|
const type_aware_rules = {
|
|
@@ -1935,9 +1955,9 @@ async function typescript(options = {}) {
|
|
|
1935
1955
|
}] : []
|
|
1936
1956
|
];
|
|
1937
1957
|
}
|
|
1938
|
-
|
|
1939
1958
|
//#endregion
|
|
1940
1959
|
//#region src/configs/unicorn.ts
|
|
1960
|
+
const FILENAME_PATTERN = [/^[A-Z]+\..*$/, /import_map\.json/];
|
|
1941
1961
|
async function unicorn(options = {}) {
|
|
1942
1962
|
const { allRecommended = false, overrides = {} } = options;
|
|
1943
1963
|
return [{
|
|
@@ -1953,7 +1973,7 @@ async function unicorn(options = {}) {
|
|
|
1953
1973
|
kebabCase: true,
|
|
1954
1974
|
pascalCase: true
|
|
1955
1975
|
},
|
|
1956
|
-
ignore:
|
|
1976
|
+
ignore: FILENAME_PATTERN
|
|
1957
1977
|
}],
|
|
1958
1978
|
"unicorn/error-message": "error",
|
|
1959
1979
|
"unicorn/escape-case": "error",
|
|
@@ -1979,7 +1999,6 @@ async function unicorn(options = {}) {
|
|
|
1979
1999
|
}
|
|
1980
2000
|
}];
|
|
1981
2001
|
}
|
|
1982
|
-
|
|
1983
2002
|
//#endregion
|
|
1984
2003
|
//#region src/configs/yaml.ts
|
|
1985
2004
|
async function yaml(options = {}) {
|
|
@@ -2008,7 +2027,7 @@ async function yaml(options = {}) {
|
|
|
2008
2027
|
"yaml/flow-mapping-curly-spacing": "error",
|
|
2009
2028
|
"yaml/flow-sequence-bracket-newline": "error",
|
|
2010
2029
|
"yaml/flow-sequence-bracket-spacing": "error",
|
|
2011
|
-
"yaml/indent": ["error", typeof indent === "number" ? indent :
|
|
2030
|
+
"yaml/indent": ["error", typeof indent === "number" ? indent : 2],
|
|
2012
2031
|
"yaml/key-spacing": "error",
|
|
2013
2032
|
"yaml/no-tab-indent": "error",
|
|
2014
2033
|
"yaml/quotes": ["error", {
|
|
@@ -2021,7 +2040,6 @@ async function yaml(options = {}) {
|
|
|
2021
2040
|
}
|
|
2022
2041
|
}];
|
|
2023
2042
|
}
|
|
2024
|
-
|
|
2025
2043
|
//#endregion
|
|
2026
2044
|
//#region src/factory.ts
|
|
2027
2045
|
const flat_config_props = [
|
|
@@ -2058,7 +2076,7 @@ const default_plugin_renaming = {
|
|
|
2058
2076
|
* The merged ESLint configurations.
|
|
2059
2077
|
*/
|
|
2060
2078
|
function defineConfig(options = {}, ...userConfigs) {
|
|
2061
|
-
const { autoRenamePlugins = true, componentExts = [], gitignore: enable_git_ignore = true, ignores: user_ignores = [], imports: enable_imports = true, jsdoc: enable_jsdoc = true, jsx: enable_jsx = has_react() || has_nextjs() || has_solid(), nextjs: enable_nextjs = has_nextjs(), node: enable_node = true, pnpm: enable_catalogs = !!findUpSync("pnpm-workspace.yaml"), react: enable_react = has_react(), regexp: enable_regexp = true, solid: enable_solid = has_solid(), svelte: enable_svelte = has_svelte(), tailwindcss: enable_tailwindcss = has_tailwindcss(), typescript: enable_typescript = has_typescript(), unicorn: enable_unicorn = true } = options;
|
|
2079
|
+
const { autoRenamePlugins = true, componentExts = [], e18e: enable_e18e = true, gitignore: enable_git_ignore = true, ignores: user_ignores = [], imports: enable_imports = true, jsdoc: enable_jsdoc = true, jsx: enable_jsx = has_react() || has_nextjs() || has_solid(), nextjs: enable_nextjs = has_nextjs(), node: enable_node = true, pnpm: enable_catalogs = !!findUpSync("pnpm-workspace.yaml"), react: enable_react = has_react(), regexp: enable_regexp = true, solid: enable_solid = has_solid(), svelte: enable_svelte = has_svelte(), tailwindcss: enable_tailwindcss = has_tailwindcss(), typescript: enable_typescript = has_typescript(), unicorn: enable_unicorn = true } = options;
|
|
2062
2080
|
const is_in_editor = is_in_editor_env();
|
|
2063
2081
|
if (is_in_editor) console.log("[@ariel-salgado/eslint-config] Detected running in editor, some rules are disabled.");
|
|
2064
2082
|
const stylistic_options = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
@@ -2081,6 +2099,7 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
2081
2099
|
stylistic: stylistic_options,
|
|
2082
2100
|
...resolve_sub_options(options, "imports")
|
|
2083
2101
|
}));
|
|
2102
|
+
if (enable_e18e) configs.push(e18e({ ...enable_e18e === true ? {} : enable_e18e }));
|
|
2084
2103
|
if (enable_unicorn) configs.push(unicorn(enable_unicorn === true ? {} : enable_unicorn));
|
|
2085
2104
|
if (enable_jsx) configs.push(jsx(enable_jsx === true ? {} : enable_jsx));
|
|
2086
2105
|
if (enable_typescript) configs.push(typescript({
|
|
@@ -2164,10 +2183,54 @@ function get_overrides(options, key) {
|
|
|
2164
2183
|
..."overrides" in sub ? sub.overrides : {}
|
|
2165
2184
|
};
|
|
2166
2185
|
}
|
|
2167
|
-
|
|
2186
|
+
//#endregion
|
|
2187
|
+
//#region src/presets.ts
|
|
2188
|
+
const PRESET_FULL_ON = {
|
|
2189
|
+
gitignore: true,
|
|
2190
|
+
imports: true,
|
|
2191
|
+
jsdoc: true,
|
|
2192
|
+
jsonc: true,
|
|
2193
|
+
jsx: { a11y: true },
|
|
2194
|
+
markdown: true,
|
|
2195
|
+
nextjs: true,
|
|
2196
|
+
node: true,
|
|
2197
|
+
pnpm: true,
|
|
2198
|
+
react: { reactCompiler: true },
|
|
2199
|
+
regexp: true,
|
|
2200
|
+
solid: true,
|
|
2201
|
+
stylistic: { experimental: true },
|
|
2202
|
+
svelte: true,
|
|
2203
|
+
test: true,
|
|
2204
|
+
toml: true,
|
|
2205
|
+
typescript: { tsconfigPath: "tsconfig.json" },
|
|
2206
|
+
e18e: true,
|
|
2207
|
+
unicorn: true,
|
|
2208
|
+
yaml: true
|
|
2209
|
+
};
|
|
2210
|
+
const PRESET_FULL_OFF = {
|
|
2211
|
+
gitignore: false,
|
|
2212
|
+
imports: false,
|
|
2213
|
+
jsdoc: false,
|
|
2214
|
+
jsonc: false,
|
|
2215
|
+
jsx: false,
|
|
2216
|
+
markdown: false,
|
|
2217
|
+
nextjs: false,
|
|
2218
|
+
node: false,
|
|
2219
|
+
pnpm: false,
|
|
2220
|
+
react: false,
|
|
2221
|
+
regexp: false,
|
|
2222
|
+
solid: false,
|
|
2223
|
+
stylistic: false,
|
|
2224
|
+
svelte: false,
|
|
2225
|
+
test: false,
|
|
2226
|
+
toml: false,
|
|
2227
|
+
typescript: false,
|
|
2228
|
+
e18e: false,
|
|
2229
|
+
unicorn: false,
|
|
2230
|
+
yaml: false
|
|
2231
|
+
};
|
|
2168
2232
|
//#endregion
|
|
2169
2233
|
//#region src/index.ts
|
|
2170
2234
|
var src_default = defineConfig;
|
|
2171
|
-
|
|
2172
2235
|
//#endregion
|
|
2173
|
-
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, 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_XML, GLOB_YAML, combine, comments, src_default as default, default_plugin_renaming, defaults, defineConfig, disables, ensure_packages, get_overrides, ignores, imports, interop_default, is_package_in_scope, javascript, jsdoc, jsonc, jsx, markdown, morgan, nextjs, node, parser_plain, perfectionist, pnpm, react, regexp, rename_plugin_in_configs, rename_rules, resolve_sub_options, solid, sort_package_json, sort_ts_config, stylistic, svelte, tailwindcss, test, to_array, toml, typescript, unicorn, yaml };
|
|
2236
|
+
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, 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_XML, GLOB_YAML, PRESET_FULL_OFF, PRESET_FULL_ON, combine, comments, src_default as default, default_plugin_renaming, defaults, defineConfig, disables, e18e, ensure_packages, get_overrides, ignores, imports, interop_default, is_package_in_scope, javascript, jsdoc, jsonc, jsx, markdown, morgan, nextjs, node, parser_plain, perfectionist, pnpm, react, regexp, rename_plugin_in_configs, rename_rules, resolve_sub_options, solid, sort_package_json, sort_ts_config, stylistic, svelte, tailwindcss, test, to_array, toml, typescript, unicorn, yaml };
|