@ariel-salgado/eslint-config 0.4.0 → 1.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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FlatConfigComposer } from "eslint-flat-config-utils";
2
- import { findUp, findUpSync } from "find-up-simple";
2
+ import plugin_e18e from "@e18e/eslint-plugin";
3
3
  import plugin_comments from "@eslint-community/eslint-plugin-eslint-comments";
4
4
  import "eslint-config-flat-gitignore";
5
5
  import plugin_ariel from "eslint-plugin-ariel";
@@ -7,16 +7,16 @@ import plugin_morgan from "eslint-plugin-de-morgan";
7
7
  import plugin_import from "eslint-plugin-import-lite";
8
8
  import plugin_node from "eslint-plugin-n";
9
9
  import plugin_perfectionist from "eslint-plugin-perfectionist";
10
- import { configs as plugin_regexp } from "eslint-plugin-regexp";
10
+ import { configs } from "eslint-plugin-regexp";
11
11
  import plugin_unicorn from "eslint-plugin-unicorn";
12
12
  import plugin_unused_imports from "eslint-plugin-unused-imports";
13
- import globals from "globals";
14
- import process$1 from "node:process";
13
+ import process from "node:process";
15
14
  import { readFile } from "node:fs/promises";
15
+ import { findUp } from "find-up-simple";
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,15 +30,12 @@ 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)";
37
36
  const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
38
37
  const GLOB_JS = "**/*.?([cm])js";
39
- const GLOB_JSX = "**/*.?([cm])jsx";
40
38
  const GLOB_TS = "**/*.?([cm])ts";
41
- const GLOB_TSX = "**/*.?([cm])tsx";
42
39
  const GLOB_STYLE = "**/*.{c,le,sc}ss";
43
40
  const GLOB_CSS = "**/*.css";
44
41
  const GLOB_POSTCSS = "**/*.{p,post}css";
@@ -102,7 +99,6 @@ const GLOB_EXCLUDE = [
102
99
  "**/auto-import?(s).d.ts",
103
100
  "**/components.d.ts"
104
101
  ];
105
-
106
102
  //#endregion
107
103
  //#region src/configs/disables.ts
108
104
  async function disables() {
@@ -139,11 +135,60 @@ async function disables() {
139
135
  }
140
136
  ];
141
137
  }
142
-
138
+ //#endregion
139
+ //#region src/env.ts
140
+ function has_typescript() {
141
+ return isPackageExists("typescript") || isPackageExists("@typescript/native-preview");
142
+ }
143
+ function has_svelte() {
144
+ return isPackageExists("svelte");
145
+ }
146
+ function has_tailwindcss() {
147
+ return isPackageExists("tailwindcss");
148
+ }
149
+ async function has_pnpm_catalogs() {
150
+ const workspace_file = await findUp("pnpm-workspace.yaml");
151
+ if (!workspace_file) return false;
152
+ const yaml = await readFile(workspace_file, "utf8");
153
+ return yaml.includes("catalog:") || yaml.includes("catalogs:");
154
+ }
155
+ function is_in_git_hooks_or_lint_staged() {
156
+ return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
157
+ }
158
+ function is_in_editor_env() {
159
+ if (process.env.CI) return false;
160
+ if (is_in_git_hooks_or_lint_staged()) return false;
161
+ return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
162
+ }
163
+ //#endregion
164
+ //#region src/configs/e18e.ts
165
+ async function e18e(options = {}) {
166
+ const { modernization = true, type = "app", moduleReplacements = type === "lib" && is_in_editor_env(), overrides = {}, performanceImprovements = true } = options;
167
+ const configs = plugin_e18e.configs;
168
+ return [{
169
+ name: "ariel/e18e/rules",
170
+ plugins: { e18e: plugin_e18e },
171
+ rules: {
172
+ ...modernization ? { ...configs.modernization.rules } : {},
173
+ ...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
174
+ ...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
175
+ ...type === "lib" ? {} : { "e18e/prefer-static-regex": "off" },
176
+ "e18e/prefer-array-at": "off",
177
+ "e18e/prefer-array-from-map": "off",
178
+ "e18e/prefer-array-to-reversed": "off",
179
+ "e18e/prefer-array-to-sorted": "off",
180
+ "e18e/prefer-array-to-spliced": "off",
181
+ "e18e/prefer-spread-syntax": "off",
182
+ "e18e/ban-dependencies": ["error", { allowed: ["lint-staged"] }],
183
+ ...overrides
184
+ }
185
+ }];
186
+ }
143
187
  //#endregion
144
188
  //#region src/configs/ignores.ts
145
- async function ignores(userIgnores = []) {
189
+ async function ignores(userIgnores = [], ignoreTypeScript = false) {
146
190
  let ignores = [...GLOB_EXCLUDE];
191
+ if (ignoreTypeScript) ignores.push(GLOB_TS);
147
192
  if (typeof userIgnores === "function") ignores = userIgnores(ignores);
148
193
  else ignores = [...ignores, ...userIgnores];
149
194
  return [{
@@ -151,7 +196,6 @@ async function ignores(userIgnores = []) {
151
196
  name: "ariel/ignores"
152
197
  }];
153
198
  }
154
-
155
199
  //#endregion
156
200
  //#region src/configs/imports.ts
157
201
  async function imports(options = {}) {
@@ -171,48 +215,11 @@ async function imports(options = {}) {
171
215
  "import/no-duplicates": "error",
172
216
  "import/no-mutable-exports": "error",
173
217
  "import/no-named-default": "error",
174
- "import/no-default-export": "off",
175
218
  ...stylistic ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
176
219
  ...overrides
177
220
  }
178
221
  }];
179
222
  }
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
223
  //#endregion
217
224
  //#region src/configs/javascript.ts
218
225
  async function javascript(options = {}) {
@@ -222,7 +229,7 @@ async function javascript(options = {}) {
222
229
  ecmaVersion: "latest",
223
230
  globals: {
224
231
  ...globals.browser,
225
- ...globals.es2026,
232
+ ...globals.es2021,
226
233
  ...globals.node,
227
234
  document: "readonly",
228
235
  navigator: "readonly",
@@ -248,14 +255,13 @@ async function javascript(options = {}) {
248
255
  enforceForClassMembers: true,
249
256
  setWithoutGet: true
250
257
  }],
251
- "ariel/prefer-for-of": "warn",
258
+ "ariel/no-top-level-await": "error",
252
259
  "array-callback-return": "error",
253
260
  "block-scoped-var": "error",
254
261
  "constructor-super": "error",
255
262
  "default-case-last": "error",
256
263
  "dot-notation": ["error", { allowKeywords: true }],
257
264
  "eqeqeq": ["error", "smart"],
258
- "for-direction": "error",
259
265
  "new-cap": ["error", {
260
266
  capIsNew: false,
261
267
  newIsCap: true,
@@ -269,14 +275,8 @@ async function javascript(options = {}) {
269
275
  "no-class-assign": "error",
270
276
  "no-compare-neg-zero": "error",
271
277
  "no-cond-assign": ["error", "always"],
272
- "no-console": ["warn", { allow: [
273
- "warn",
274
- "error",
275
- "info",
276
- "clear"
277
- ] }],
278
+ "no-console": ["error", { allow: ["warn", "error"] }],
278
279
  "no-const-assign": "error",
279
- "no-constant-binary-expression": "error",
280
280
  "no-control-regex": "error",
281
281
  "no-debugger": "error",
282
282
  "no-delete-var": "error",
@@ -284,7 +284,6 @@ async function javascript(options = {}) {
284
284
  "no-dupe-class-members": "error",
285
285
  "no-dupe-keys": "error",
286
286
  "no-duplicate-case": "error",
287
- "no-duplicate-imports": "off",
288
287
  "no-empty": ["error", { allowEmptyCatch: true }],
289
288
  "no-empty-character-class": "error",
290
289
  "no-empty-pattern": "error",
@@ -306,7 +305,6 @@ async function javascript(options = {}) {
306
305
  allowSwitch: false
307
306
  }],
308
307
  "no-lone-blocks": "error",
309
- "no-lonely-if": "error",
310
308
  "no-loss-of-precision": "error",
311
309
  "no-misleading-character-class": "error",
312
310
  "no-multi-str": "error",
@@ -358,10 +356,7 @@ async function javascript(options = {}) {
358
356
  "no-restricted-syntax": [
359
357
  "error",
360
358
  "TSEnumDeclaration[const=true]",
361
- "TSExportAssignment",
362
- "ForInStatement",
363
- "LabeledStatement",
364
- "WithStatement"
359
+ "TSExportAssignment"
365
360
  ],
366
361
  "no-self-assign": ["error", { props: true }],
367
362
  "no-self-compare": "error",
@@ -380,14 +375,17 @@ async function javascript(options = {}) {
380
375
  "no-unreachable-loop": "error",
381
376
  "no-unsafe-finally": "error",
382
377
  "no-unsafe-negation": "error",
383
- "no-unsafe-optional-chaining": "error",
384
378
  "no-unused-expressions": ["error", {
385
379
  allowShortCircuit: true,
386
380
  allowTaggedTemplates: true,
387
381
  allowTernary: true
388
382
  }],
389
- "no-unused-private-class-members": "error",
390
- "no-unused-vars": ["off"],
383
+ "no-unused-vars": ["error", {
384
+ args: "none",
385
+ caughtErrors: "none",
386
+ ignoreRestSiblings: true,
387
+ vars: "all"
388
+ }],
391
389
  "no-use-before-define": ["error", {
392
390
  classes: false,
393
391
  functions: false,
@@ -425,7 +423,6 @@ async function javascript(options = {}) {
425
423
  "prefer-rest-params": "error",
426
424
  "prefer-spread": "error",
427
425
  "prefer-template": "error",
428
- "require-yield": "error",
429
426
  "symbol-description": "error",
430
427
  "unicode-bom": ["error", "never"],
431
428
  "unused-imports/no-unused-imports": is_in_editor_env() ? "warn" : "error",
@@ -447,7 +444,6 @@ async function javascript(options = {}) {
447
444
  }
448
445
  }];
449
446
  }
450
-
451
447
  //#endregion
452
448
  //#region src/utils.ts
453
449
  const scope_url = fileURLToPath(new URL(".", import.meta.url));
@@ -471,15 +467,50 @@ const parser_plain = {
471
467
  visitorKeys: { Program: [] }
472
468
  })
473
469
  };
470
+ /**
471
+ * Combine array and non-array configs into a single array.
472
+ */
474
473
  async function combine(...configs) {
475
474
  return (await Promise.all(configs)).flat();
476
475
  }
476
+ /**
477
+ * Rename plugin prefixes in a rule object.
478
+ * Accepts a map of prefixes to rename.
479
+ *
480
+ * @example
481
+ * ```ts
482
+ * import { rename_rules } from '@ariel-salgado/eslint-config'
483
+ *
484
+ * export default [{
485
+ * rules: rename_rules(
486
+ * {
487
+ * '@typescript-eslint/indent': 'error'
488
+ * },
489
+ * { '@typescript-eslint': 'ts' }
490
+ * )
491
+ * }]
492
+ * ```
493
+ */
477
494
  function rename_rules(rules, map) {
478
495
  return Object.fromEntries(Object.entries(rules).map(([key, value]) => {
479
496
  for (const [from, to] of Object.entries(map)) if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];
480
497
  return [key, value];
481
498
  }));
482
499
  }
500
+ /**
501
+ * Rename plugin names a flat configs array
502
+ *
503
+ * @example
504
+ * ```ts
505
+ * import { rename_plugin_in_configs } from '@antfu/eslint-config'
506
+ * import someConfigs from './some-configs'
507
+ *
508
+ * export default rename_plugin_in_configs(someConfigs, {
509
+ * '@typescript-eslint': 'ts',
510
+ * '@stylistic': 'style',
511
+ * })
512
+ * ```
513
+ */
483
514
  function rename_plugin_in_configs(configs, map) {
484
515
  return configs.map((i) => {
485
516
  const clone = { ...i };
@@ -507,7 +538,6 @@ async function ensure_packages(packages) {
507
538
  if (non_existing_packages.length === 0) return;
508
539
  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
540
  }
510
-
511
541
  //#endregion
512
542
  //#region src/configs/jsdoc.ts
513
543
  async function jsdoc(options = {}) {
@@ -541,7 +571,6 @@ async function jsdoc(options = {}) {
541
571
  }
542
572
  }];
543
573
  }
544
-
545
574
  //#endregion
546
575
  //#region src/configs/jsonc.ts
547
576
  async function jsonc(options = {}) {
@@ -607,46 +636,6 @@ async function jsonc(options = {}) {
607
636
  }
608
637
  }];
609
638
  }
610
-
611
- //#endregion
612
- //#region src/configs/jsx.ts
613
- async function jsx(options = {}) {
614
- const { a11y } = options;
615
- const base_config = {
616
- files: [GLOB_JSX, GLOB_TSX],
617
- languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
618
- name: "ariel/jsx/setup",
619
- plugins: {},
620
- rules: {}
621
- };
622
- if (!a11y) return [base_config];
623
- await ensure_packages(["eslint-plugin-jsx-a11y"]);
624
- const jsx_a11y_plugin = await interop_default(import("eslint-plugin-jsx-a11y"));
625
- const a11y_config = jsx_a11y_plugin.flatConfigs.recommended;
626
- const a11y_rules = {
627
- ...a11y_config.rules || {},
628
- ...typeof a11y === "object" && a11y.overrides ? a11y.overrides : {}
629
- };
630
- return [{
631
- ...base_config,
632
- ...a11y_config,
633
- files: base_config.files,
634
- languageOptions: {
635
- ...base_config.languageOptions,
636
- ...a11y_config.languageOptions
637
- },
638
- name: base_config.name,
639
- plugins: {
640
- ...base_config.plugins,
641
- "jsx-a11y": jsx_a11y_plugin
642
- },
643
- rules: {
644
- ...base_config.rules,
645
- ...a11y_rules
646
- }
647
- }];
648
- }
649
-
650
639
  //#endregion
651
640
  //#region src/configs/markdown.ts
652
641
  async function markdown(options = {}) {
@@ -673,31 +662,18 @@ async function markdown(options = {}) {
673
662
  name: "ariel/markdown/rules",
674
663
  rules: {
675
664
  ...markdown.configs.recommended.at(0)?.rules,
665
+ "markdown/fenced-code-language": "off",
676
666
  "markdown/no-missing-label-refs": "off",
677
667
  ...overridesMarkdown
678
668
  }
679
669
  },
680
- {
681
- files,
682
- name: "ariel/markdown/disables/markdown",
683
- rules: {
684
- "command/command": "off",
685
- "no-irregular-whitespace": "off",
686
- "perfectionist/sort-exports": "off",
687
- "perfectionist/sort-imports": "off",
688
- "regexp/no-legacy-features": "off",
689
- "regexp/no-missing-g-flag": "off",
690
- "regexp/no-useless-dollar-replacements": "off",
691
- "regexp/no-useless-flag": "off",
692
- "style/indent": "off"
693
- }
694
- },
695
670
  {
696
671
  files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
697
672
  languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
698
673
  name: "ariel/markdown/disables/code",
699
674
  rules: {
700
675
  "ariel/no-top-level-await": "off",
676
+ "e18e/prefer-static-regex": "off",
701
677
  "no-alert": "off",
702
678
  "no-console": "off",
703
679
  "no-labels": "off",
@@ -727,53 +703,14 @@ async function markdown(options = {}) {
727
703
  }
728
704
  ];
729
705
  }
730
-
731
706
  //#endregion
732
707
  //#region src/configs/morgan.ts
733
708
  async function morgan() {
734
709
  return [{
735
- name: "ariel/morgan/rules",
736
- plugins: { morgan: plugin_morgan },
737
- rules: {
738
- "morgan/no-negated-conjunction": "error",
739
- "morgan/no-negated-disjunction": "error"
740
- }
741
- }];
742
- }
743
-
744
- //#endregion
745
- //#region src/configs/nextjs.ts
746
- function normalize_rules(rules) {
747
- return Object.fromEntries(Object.entries(rules).map(([key, value]) => [key, typeof value === "string" ? [value] : value]));
748
- }
749
- async function nextjs(options = {}) {
750
- const { files = [GLOB_SRC], overrides = {} } = options;
751
- await ensure_packages(["@next/eslint-plugin-next"]);
752
- const plugin_nextjs = await interop_default(import("@next/eslint-plugin-next"));
753
- function get_rules(name) {
754
- const rules = plugin_nextjs.configs?.[name]?.rules;
755
- if (!rules) throw new Error(`[@ariel-salgado/eslint-config] Failed to find config ${name} in @next/eslint-plugin-next`);
756
- return normalize_rules(rules);
757
- }
758
- return [{
759
- name: "ariel/nextjs/setup",
760
- plugins: { next: plugin_nextjs }
761
- }, {
762
- files,
763
- languageOptions: {
764
- parserOptions: { ecmaFeatures: { jsx: true } },
765
- sourceType: "module"
766
- },
767
- name: "ariel/nextjs/rules",
768
- rules: {
769
- ...get_rules("recommended"),
770
- ...get_rules("core-web-vitals"),
771
- ...overrides
772
- },
773
- settings: { react: { version: "detect" } }
710
+ ...plugin_morgan.configs.recommended,
711
+ name: "ariel/morgan/rules"
774
712
  }];
775
713
  }
776
-
777
714
  //#endregion
778
715
  //#region src/configs/node.ts
779
716
  async function node() {
@@ -789,14 +726,12 @@ async function node() {
789
726
  "node/no-exports-assign": "error",
790
727
  "node/no-new-require": "error",
791
728
  "node/no-path-concat": "error",
792
- "node/no-unsupported-features/es-builtins": "error",
793
729
  "node/prefer-global/buffer": ["error", "never"],
794
- "node/prefer-global/process": "off",
730
+ "node/prefer-global/process": ["error", "never"],
795
731
  "node/process-exit-as-throw": "error"
796
732
  }
797
733
  }];
798
734
  }
799
-
800
735
  //#endregion
801
736
  //#region src/configs/perfectionist.ts
802
737
  async function perfectionist() {
@@ -985,7 +920,6 @@ async function perfectionist() {
985
920
  }
986
921
  }];
987
922
  }
988
-
989
923
  //#endregion
990
924
  //#region src/configs/pnpm.ts
991
925
  async function pnpm(options) {
@@ -1106,204 +1040,10 @@ async function pnpm(options) {
1106
1040
  }
1107
1041
  return configs;
1108
1042
  }
1109
-
1110
- //#endregion
1111
- //#region src/configs/react.ts
1112
- const react_refresh_allow_constant_export_packages = ["vite"];
1113
- const remix_packages = [
1114
- "@remix-run/node",
1115
- "@remix-run/react",
1116
- "@remix-run/serve",
1117
- "@remix-run/dev"
1118
- ];
1119
- const react_router_packages = [
1120
- "@react-router/node",
1121
- "@react-router/react",
1122
- "@react-router/serve",
1123
- "@react-router/dev"
1124
- ];
1125
- const next_js_packages = ["next"];
1126
- const react_compiler_packages = ["babel-plugin-react-compiler"];
1127
- async function react(options = {}) {
1128
- const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, tsconfigPath, reactCompiler = react_compiler_packages.some((i) => isPackageExists(i)) } = options;
1129
- await ensure_packages([
1130
- "@eslint-react/eslint-plugin",
1131
- "eslint-plugin-react-hooks",
1132
- "eslint-plugin-react-refresh"
1133
- ]);
1134
- const is_type_aware = !!tsconfigPath;
1135
- const type_aware_rules = {
1136
- "react/no-leaked-conditional-rendering": "warn",
1137
- "react/no-implicit-key": "error"
1138
- };
1139
- const [plugin_react, plugin_react_hooks, plugin_react_refresh] = await Promise.all([
1140
- interop_default(import("@eslint-react/eslint-plugin")),
1141
- interop_default(import("eslint-plugin-react-hooks")),
1142
- interop_default(import("eslint-plugin-react-refresh"))
1143
- ]);
1144
- const is_allow_constant_export = react_refresh_allow_constant_export_packages.some((i) => isPackageExists(i));
1145
- const is_using_remix = remix_packages.some((i) => isPackageExists(i));
1146
- const is_using_react_router = react_router_packages.some((i) => isPackageExists(i));
1147
- const is_using_next = next_js_packages.some((i) => isPackageExists(i));
1148
- const plugins = plugin_react.configs.all.plugins;
1149
- return [
1150
- {
1151
- name: "ariel/react/setup",
1152
- plugins: {
1153
- "react": plugins["@eslint-react"],
1154
- "react-dom": plugins["@eslint-react/dom"],
1155
- "react-hooks": plugin_react_hooks,
1156
- "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1157
- "react-naming-convention": plugins["@eslint-react/naming-convention"],
1158
- "react-refresh": plugin_react_refresh,
1159
- "react-rsc": plugins["@eslint-react/rsc"],
1160
- "react-web-api": plugins["@eslint-react/web-api"]
1161
- }
1162
- },
1163
- {
1164
- files,
1165
- languageOptions: {
1166
- parserOptions: { ecmaFeatures: { jsx: true } },
1167
- sourceType: "module"
1168
- },
1169
- name: "ariel/react/rules",
1170
- rules: {
1171
- "react/jsx-key-before-spread": "warn",
1172
- "react/jsx-no-comment-textnodes": "warn",
1173
- "react/jsx-no-duplicate-props": "warn",
1174
- "react/jsx-uses-react": "warn",
1175
- "react/jsx-uses-vars": "warn",
1176
- "react/no-access-state-in-setstate": "error",
1177
- "react/no-array-index-key": "warn",
1178
- "react/no-children-count": "warn",
1179
- "react/no-children-for-each": "warn",
1180
- "react/no-children-map": "warn",
1181
- "react/no-children-only": "warn",
1182
- "react/no-children-to-array": "warn",
1183
- "react/no-clone-element": "warn",
1184
- "react/no-component-will-mount": "error",
1185
- "react/no-component-will-receive-props": "error",
1186
- "react/no-component-will-update": "error",
1187
- "react/no-context-provider": "warn",
1188
- "react/no-create-ref": "error",
1189
- "react/no-default-props": "error",
1190
- "react/no-direct-mutation-state": "error",
1191
- "react/no-forward-ref": "warn",
1192
- "react/no-missing-key": "error",
1193
- "react/no-nested-component-definitions": "error",
1194
- "react/no-nested-lazy-component-declarations": "error",
1195
- "react/no-prop-types": "error",
1196
- "react/no-redundant-should-component-update": "error",
1197
- "react/no-set-state-in-component-did-mount": "warn",
1198
- "react/no-set-state-in-component-did-update": "warn",
1199
- "react/no-set-state-in-component-will-update": "warn",
1200
- "react/no-string-refs": "error",
1201
- "react/no-unnecessary-use-prefix": "warn",
1202
- "react/no-unsafe-component-will-mount": "warn",
1203
- "react/no-unsafe-component-will-receive-props": "warn",
1204
- "react/no-unsafe-component-will-update": "warn",
1205
- "react/no-unused-class-component-members": "warn",
1206
- "react/no-use-context": "warn",
1207
- "react/no-useless-forward-ref": "warn",
1208
- "react/prefer-use-state-lazy-initialization": "warn",
1209
- "react/prefer-namespace-import": "error",
1210
- "react-rsc/function-definition": "error",
1211
- "react-dom/no-dangerously-set-innerhtml": "warn",
1212
- "react-dom/no-dangerously-set-innerhtml-with-children": "error",
1213
- "react-dom/no-find-dom-node": "error",
1214
- "react-dom/no-flush-sync": "error",
1215
- "react-dom/no-hydrate": "error",
1216
- "react-dom/no-namespace": "error",
1217
- "react-dom/no-render": "error",
1218
- "react-dom/no-render-return-value": "error",
1219
- "react-dom/no-script-url": "warn",
1220
- "react-dom/no-unsafe-iframe-sandbox": "warn",
1221
- "react-dom/no-use-form-state": "error",
1222
- "react-dom/no-void-elements-with-children": "error",
1223
- "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
1224
- "react-naming-convention/context-name": "warn",
1225
- "react-naming-convention/ref-name": "warn",
1226
- "react-naming-convention/use-state": "warn",
1227
- "react-web-api/no-leaked-event-listener": "warn",
1228
- "react-web-api/no-leaked-interval": "warn",
1229
- "react-web-api/no-leaked-resize-observer": "warn",
1230
- "react-web-api/no-leaked-timeout": "warn",
1231
- "react-hooks/rules-of-hooks": "error",
1232
- "react-hooks/exhaustive-deps": "warn",
1233
- ...reactCompiler ? {
1234
- "react-hooks/config": "error",
1235
- "react-hooks/error-boundaries": "error",
1236
- "react-hooks/component-hook-factories": "error",
1237
- "react-hooks/gating": "error",
1238
- "react-hooks/globals": "error",
1239
- "react-hooks/immutability": "error",
1240
- "react-hooks/preserve-manual-memoization": "error",
1241
- "react-hooks/purity": "error",
1242
- "react-hooks/refs": "error",
1243
- "react-hooks/set-state-in-effect": "error",
1244
- "react-hooks/set-state-in-render": "error",
1245
- "react-hooks/static-components": "error",
1246
- "react-hooks/unsupported-syntax": "warn",
1247
- "react-hooks/use-memo": "error",
1248
- "react-hooks/incompatible-library": "warn"
1249
- } : {},
1250
- "react-refresh/only-export-components": ["error", {
1251
- allowConstantExport: is_allow_constant_export,
1252
- allowExportNames: [...is_using_next ? [
1253
- "dynamic",
1254
- "dynamicParams",
1255
- "revalidate",
1256
- "fetchCache",
1257
- "runtime",
1258
- "preferredRegion",
1259
- "maxDuration",
1260
- "generateStaticParams",
1261
- "metadata",
1262
- "generateMetadata",
1263
- "viewport",
1264
- "generateViewport",
1265
- "generateImageMetadata",
1266
- "generateSitemaps"
1267
- ] : [], ...is_using_remix || is_using_react_router ? [
1268
- "meta",
1269
- "links",
1270
- "headers",
1271
- "loader",
1272
- "action",
1273
- "clientLoader",
1274
- "clientAction",
1275
- "handle",
1276
- "shouldRevalidate"
1277
- ] : []]
1278
- }],
1279
- ...overrides
1280
- }
1281
- },
1282
- {
1283
- files: filesTypeAware,
1284
- name: "ariel/react/typescript",
1285
- rules: {
1286
- "react-dom/no-string-style-prop": "off",
1287
- "react-dom/no-unknown-property": "off",
1288
- "react/jsx-no-duplicate-props": "off",
1289
- "react/jsx-no-undef": "off",
1290
- "react/jsx-uses-react": "off",
1291
- "react/jsx-uses-vars": "off"
1292
- }
1293
- },
1294
- ...is_type_aware ? [{
1295
- files: filesTypeAware,
1296
- ignores: ignoresTypeAware,
1297
- name: "ariel/react/type-aware-rules",
1298
- rules: { ...type_aware_rules }
1299
- }] : []
1300
- ];
1301
- }
1302
-
1303
1043
  //#endregion
1304
1044
  //#region src/configs/regexp.ts
1305
1045
  async function regexp(options = {}) {
1306
- const config = plugin_regexp["flat/recommended"];
1046
+ const config = configs["flat/recommended"];
1307
1047
  const rules = { ...config.rules };
1308
1048
  if (options.level === "warn") {
1309
1049
  for (const key of Object.keys(rules)) if (rules[key] === "error") rules[key] = "warn";
@@ -1317,58 +1057,6 @@ async function regexp(options = {}) {
1317
1057
  }
1318
1058
  }];
1319
1059
  }
1320
-
1321
- //#endregion
1322
- //#region src/configs/solid.ts
1323
- async function solid(options = {}) {
1324
- const { files = [GLOB_JSX, GLOB_TSX], overrides = {}, typescript = true } = options;
1325
- await ensure_packages(["eslint-plugin-solid"]);
1326
- const tsconfig_path = options?.tsconfigPath ? to_array(options.tsconfigPath) : void 0;
1327
- const is_type_aware = !!tsconfig_path;
1328
- const [plugin_solid, parser_ts] = await Promise.all([interop_default(import("eslint-plugin-solid")), interop_default(import("@typescript-eslint/parser"))]);
1329
- return [{
1330
- name: "ariel/solid/setup",
1331
- plugins: { solid: plugin_solid }
1332
- }, {
1333
- files,
1334
- languageOptions: {
1335
- parser: parser_ts,
1336
- parserOptions: {
1337
- ecmaFeatures: { jsx: true },
1338
- ...is_type_aware ? { project: tsconfig_path } : {}
1339
- },
1340
- sourceType: "module"
1341
- },
1342
- name: "ariel/solid/rules",
1343
- rules: {
1344
- "solid/components-return-once": "warn",
1345
- "solid/event-handlers": ["error", {
1346
- ignoreCase: false,
1347
- warnOnSpread: false
1348
- }],
1349
- "solid/imports": "error",
1350
- "solid/jsx-no-duplicate-props": "error",
1351
- "solid/jsx-no-script-url": "error",
1352
- "solid/jsx-no-undef": "error",
1353
- "solid/jsx-uses-vars": "error",
1354
- "solid/no-destructure": "error",
1355
- "solid/no-innerhtml": ["error", { allowStatic: true }],
1356
- "solid/no-react-deps": "error",
1357
- "solid/no-react-specific-props": "error",
1358
- "solid/no-unknown-namespaces": "error",
1359
- "solid/prefer-for": "error",
1360
- "solid/reactivity": "warn",
1361
- "solid/self-closing-comp": "error",
1362
- "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
1363
- ...typescript ? {
1364
- "solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
1365
- "solid/no-unknown-namespaces": "off"
1366
- } : {},
1367
- ...overrides
1368
- }
1369
- }];
1370
- }
1371
-
1372
1060
  //#endregion
1373
1061
  //#region src/configs/sort.ts
1374
1062
  async function sort_package_json() {
@@ -1428,8 +1116,7 @@ async function sort_package_json() {
1428
1116
  "husky",
1429
1117
  "simple-git-hooks",
1430
1118
  "lint-staged",
1431
- "eslintConfig",
1432
- "tsdown"
1119
+ "eslintConfig"
1433
1120
  ],
1434
1121
  pathPattern: "^$"
1435
1122
  },
@@ -1452,8 +1139,8 @@ async function sort_package_json() {
1452
1139
  {
1453
1140
  order: [
1454
1141
  "types",
1455
- "require",
1456
1142
  "import",
1143
+ "require",
1457
1144
  "default"
1458
1145
  ],
1459
1146
  pathPattern: "^exports.*$"
@@ -1477,9 +1164,9 @@ async function sort_package_json() {
1477
1164
  }
1478
1165
  }];
1479
1166
  }
1480
- async function sort_ts_config() {
1167
+ function sort_ts_config() {
1481
1168
  return [{
1482
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1169
+ files: ["**/[jt]sconfig.json", "**/[jt]sconfig.*.json"],
1483
1170
  name: "ariel/sort/tsconfig-json",
1484
1171
  rules: { "jsonc/sort-keys": [
1485
1172
  "error",
@@ -1593,26 +1280,23 @@ async function sort_ts_config() {
1593
1280
  ] }
1594
1281
  }];
1595
1282
  }
1596
-
1597
1283
  //#endregion
1598
1284
  //#region src/configs/stylistic.ts
1599
- const defaults = {
1285
+ const StylisticConfigDefaults = {
1600
1286
  experimental: false,
1601
1287
  indent: "tab",
1602
- jsx: true,
1603
1288
  quotes: "single",
1604
1289
  semi: true
1605
1290
  };
1606
1291
  async function stylistic(options = {}) {
1607
- const { experimental, indent, jsx, overrides = {}, quotes, semi } = {
1608
- ...defaults,
1292
+ const { experimental, indent, overrides = {}, quotes, semi } = {
1293
+ ...StylisticConfigDefaults,
1609
1294
  ...options
1610
1295
  };
1611
1296
  const plugin_stylistic = await interop_default(import("@stylistic/eslint-plugin"));
1612
1297
  const config = plugin_stylistic.configs.customize({
1613
1298
  experimental,
1614
1299
  indent,
1615
- jsx,
1616
1300
  pluginName: "style",
1617
1301
  quotes,
1618
1302
  semi
@@ -1626,9 +1310,10 @@ async function stylistic(options = {}) {
1626
1310
  rules: {
1627
1311
  ...config.rules,
1628
1312
  ...experimental ? {} : { "ariel/consistent-list-newline": "error" },
1313
+ "ariel/consistent-chaining": "error",
1629
1314
  "ariel/curly": "error",
1630
1315
  "ariel/if-newline": "error",
1631
- "ariel/consistent-chaining": "error",
1316
+ "ariel/top-level-function": "error",
1632
1317
  "style/generator-star-spacing": ["error", {
1633
1318
  after: true,
1634
1319
  before: false
@@ -1641,7 +1326,6 @@ async function stylistic(options = {}) {
1641
1326
  }
1642
1327
  }];
1643
1328
  }
1644
-
1645
1329
  //#endregion
1646
1330
  //#region src/configs/svelte.ts
1647
1331
  async function svelte(options = {}) {
@@ -1673,26 +1357,10 @@ async function svelte(options = {}) {
1673
1357
  vars: "all",
1674
1358
  varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1675
1359
  }],
1676
- "svelte/comment-directive": "error",
1677
- "svelte/no-at-debug-tags": "warn",
1678
- "svelte/no-at-html-tags": "error",
1679
- "svelte/no-dupe-else-if-blocks": "error",
1680
- "svelte/no-dupe-style-properties": "error",
1681
- "svelte/no-dupe-use-directives": "error",
1682
- "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1683
- "svelte/no-inner-declarations": "error",
1684
- "svelte/no-not-function-handler": "error",
1685
- "svelte/no-object-in-text-mustaches": "error",
1686
- "svelte/no-reactive-functions": "error",
1687
- "svelte/no-reactive-literals": "error",
1688
- "svelte/no-shorthand-style-property-overrides": "error",
1689
- "svelte/no-unknown-style-directive-property": "error",
1690
- "svelte/no-unused-svelte-ignore": "error",
1691
- "svelte/no-useless-mustaches": "error",
1692
- "svelte/require-store-callbacks-use-set-param": "error",
1693
- "svelte/sort-attributes": "error",
1694
- "svelte/system": "error",
1695
- "svelte/valid-each-key": "error",
1360
+ ...plugin_svelte.configs.recommended.map((config) => config.rules).reduce((acc, rules) => ({
1361
+ ...acc,
1362
+ ...rules
1363
+ }), {}),
1696
1364
  "unused-imports/no-unused-vars": ["error", {
1697
1365
  args: "after-used",
1698
1366
  argsIgnorePattern: "^_",
@@ -1704,7 +1372,7 @@ async function svelte(options = {}) {
1704
1372
  "style/no-trailing-spaces": "off",
1705
1373
  "svelte/derived-has-same-inputs-outputs": "error",
1706
1374
  "svelte/html-closing-bracket-spacing": "error",
1707
- "svelte/html-quotes": ["error", { prefer: quotes === "backtick" ? "single" : quotes }],
1375
+ "svelte/html-quotes": ["error", { prefer: quotes === "backtick" ? "double" : quotes }],
1708
1376
  "svelte/indent": ["error", {
1709
1377
  alignAttributesVertically: true,
1710
1378
  indent: typeof indent === "number" ? indent : indent === "tab" ? "tab" : 2
@@ -1718,24 +1386,23 @@ async function svelte(options = {}) {
1718
1386
  }
1719
1387
  }];
1720
1388
  }
1721
-
1722
1389
  //#endregion
1723
1390
  //#region src/configs/tailwindcss.ts
1724
1391
  async function tailwindcss(options = {}) {
1725
- const { files = [
1726
- GLOB_SVELTE,
1727
- GLOB_JSX,
1728
- GLOB_TSX
1729
- ], overrides = {}, entryPoint = "src/app.css", printWidth = 100, stylistic = true } = options;
1392
+ const { files = [GLOB_SVELTE], overrides = {}, entryPoint = "src/app.css", printWidth = 100, stylistic = true, cwd = "." } = options;
1730
1393
  const { indent = "tab" } = typeof stylistic === "boolean" ? {} : stylistic;
1731
- await ensure_packages(["eslint-plugin-better-tailwindcss"]);
1394
+ const packages_to_ensure = ["eslint-plugin-better-tailwindcss"];
1395
+ if (has_svelte()) packages_to_ensure.push("svelte-eslint-parser");
1396
+ await ensure_packages(packages_to_ensure);
1732
1397
  const plugin_tailwindcss = await interop_default(import("eslint-plugin-better-tailwindcss"));
1398
+ const svelte_eslint_parser = has_svelte() ? await interop_default(import("svelte-eslint-parser")) : null;
1733
1399
  return [{
1734
1400
  name: "ariel/tailwindcss/setup",
1735
1401
  plugins: { tailwindcss: plugin_tailwindcss }
1736
1402
  }, {
1737
1403
  files,
1738
1404
  name: "ariel/tailwindcss/rules",
1405
+ ...has_svelte() && { languageOptions: { parser: svelte_eslint_parser } },
1739
1406
  rules: {
1740
1407
  ...plugin_tailwindcss.configs.recommended.rules,
1741
1408
  "tailwindcss/enforce-consistent-line-wrapping": ["error", {
@@ -1747,12 +1414,15 @@ async function tailwindcss(options = {}) {
1747
1414
  "tailwindcss/enforce-shorthand-classes": "error",
1748
1415
  "tailwindcss/no-deprecated-classes": "error",
1749
1416
  "tailwindcss/no-unknown-classes": ["error", { detectComponentClasses: true }],
1417
+ "tailwindcss/enforce-consistent-variant-order": "error",
1750
1418
  ...overrides
1751
1419
  },
1752
- settings: { "better-tailwindcss": { entryPoint } }
1420
+ settings: { "better-tailwindcss": {
1421
+ entryPoint,
1422
+ cwd
1423
+ } }
1753
1424
  }];
1754
1425
  }
1755
-
1756
1426
  //#endregion
1757
1427
  //#region src/configs/test.ts
1758
1428
  let _plugin_test;
@@ -1783,6 +1453,7 @@ async function test(options = {}) {
1783
1453
  "test/prefer-hooks-in-order": "error",
1784
1454
  "test/prefer-lowercase-title": "error",
1785
1455
  "ariel/no-top-level-await": "off",
1456
+ "e18e/prefer-static-regex": "off",
1786
1457
  "no-unused-expressions": "off",
1787
1458
  "node/prefer-global/process": "off",
1788
1459
  "ts/explicit-function-return-type": "off",
@@ -1790,7 +1461,6 @@ async function test(options = {}) {
1790
1461
  }
1791
1462
  }];
1792
1463
  }
1793
-
1794
1464
  //#endregion
1795
1465
  //#region src/configs/toml.ts
1796
1466
  async function toml(options = {}) {
@@ -1830,18 +1500,13 @@ async function toml(options = {}) {
1830
1500
  }
1831
1501
  }];
1832
1502
  }
1833
-
1834
1503
  //#endregion
1835
1504
  //#region src/configs/typescript.ts
1836
1505
  async function typescript(options = {}) {
1837
- const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
1838
- const files = options.files ?? [
1839
- GLOB_TS,
1840
- GLOB_JSX,
1841
- ...componentExts.map((ext) => `**/*.${ext}`)
1842
- ];
1843
- const files_type_aware = options.filesTypeAware ?? [GLOB_TS, GLOB_JSX];
1844
- const ignores_type_aware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`];
1506
+ const { componentExts = [], erasableOnly = false, overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
1507
+ const files = options.files ?? ["**/*.?([cm])ts", ...componentExts.map((ext) => `**/*.${ext}`)];
1508
+ const files_type_aware = options.filesTypeAware ?? ["**/*.?([cm])ts"];
1509
+ const ignores_type_aware = options.ignoresTypeAware ?? [`**/*.md/**`];
1845
1510
  const tsconfig_path = options?.tsconfigPath ? options.tsconfigPath : void 0;
1846
1511
  const is_type_aware = !!tsconfig_path;
1847
1512
  const type_aware_rules = {
@@ -1871,7 +1536,7 @@ async function typescript(options = {}) {
1871
1536
  "ts/unbound-method": "error"
1872
1537
  };
1873
1538
  const [plugin_ts, parser_ts] = await Promise.all([interop_default(import("@typescript-eslint/eslint-plugin")), interop_default(import("@typescript-eslint/parser"))]);
1874
- function make_parser(type_aware, files, ignores) {
1539
+ function make_parser(typeAware, files, ignores) {
1875
1540
  return {
1876
1541
  files,
1877
1542
  ...ignores ? { ignores } : {},
@@ -1880,17 +1545,17 @@ async function typescript(options = {}) {
1880
1545
  parserOptions: {
1881
1546
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1882
1547
  sourceType: "module",
1883
- ...type_aware ? {
1548
+ ...typeAware ? {
1884
1549
  projectService: {
1885
1550
  allowDefaultProject: ["./*.js"],
1886
1551
  defaultProject: tsconfig_path
1887
1552
  },
1888
- tsconfigRootDir: process$1.cwd()
1553
+ tsconfigRootDir: process.cwd()
1889
1554
  } : {},
1890
1555
  ...parserOptions
1891
1556
  }
1892
1557
  },
1893
- name: `ariel/typescript/${type_aware ? "type-aware-parser" : "parser"}`
1558
+ name: `ariel/typescript/${typeAware ? "type-aware-parser" : "parser"}`
1894
1559
  };
1895
1560
  }
1896
1561
  return [
@@ -1911,7 +1576,7 @@ async function typescript(options = {}) {
1911
1576
  "no-dupe-class-members": "off",
1912
1577
  "no-redeclare": "off",
1913
1578
  "no-use-before-define": "off",
1914
- "no-useless-constructor": "error",
1579
+ "no-useless-constructor": "off",
1915
1580
  "ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
1916
1581
  "ts/consistent-type-definitions": ["error", "interface"],
1917
1582
  "ts/consistent-type-imports": ["error", {
@@ -1961,10 +1626,19 @@ async function typescript(options = {}) {
1961
1626
  ...type_aware_rules,
1962
1627
  ...overridesTypeAware
1963
1628
  }
1629
+ }] : [],
1630
+ ...erasableOnly ? [{
1631
+ name: "ariel/typescript/erasable-syntax-only",
1632
+ plugins: { "erasable-syntax-only": await interop_default(import("./lib-Dbi8MGGA.mjs")) },
1633
+ rules: {
1634
+ "erasable-syntax-only/enums": "error",
1635
+ "erasable-syntax-only/import-aliases": "error",
1636
+ "erasable-syntax-only/namespaces": "error",
1637
+ "erasable-syntax-only/parameter-properties": "error"
1638
+ }
1964
1639
  }] : []
1965
1640
  ];
1966
1641
  }
1967
-
1968
1642
  //#endregion
1969
1643
  //#region src/configs/unicorn.ts
1970
1644
  async function unicorn(options = {}) {
@@ -1975,27 +1649,13 @@ async function unicorn(options = {}) {
1975
1649
  rules: {
1976
1650
  ...allRecommended ? plugin_unicorn.configs.recommended.rules : {
1977
1651
  "unicorn/consistent-empty-array-spread": "error",
1978
- "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
1979
- "unicorn/custom-error-definition": "error",
1980
- "unicorn/filename-case": ["error", {
1981
- cases: {
1982
- kebabCase: true,
1983
- pascalCase: true
1984
- },
1985
- ignore: [/^[A-Z]+\..*$/, /import_map\.json/]
1986
- }],
1987
1652
  "unicorn/error-message": "error",
1988
1653
  "unicorn/escape-case": "error",
1989
1654
  "unicorn/new-for-builtins": "error",
1990
1655
  "unicorn/no-instanceof-builtins": "error",
1991
1656
  "unicorn/no-new-array": "error",
1992
1657
  "unicorn/no-new-buffer": "error",
1993
- "unicorn/no-useless-undefined": ["error", {
1994
- checkArguments: false,
1995
- checkArrowFunctionBody: false
1996
- }],
1997
1658
  "unicorn/number-literal-case": "error",
1998
- "unicorn/prefer-classlist-toggle": "error",
1999
1659
  "unicorn/prefer-dom-node-text-content": "error",
2000
1660
  "unicorn/prefer-includes": "error",
2001
1661
  "unicorn/prefer-node-protocol": "error",
@@ -2008,7 +1668,6 @@ async function unicorn(options = {}) {
2008
1668
  }
2009
1669
  }];
2010
1670
  }
2011
-
2012
1671
  //#endregion
2013
1672
  //#region src/configs/yaml.ts
2014
1673
  async function yaml(options = {}) {
@@ -2037,7 +1696,7 @@ async function yaml(options = {}) {
2037
1696
  "yaml/flow-mapping-curly-spacing": "error",
2038
1697
  "yaml/flow-sequence-bracket-newline": "error",
2039
1698
  "yaml/flow-sequence-bracket-spacing": "error",
2040
- "yaml/indent": ["error", typeof indent === "number" ? indent : indent === "tab" ? "tab" : 2],
1699
+ "yaml/indent": ["error", typeof indent === "number" ? indent : 2],
2041
1700
  "yaml/key-spacing": "error",
2042
1701
  "yaml/no-tab-indent": "error",
2043
1702
  "yaml/quotes": ["error", {
@@ -2050,7 +1709,6 @@ async function yaml(options = {}) {
2050
1709
  }
2051
1710
  }];
2052
1711
  }
2053
-
2054
1712
  //#endregion
2055
1713
  //#region src/factory.ts
2056
1714
  const flat_config_props = [
@@ -2063,14 +1721,9 @@ const flat_config_props = [
2063
1721
  "settings"
2064
1722
  ];
2065
1723
  const default_plugin_renaming = {
2066
- "@eslint-react": "react",
2067
- "@eslint-react/dom": "react-dom",
2068
- "@eslint-react/hooks-extra": "react-hooks-extra",
2069
- "@eslint-react/naming-convention": "react-naming-convention",
2070
- "@next/next": "next",
1724
+ "better-tailwindcss": "tailwindcss",
2071
1725
  "@stylistic": "style",
2072
1726
  "@typescript-eslint": "ts",
2073
- "better-tailwindcss": "tailwindcss",
2074
1727
  "import-lite": "import",
2075
1728
  "n": "node",
2076
1729
  "vitest": "test",
@@ -2087,61 +1740,46 @@ const default_plugin_renaming = {
2087
1740
  * The merged ESLint configurations.
2088
1741
  */
2089
1742
  function defineConfig(options = {}, ...userConfigs) {
2090
- 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;
1743
+ const { autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, node: enableNode = true, pnpm: enableCatalogs = has_pnpm_catalogs(), regexp: enableRegexp = true, svelte: enableSvelte = has_svelte(), tailwindcss: enableTailwindcss = has_tailwindcss(), type: appType = "app", typescript: enableTypeScript = has_typescript(), unicorn: enableUnicorn = true } = options;
2091
1744
  const is_in_editor = is_in_editor_env();
2092
- if (is_in_editor) console.log("[@ariel-salgado/eslint-config] Detected running in editor, some rules are disabled.");
2093
1745
  const stylistic_options = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2094
- if (stylistic_options && !("jsx" in stylistic_options)) stylistic_options.jsx = typeof enable_jsx === "object" ? true : enable_jsx;
2095
1746
  const configs = [];
2096
- if (enable_git_ignore) if (typeof enable_git_ignore !== "boolean") configs.push(interop_default(import("eslint-config-flat-gitignore")).then((r) => [r({
1747
+ if (enableGitignore) if (typeof enableGitignore !== "boolean") configs.push(interop_default(import("eslint-config-flat-gitignore")).then((r) => [r({
2097
1748
  name: "ariel/gitignore",
2098
- ...enable_git_ignore
1749
+ ...enableGitignore
2099
1750
  })]));
2100
1751
  else configs.push(interop_default(import("eslint-config-flat-gitignore")).then((r) => [r({
2101
1752
  name: "ariel/gitignore",
2102
1753
  strict: false
2103
1754
  })]));
2104
1755
  const typescript_options = resolve_sub_options(options, "typescript");
2105
- const tsconfig_path = "tsconfigPath" in typescript_options ? typescript_options.tsconfigPath : void 0;
2106
- configs.push(ignores(user_ignores), javascript({ overrides: get_overrides(options, "javascript") }), comments(), perfectionist(), morgan());
2107
- if (enable_node) configs.push(node());
2108
- if (enable_jsdoc) configs.push(jsdoc({ stylistic: stylistic_options }));
2109
- if (enable_imports) configs.push(imports({
1756
+ configs.push(ignores(userIgnores, !enableTypeScript), javascript({ overrides: get_overrides(options, "javascript") }), comments(), perfectionist(), morgan());
1757
+ if (enableNode) configs.push(node());
1758
+ if (enableJsdoc) configs.push(jsdoc({ stylistic: stylistic_options }));
1759
+ if (enableImports) configs.push(imports({
2110
1760
  stylistic: stylistic_options,
2111
1761
  ...resolve_sub_options(options, "imports")
2112
1762
  }));
2113
- if (enable_unicorn) configs.push(unicorn(enable_unicorn === true ? {} : enable_unicorn));
2114
- if (enable_jsx) configs.push(jsx(enable_jsx === true ? {} : enable_jsx));
2115
- if (enable_typescript) configs.push(typescript({
1763
+ if (enableE18e) configs.push(e18e({ ...enableE18e === true ? {} : enableE18e }));
1764
+ if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
1765
+ if (enableTypeScript) configs.push(typescript({
2116
1766
  ...typescript_options,
2117
1767
  componentExts,
2118
1768
  overrides: get_overrides(options, "typescript"),
2119
- type: options.type
1769
+ type: appType
2120
1770
  }));
2121
1771
  if (stylistic_options) configs.push(stylistic({
2122
1772
  ...stylistic_options,
2123
1773
  overrides: get_overrides(options, "stylistic")
2124
1774
  }));
2125
- if (enable_regexp) configs.push(regexp(typeof enable_regexp === "boolean" ? {} : enable_regexp));
1775
+ if (enableRegexp) configs.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
2126
1776
  if (options.test ?? true) configs.push(test({ overrides: get_overrides(options, "test") }));
2127
- if (enable_react) configs.push(react({
2128
- ...typescript_options,
2129
- ...resolve_sub_options(options, "react"),
2130
- overrides: get_overrides(options, "react"),
2131
- tsconfigPath: tsconfig_path
2132
- }));
2133
- if (enable_nextjs) configs.push(nextjs({ overrides: get_overrides(options, "nextjs") }));
2134
- if (enable_solid) configs.push(solid({
2135
- overrides: get_overrides(options, "solid"),
2136
- tsconfigPath: tsconfig_path,
2137
- typescript: !!enable_typescript
2138
- }));
2139
- if (enable_svelte) configs.push(svelte({
1777
+ if (enableSvelte) configs.push(svelte({
2140
1778
  overrides: get_overrides(options, "svelte"),
2141
1779
  stylistic: stylistic_options,
2142
- typescript: !!enable_typescript
1780
+ typescript: !!enableTypeScript
2143
1781
  }));
2144
- if (enable_tailwindcss) configs.push(tailwindcss({
1782
+ if (enableTailwindcss) configs.push(tailwindcss({
2145
1783
  overrides: get_overrides(options, "tailwindcss"),
2146
1784
  stylistic: stylistic_options
2147
1785
  }));
@@ -2149,11 +1787,14 @@ function defineConfig(options = {}, ...userConfigs) {
2149
1787
  overrides: get_overrides(options, "jsonc"),
2150
1788
  stylistic: stylistic_options
2151
1789
  }), sort_package_json(), sort_ts_config());
2152
- if (enable_catalogs) configs.push(pnpm({
2153
- json: options.jsonc !== false,
2154
- yaml: options.yaml !== false,
2155
- ...resolve_sub_options(options, "pnpm")
2156
- }));
1790
+ if (enableCatalogs) {
1791
+ const optionsPnpm = resolve_sub_options(options, "pnpm");
1792
+ configs.push(pnpm({
1793
+ json: options.jsonc !== false,
1794
+ yaml: options.yaml !== false,
1795
+ ...optionsPnpm
1796
+ }));
1797
+ }
2157
1798
  if (options.yaml ?? true) configs.push(yaml({
2158
1799
  overrides: get_overrides(options, "yaml"),
2159
1800
  stylistic: stylistic_options
@@ -2168,13 +1809,14 @@ function defineConfig(options = {}, ...userConfigs) {
2168
1809
  }));
2169
1810
  configs.push(disables());
2170
1811
  if ("files" in options) throw new Error("[@ariel-salgado/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.");
2171
- const merged_config = flat_config_props.reduce((acc, key) => {
1812
+ const fused_config = flat_config_props.reduce((acc, key) => {
2172
1813
  if (key in options) acc[key] = options[key];
2173
1814
  return acc;
2174
1815
  }, {});
2175
- if (Object.keys(merged_config).length) configs.push([merged_config]);
1816
+ if (Object.keys(fused_config).length) configs.push([fused_config]);
2176
1817
  let composer = new FlatConfigComposer();
2177
1818
  composer = composer.append(...configs, ...userConfigs);
1819
+ if (options.markdown ?? true) composer = composer.append({ ignores: [GLOB_MARKDOWN] });
2178
1820
  if (autoRenamePlugins) composer = composer.renamePlugins(default_plugin_renaming);
2179
1821
  if (is_in_editor) composer = composer.disableRulesFix([
2180
1822
  "unused-imports/no-unused-imports",
@@ -2193,10 +1835,48 @@ function get_overrides(options, key) {
2193
1835
  ..."overrides" in sub ? sub.overrides : {}
2194
1836
  };
2195
1837
  }
2196
-
1838
+ //#endregion
1839
+ //#region src/presets.ts
1840
+ const PRESET_FULL_ON = {
1841
+ gitignore: true,
1842
+ imports: true,
1843
+ jsdoc: true,
1844
+ jsonc: true,
1845
+ markdown: true,
1846
+ node: true,
1847
+ pnpm: true,
1848
+ regexp: true,
1849
+ stylistic: { experimental: true },
1850
+ svelte: true,
1851
+ tailwindcss: true,
1852
+ test: true,
1853
+ toml: true,
1854
+ typescript: { tsconfigPath: "tsconfig.json" },
1855
+ e18e: true,
1856
+ unicorn: true,
1857
+ yaml: true
1858
+ };
1859
+ const PRESET_FULL_OFF = {
1860
+ gitignore: false,
1861
+ imports: false,
1862
+ jsdoc: false,
1863
+ jsonc: false,
1864
+ markdown: false,
1865
+ node: false,
1866
+ pnpm: false,
1867
+ regexp: false,
1868
+ stylistic: false,
1869
+ svelte: false,
1870
+ tailwindcss: false,
1871
+ test: false,
1872
+ toml: false,
1873
+ typescript: false,
1874
+ e18e: false,
1875
+ unicorn: false,
1876
+ yaml: false
1877
+ };
2197
1878
  //#endregion
2198
1879
  //#region src/index.ts
2199
1880
  var src_default = defineConfig;
2200
-
2201
1881
  //#endregion
2202
- 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 };
1882
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, 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_XML, GLOB_YAML, PRESET_FULL_OFF, PRESET_FULL_ON, StylisticConfigDefaults, combine, comments, src_default as default, default_plugin_renaming, defineConfig, disables, e18e, ensure_packages, get_overrides, ignores, imports, interop_default, is_package_in_scope, javascript, jsdoc, jsonc, markdown, morgan, node, parser_plain, perfectionist, pnpm, regexp, rename_plugin_in_configs, rename_rules, resolve_sub_options, sort_package_json, sort_ts_config, stylistic, svelte, tailwindcss, test, to_array, toml, typescript, unicorn, yaml };