@ariel-salgado/eslint-config 0.5.0 → 1.0.1

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 { findUp } from "find-up-simple";
3
3
  import plugin_e18e from "@e18e/eslint-plugin";
4
4
  import plugin_comments from "@eslint-community/eslint-plugin-eslint-comments";
5
5
  import "eslint-config-flat-gitignore";
@@ -8,10 +8,10 @@ import plugin_morgan from "eslint-plugin-de-morgan";
8
8
  import plugin_import from "eslint-plugin-import-lite";
9
9
  import plugin_node from "eslint-plugin-n";
10
10
  import plugin_perfectionist from "eslint-plugin-perfectionist";
11
- import { configs as plugin_regexp } from "eslint-plugin-regexp";
11
+ import { configs } from "eslint-plugin-regexp";
12
12
  import plugin_unicorn from "eslint-plugin-unicorn";
13
13
  import plugin_unused_imports from "eslint-plugin-unused-imports";
14
- import process$1 from "node:process";
14
+ import process from "node:process";
15
15
  import { readFile } from "node:fs/promises";
16
16
  import { isPackageExists } from "local-pkg";
17
17
  import globals from "globals";
@@ -35,9 +35,7 @@ async function comments() {
35
35
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
36
36
  const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
37
37
  const GLOB_JS = "**/*.?([cm])js";
38
- const GLOB_JSX = "**/*.?([cm])jsx";
39
38
  const GLOB_TS = "**/*.?([cm])ts";
40
- const GLOB_TSX = "**/*.?([cm])tsx";
41
39
  const GLOB_STYLE = "**/*.{c,le,sc}ss";
42
40
  const GLOB_CSS = "**/*.css";
43
41
  const GLOB_POSTCSS = "**/*.{p,post}css";
@@ -140,22 +138,13 @@ async function disables() {
140
138
  //#endregion
141
139
  //#region src/env.ts
142
140
  function has_typescript() {
143
- return isPackageExists("typescript");
141
+ return isPackageExists("typescript") || isPackageExists("@typescript/native-preview");
144
142
  }
145
143
  function has_svelte() {
146
- return isPackageExists("svelte") || isPackageExists("@sveltejs/kit");
144
+ return isPackageExists("svelte");
147
145
  }
148
146
  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");
147
+ return isPackageExists("tailwindcss");
159
148
  }
160
149
  async function has_pnpm_catalogs() {
161
150
  const workspace_file = await findUp("pnpm-workspace.yaml");
@@ -164,17 +153,17 @@ async function has_pnpm_catalogs() {
164
153
  return yaml.includes("catalog:") || yaml.includes("catalogs:");
165
154
  }
166
155
  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"));
156
+ return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
168
157
  }
169
158
  function is_in_editor_env() {
170
- if (process$1.env.CI) return false;
159
+ if (process.env.CI) return false;
171
160
  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);
161
+ return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
173
162
  }
174
163
  //#endregion
175
164
  //#region src/configs/e18e.ts
176
165
  async function e18e(options = {}) {
177
- const { modernization = true, moduleReplacements = is_in_editor_env(), overrides = {}, performanceImprovements = true } = options;
166
+ const { modernization = true, type = "app", moduleReplacements = type === "lib" && is_in_editor_env(), overrides = {}, performanceImprovements = true } = options;
178
167
  const configs = plugin_e18e.configs;
179
168
  return [{
180
169
  name: "ariel/e18e/rules",
@@ -183,14 +172,23 @@ async function e18e(options = {}) {
183
172
  ...modernization ? { ...configs.modernization.rules } : {},
184
173
  ...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
185
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"] }],
186
183
  ...overrides
187
184
  }
188
185
  }];
189
186
  }
190
187
  //#endregion
191
188
  //#region src/configs/ignores.ts
192
- async function ignores(userIgnores = []) {
189
+ async function ignores(userIgnores = [], ignoreTypeScript = false) {
193
190
  let ignores = [...GLOB_EXCLUDE];
191
+ if (ignoreTypeScript) ignores.push(GLOB_TS);
194
192
  if (typeof userIgnores === "function") ignores = userIgnores(ignores);
195
193
  else ignores = [...ignores, ...userIgnores];
196
194
  return [{
@@ -217,7 +215,6 @@ async function imports(options = {}) {
217
215
  "import/no-duplicates": "error",
218
216
  "import/no-mutable-exports": "error",
219
217
  "import/no-named-default": "error",
220
- "import/no-default-export": "off",
221
218
  ...stylistic ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
222
219
  ...overrides
223
220
  }
@@ -232,7 +229,7 @@ async function javascript(options = {}) {
232
229
  ecmaVersion: "latest",
233
230
  globals: {
234
231
  ...globals.browser,
235
- ...globals.es2026,
232
+ ...globals.es2021,
236
233
  ...globals.node,
237
234
  document: "readonly",
238
235
  navigator: "readonly",
@@ -258,14 +255,13 @@ async function javascript(options = {}) {
258
255
  enforceForClassMembers: true,
259
256
  setWithoutGet: true
260
257
  }],
261
- "ariel/prefer-for-of": "warn",
258
+ "ariel/no-top-level-await": "error",
262
259
  "array-callback-return": "error",
263
260
  "block-scoped-var": "error",
264
261
  "constructor-super": "error",
265
262
  "default-case-last": "error",
266
263
  "dot-notation": ["error", { allowKeywords: true }],
267
264
  "eqeqeq": ["error", "smart"],
268
- "for-direction": "error",
269
265
  "new-cap": ["error", {
270
266
  capIsNew: false,
271
267
  newIsCap: true,
@@ -279,14 +275,8 @@ async function javascript(options = {}) {
279
275
  "no-class-assign": "error",
280
276
  "no-compare-neg-zero": "error",
281
277
  "no-cond-assign": ["error", "always"],
282
- "no-console": ["warn", { allow: [
283
- "warn",
284
- "error",
285
- "info",
286
- "clear"
287
- ] }],
278
+ "no-console": ["error", { allow: ["warn", "error"] }],
288
279
  "no-const-assign": "error",
289
- "no-constant-binary-expression": "error",
290
280
  "no-control-regex": "error",
291
281
  "no-debugger": "error",
292
282
  "no-delete-var": "error",
@@ -294,7 +284,6 @@ async function javascript(options = {}) {
294
284
  "no-dupe-class-members": "error",
295
285
  "no-dupe-keys": "error",
296
286
  "no-duplicate-case": "error",
297
- "no-duplicate-imports": "off",
298
287
  "no-empty": ["error", { allowEmptyCatch: true }],
299
288
  "no-empty-character-class": "error",
300
289
  "no-empty-pattern": "error",
@@ -316,7 +305,6 @@ async function javascript(options = {}) {
316
305
  allowSwitch: false
317
306
  }],
318
307
  "no-lone-blocks": "error",
319
- "no-lonely-if": "error",
320
308
  "no-loss-of-precision": "error",
321
309
  "no-misleading-character-class": "error",
322
310
  "no-multi-str": "error",
@@ -368,10 +356,7 @@ async function javascript(options = {}) {
368
356
  "no-restricted-syntax": [
369
357
  "error",
370
358
  "TSEnumDeclaration[const=true]",
371
- "TSExportAssignment",
372
- "ForInStatement",
373
- "LabeledStatement",
374
- "WithStatement"
359
+ "TSExportAssignment"
375
360
  ],
376
361
  "no-self-assign": ["error", { props: true }],
377
362
  "no-self-compare": "error",
@@ -390,14 +375,17 @@ async function javascript(options = {}) {
390
375
  "no-unreachable-loop": "error",
391
376
  "no-unsafe-finally": "error",
392
377
  "no-unsafe-negation": "error",
393
- "no-unsafe-optional-chaining": "error",
394
378
  "no-unused-expressions": ["error", {
395
379
  allowShortCircuit: true,
396
380
  allowTaggedTemplates: true,
397
381
  allowTernary: true
398
382
  }],
399
- "no-unused-private-class-members": "error",
400
- "no-unused-vars": ["off"],
383
+ "no-unused-vars": ["error", {
384
+ args: "none",
385
+ caughtErrors: "none",
386
+ ignoreRestSiblings: true,
387
+ vars: "all"
388
+ }],
401
389
  "no-use-before-define": ["error", {
402
390
  classes: false,
403
391
  functions: false,
@@ -435,7 +423,6 @@ async function javascript(options = {}) {
435
423
  "prefer-rest-params": "error",
436
424
  "prefer-spread": "error",
437
425
  "prefer-template": "error",
438
- "require-yield": "error",
439
426
  "symbol-description": "error",
440
427
  "unicode-bom": ["error", "never"],
441
428
  "unused-imports/no-unused-imports": is_in_editor_env() ? "warn" : "error",
@@ -480,15 +467,50 @@ const parser_plain = {
480
467
  visitorKeys: { Program: [] }
481
468
  })
482
469
  };
470
+ /**
471
+ * Combine array and non-array configs into a single array.
472
+ */
483
473
  async function combine(...configs) {
484
474
  return (await Promise.all(configs)).flat();
485
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
+ */
486
494
  function rename_rules(rules, map) {
487
495
  return Object.fromEntries(Object.entries(rules).map(([key, value]) => {
488
496
  for (const [from, to] of Object.entries(map)) if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];
489
497
  return [key, value];
490
498
  }));
491
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
+ */
492
514
  function rename_plugin_in_configs(configs, map) {
493
515
  return configs.map((i) => {
494
516
  const clone = { ...i };
@@ -615,44 +637,6 @@ async function jsonc(options = {}) {
615
637
  }];
616
638
  }
617
639
  //#endregion
618
- //#region src/configs/jsx.ts
619
- async function jsx(options = {}) {
620
- const { a11y } = options;
621
- const base_config = {
622
- files: [GLOB_JSX, GLOB_TSX],
623
- languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
624
- name: "ariel/jsx/setup",
625
- plugins: {},
626
- rules: {}
627
- };
628
- if (!a11y) return [base_config];
629
- await ensure_packages(["eslint-plugin-jsx-a11y"]);
630
- const jsx_a11y_plugin = await interop_default(import("eslint-plugin-jsx-a11y"));
631
- const a11y_config = jsx_a11y_plugin.flatConfigs.recommended;
632
- const a11y_rules = {
633
- ...a11y_config.rules || {},
634
- ...typeof a11y === "object" && a11y.overrides ? a11y.overrides : {}
635
- };
636
- return [{
637
- ...base_config,
638
- ...a11y_config,
639
- files: base_config.files,
640
- languageOptions: {
641
- ...base_config.languageOptions,
642
- ...a11y_config.languageOptions
643
- },
644
- name: base_config.name,
645
- plugins: {
646
- ...base_config.plugins,
647
- "jsx-a11y": jsx_a11y_plugin
648
- },
649
- rules: {
650
- ...base_config.rules,
651
- ...a11y_rules
652
- }
653
- }];
654
- }
655
- //#endregion
656
640
  //#region src/configs/markdown.ts
657
641
  async function markdown(options = {}) {
658
642
  const { componentExts = [], files = [GLOB_MARKDOWN], gfm = true, overrides = {}, overridesMarkdown = {} } = options;
@@ -683,27 +667,13 @@ async function markdown(options = {}) {
683
667
  ...overridesMarkdown
684
668
  }
685
669
  },
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
- },
701
670
  {
702
671
  files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
703
672
  languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
704
673
  name: "ariel/markdown/disables/code",
705
674
  rules: {
706
675
  "ariel/no-top-level-await": "off",
676
+ "e18e/prefer-static-regex": "off",
707
677
  "no-alert": "off",
708
678
  "no-console": "off",
709
679
  "no-labels": "off",
@@ -737,44 +707,8 @@ async function markdown(options = {}) {
737
707
  //#region src/configs/morgan.ts
738
708
  async function morgan() {
739
709
  return [{
740
- name: "ariel/morgan/rules",
741
- plugins: { morgan: plugin_morgan },
742
- rules: {
743
- "morgan/no-negated-conjunction": "error",
744
- "morgan/no-negated-disjunction": "error"
745
- }
746
- }];
747
- }
748
- //#endregion
749
- //#region src/configs/nextjs.ts
750
- function normalize_rules(rules) {
751
- return Object.fromEntries(Object.entries(rules).map(([key, value]) => [key, typeof value === "string" ? [value] : value]));
752
- }
753
- async function nextjs(options = {}) {
754
- const { files = [GLOB_SRC], overrides = {} } = options;
755
- await ensure_packages(["@next/eslint-plugin-next"]);
756
- const plugin_nextjs = await interop_default(import("@next/eslint-plugin-next"));
757
- function get_rules(name) {
758
- const rules = plugin_nextjs.configs?.[name]?.rules;
759
- if (!rules) throw new Error(`[@ariel-salgado/eslint-config] Failed to find config ${name} in @next/eslint-plugin-next`);
760
- return normalize_rules(rules);
761
- }
762
- return [{
763
- name: "ariel/nextjs/setup",
764
- plugins: { next: plugin_nextjs }
765
- }, {
766
- files,
767
- languageOptions: {
768
- parserOptions: { ecmaFeatures: { jsx: true } },
769
- sourceType: "module"
770
- },
771
- name: "ariel/nextjs/rules",
772
- rules: {
773
- ...get_rules("recommended"),
774
- ...get_rules("core-web-vitals"),
775
- ...overrides
776
- },
777
- settings: { react: { version: "detect" } }
710
+ ...plugin_morgan.configs.recommended,
711
+ name: "ariel/morgan/rules"
778
712
  }];
779
713
  }
780
714
  //#endregion
@@ -792,9 +726,8 @@ async function node() {
792
726
  "node/no-exports-assign": "error",
793
727
  "node/no-new-require": "error",
794
728
  "node/no-path-concat": "error",
795
- "node/no-unsupported-features/es-builtins": "error",
796
729
  "node/prefer-global/buffer": ["error", "never"],
797
- "node/prefer-global/process": "off",
730
+ "node/prefer-global/process": ["error", "never"],
798
731
  "node/process-exit-as-throw": "error"
799
732
  }
800
733
  }];
@@ -1108,201 +1041,9 @@ async function pnpm(options) {
1108
1041
  return configs;
1109
1042
  }
1110
1043
  //#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
- //#endregion
1303
1044
  //#region src/configs/regexp.ts
1304
1045
  async function regexp(options = {}) {
1305
- const config = plugin_regexp["flat/recommended"];
1046
+ const config = configs["flat/recommended"];
1306
1047
  const rules = { ...config.rules };
1307
1048
  if (options.level === "warn") {
1308
1049
  for (const key of Object.keys(rules)) if (rules[key] === "error") rules[key] = "warn";
@@ -1317,56 +1058,6 @@ async function regexp(options = {}) {
1317
1058
  }];
1318
1059
  }
1319
1060
  //#endregion
1320
- //#region src/configs/solid.ts
1321
- async function solid(options = {}) {
1322
- const { files = [GLOB_JSX, GLOB_TSX], overrides = {}, typescript = true } = options;
1323
- await ensure_packages(["eslint-plugin-solid"]);
1324
- const tsconfig_path = options?.tsconfigPath ? to_array(options.tsconfigPath) : void 0;
1325
- const is_type_aware = !!tsconfig_path;
1326
- const [plugin_solid, parser_ts] = await Promise.all([interop_default(import("eslint-plugin-solid")), interop_default(import("@typescript-eslint/parser"))]);
1327
- return [{
1328
- name: "ariel/solid/setup",
1329
- plugins: { solid: plugin_solid }
1330
- }, {
1331
- files,
1332
- languageOptions: {
1333
- parser: parser_ts,
1334
- parserOptions: {
1335
- ecmaFeatures: { jsx: true },
1336
- ...is_type_aware ? { project: tsconfig_path } : {}
1337
- },
1338
- sourceType: "module"
1339
- },
1340
- name: "ariel/solid/rules",
1341
- rules: {
1342
- "solid/components-return-once": "warn",
1343
- "solid/event-handlers": ["error", {
1344
- ignoreCase: false,
1345
- warnOnSpread: false
1346
- }],
1347
- "solid/imports": "error",
1348
- "solid/jsx-no-duplicate-props": "error",
1349
- "solid/jsx-no-script-url": "error",
1350
- "solid/jsx-no-undef": "error",
1351
- "solid/jsx-uses-vars": "error",
1352
- "solid/no-destructure": "error",
1353
- "solid/no-innerhtml": ["error", { allowStatic: true }],
1354
- "solid/no-react-deps": "error",
1355
- "solid/no-react-specific-props": "error",
1356
- "solid/no-unknown-namespaces": "error",
1357
- "solid/prefer-for": "error",
1358
- "solid/reactivity": "warn",
1359
- "solid/self-closing-comp": "error",
1360
- "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
1361
- ...typescript ? {
1362
- "solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
1363
- "solid/no-unknown-namespaces": "off"
1364
- } : {},
1365
- ...overrides
1366
- }
1367
- }];
1368
- }
1369
- //#endregion
1370
1061
  //#region src/configs/sort.ts
1371
1062
  async function sort_package_json() {
1372
1063
  return [{
@@ -1425,8 +1116,7 @@ async function sort_package_json() {
1425
1116
  "husky",
1426
1117
  "simple-git-hooks",
1427
1118
  "lint-staged",
1428
- "eslintConfig",
1429
- "tsdown"
1119
+ "eslintConfig"
1430
1120
  ],
1431
1121
  pathPattern: "^$"
1432
1122
  },
@@ -1449,8 +1139,8 @@ async function sort_package_json() {
1449
1139
  {
1450
1140
  order: [
1451
1141
  "types",
1452
- "require",
1453
1142
  "import",
1143
+ "require",
1454
1144
  "default"
1455
1145
  ],
1456
1146
  pathPattern: "^exports.*$"
@@ -1474,9 +1164,9 @@ async function sort_package_json() {
1474
1164
  }
1475
1165
  }];
1476
1166
  }
1477
- async function sort_ts_config() {
1167
+ function sort_ts_config() {
1478
1168
  return [{
1479
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1169
+ files: ["**/[jt]sconfig.json", "**/[jt]sconfig.*.json"],
1480
1170
  name: "ariel/sort/tsconfig-json",
1481
1171
  rules: { "jsonc/sort-keys": [
1482
1172
  "error",
@@ -1592,23 +1282,21 @@ async function sort_ts_config() {
1592
1282
  }
1593
1283
  //#endregion
1594
1284
  //#region src/configs/stylistic.ts
1595
- const defaults = {
1285
+ const StylisticConfigDefaults = {
1596
1286
  experimental: false,
1597
1287
  indent: "tab",
1598
- jsx: true,
1599
1288
  quotes: "single",
1600
1289
  semi: true
1601
1290
  };
1602
1291
  async function stylistic(options = {}) {
1603
- const { experimental, indent, jsx, overrides = {}, quotes, semi } = {
1604
- ...defaults,
1292
+ const { experimental, indent, overrides = {}, quotes, semi } = {
1293
+ ...StylisticConfigDefaults,
1605
1294
  ...options
1606
1295
  };
1607
1296
  const plugin_stylistic = await interop_default(import("@stylistic/eslint-plugin"));
1608
1297
  const config = plugin_stylistic.configs.customize({
1609
1298
  experimental,
1610
1299
  indent,
1611
- jsx,
1612
1300
  pluginName: "style",
1613
1301
  quotes,
1614
1302
  semi
@@ -1622,9 +1310,10 @@ async function stylistic(options = {}) {
1622
1310
  rules: {
1623
1311
  ...config.rules,
1624
1312
  ...experimental ? {} : { "ariel/consistent-list-newline": "error" },
1313
+ "ariel/consistent-chaining": "error",
1625
1314
  "ariel/curly": "error",
1626
1315
  "ariel/if-newline": "error",
1627
- "ariel/consistent-chaining": "error",
1316
+ "ariel/top-level-function": "error",
1628
1317
  "style/generator-star-spacing": ["error", {
1629
1318
  after: true,
1630
1319
  before: false
@@ -1668,26 +1357,10 @@ async function svelte(options = {}) {
1668
1357
  vars: "all",
1669
1358
  varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1670
1359
  }],
1671
- "svelte/comment-directive": "error",
1672
- "svelte/no-at-debug-tags": "warn",
1673
- "svelte/no-at-html-tags": "error",
1674
- "svelte/no-dupe-else-if-blocks": "error",
1675
- "svelte/no-dupe-style-properties": "error",
1676
- "svelte/no-dupe-use-directives": "error",
1677
- "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1678
- "svelte/no-inner-declarations": "error",
1679
- "svelte/no-not-function-handler": "error",
1680
- "svelte/no-object-in-text-mustaches": "error",
1681
- "svelte/no-reactive-functions": "error",
1682
- "svelte/no-reactive-literals": "error",
1683
- "svelte/no-shorthand-style-property-overrides": "error",
1684
- "svelte/no-unknown-style-directive-property": "error",
1685
- "svelte/no-unused-svelte-ignore": "error",
1686
- "svelte/no-useless-mustaches": "error",
1687
- "svelte/require-store-callbacks-use-set-param": "error",
1688
- "svelte/sort-attributes": "error",
1689
- "svelte/system": "error",
1690
- "svelte/valid-each-key": "error",
1360
+ ...plugin_svelte.configs.recommended.map((config) => config.rules).reduce((acc, rules) => ({
1361
+ ...acc,
1362
+ ...rules
1363
+ }), {}),
1691
1364
  "unused-imports/no-unused-vars": ["error", {
1692
1365
  args: "after-used",
1693
1366
  argsIgnorePattern: "^_",
@@ -1699,7 +1372,7 @@ async function svelte(options = {}) {
1699
1372
  "style/no-trailing-spaces": "off",
1700
1373
  "svelte/derived-has-same-inputs-outputs": "error",
1701
1374
  "svelte/html-closing-bracket-spacing": "error",
1702
- "svelte/html-quotes": ["error", { prefer: quotes === "backtick" ? "single" : quotes }],
1375
+ "svelte/html-quotes": ["error", { prefer: quotes === "backtick" ? "double" : quotes }],
1703
1376
  "svelte/indent": ["error", {
1704
1377
  alignAttributesVertically: true,
1705
1378
  indent: typeof indent === "number" ? indent : indent === "tab" ? "tab" : 2
@@ -1716,20 +1389,20 @@ async function svelte(options = {}) {
1716
1389
  //#endregion
1717
1390
  //#region src/configs/tailwindcss.ts
1718
1391
  async function tailwindcss(options = {}) {
1719
- const { files = [
1720
- GLOB_SVELTE,
1721
- GLOB_JSX,
1722
- GLOB_TSX
1723
- ], overrides = {}, entryPoint = "src/app.css", printWidth = 100, stylistic = true } = options;
1392
+ const { files = [GLOB_HTML, GLOB_SVELTE], overrides = {}, entryPoint = "src/app.css", printWidth = 100, stylistic = true, cwd = "." } = options;
1724
1393
  const { indent = "tab" } = typeof stylistic === "boolean" ? {} : stylistic;
1725
- 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);
1726
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;
1727
1399
  return [{
1728
1400
  name: "ariel/tailwindcss/setup",
1729
1401
  plugins: { tailwindcss: plugin_tailwindcss }
1730
1402
  }, {
1731
1403
  files,
1732
1404
  name: "ariel/tailwindcss/rules",
1405
+ ...has_svelte() && { languageOptions: { parser: svelte_eslint_parser } },
1733
1406
  rules: {
1734
1407
  ...plugin_tailwindcss.configs.recommended.rules,
1735
1408
  "tailwindcss/enforce-consistent-line-wrapping": ["error", {
@@ -1741,9 +1414,13 @@ async function tailwindcss(options = {}) {
1741
1414
  "tailwindcss/enforce-shorthand-classes": "error",
1742
1415
  "tailwindcss/no-deprecated-classes": "error",
1743
1416
  "tailwindcss/no-unknown-classes": ["error", { detectComponentClasses: true }],
1417
+ "tailwindcss/enforce-consistent-variant-order": "error",
1744
1418
  ...overrides
1745
1419
  },
1746
- settings: { "better-tailwindcss": { entryPoint } }
1420
+ settings: { "better-tailwindcss": {
1421
+ entryPoint,
1422
+ cwd
1423
+ } }
1747
1424
  }];
1748
1425
  }
1749
1426
  //#endregion
@@ -1776,6 +1453,7 @@ async function test(options = {}) {
1776
1453
  "test/prefer-hooks-in-order": "error",
1777
1454
  "test/prefer-lowercase-title": "error",
1778
1455
  "ariel/no-top-level-await": "off",
1456
+ "e18e/prefer-static-regex": "off",
1779
1457
  "no-unused-expressions": "off",
1780
1458
  "node/prefer-global/process": "off",
1781
1459
  "ts/explicit-function-return-type": "off",
@@ -1825,13 +1503,9 @@ async function toml(options = {}) {
1825
1503
  //#endregion
1826
1504
  //#region src/configs/typescript.ts
1827
1505
  async function typescript(options = {}) {
1828
- const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
1829
- const files = options.files ?? [
1830
- "**/*.?([cm])ts",
1831
- "**/*.?([cm])jsx",
1832
- ...componentExts.map((ext) => `**/*.${ext}`)
1833
- ];
1834
- const files_type_aware = options.filesTypeAware ?? ["**/*.?([cm])ts", "**/*.?([cm])jsx"];
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"];
1835
1509
  const ignores_type_aware = options.ignoresTypeAware ?? [`**/*.md/**`];
1836
1510
  const tsconfig_path = options?.tsconfigPath ? options.tsconfigPath : void 0;
1837
1511
  const is_type_aware = !!tsconfig_path;
@@ -1862,7 +1536,7 @@ async function typescript(options = {}) {
1862
1536
  "ts/unbound-method": "error"
1863
1537
  };
1864
1538
  const [plugin_ts, parser_ts] = await Promise.all([interop_default(import("@typescript-eslint/eslint-plugin")), interop_default(import("@typescript-eslint/parser"))]);
1865
- function make_parser(type_aware, files, ignores) {
1539
+ function make_parser(typeAware, files, ignores) {
1866
1540
  return {
1867
1541
  files,
1868
1542
  ...ignores ? { ignores } : {},
@@ -1871,17 +1545,17 @@ async function typescript(options = {}) {
1871
1545
  parserOptions: {
1872
1546
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1873
1547
  sourceType: "module",
1874
- ...type_aware ? {
1548
+ ...typeAware ? {
1875
1549
  projectService: {
1876
1550
  allowDefaultProject: ["./*.js"],
1877
1551
  defaultProject: tsconfig_path
1878
1552
  },
1879
- tsconfigRootDir: process$1.cwd()
1553
+ tsconfigRootDir: process.cwd()
1880
1554
  } : {},
1881
1555
  ...parserOptions
1882
1556
  }
1883
1557
  },
1884
- name: `ariel/typescript/${type_aware ? "type-aware-parser" : "parser"}`
1558
+ name: `ariel/typescript/${typeAware ? "type-aware-parser" : "parser"}`
1885
1559
  };
1886
1560
  }
1887
1561
  return [
@@ -1902,7 +1576,7 @@ async function typescript(options = {}) {
1902
1576
  "no-dupe-class-members": "off",
1903
1577
  "no-redeclare": "off",
1904
1578
  "no-use-before-define": "off",
1905
- "no-useless-constructor": "error",
1579
+ "no-useless-constructor": "off",
1906
1580
  "ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
1907
1581
  "ts/consistent-type-definitions": ["error", "interface"],
1908
1582
  "ts/consistent-type-imports": ["error", {
@@ -1952,12 +1626,21 @@ async function typescript(options = {}) {
1952
1626
  ...type_aware_rules,
1953
1627
  ...overridesTypeAware
1954
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
+ }
1955
1639
  }] : []
1956
1640
  ];
1957
1641
  }
1958
1642
  //#endregion
1959
1643
  //#region src/configs/unicorn.ts
1960
- const FILENAME_PATTERN = [/^[A-Z]+\..*$/, /import_map\.json/];
1961
1644
  async function unicorn(options = {}) {
1962
1645
  const { allRecommended = false, overrides = {} } = options;
1963
1646
  return [{
@@ -1966,27 +1649,13 @@ async function unicorn(options = {}) {
1966
1649
  rules: {
1967
1650
  ...allRecommended ? plugin_unicorn.configs.recommended.rules : {
1968
1651
  "unicorn/consistent-empty-array-spread": "error",
1969
- "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
1970
- "unicorn/custom-error-definition": "error",
1971
- "unicorn/filename-case": ["error", {
1972
- cases: {
1973
- kebabCase: true,
1974
- pascalCase: true
1975
- },
1976
- ignore: FILENAME_PATTERN
1977
- }],
1978
1652
  "unicorn/error-message": "error",
1979
1653
  "unicorn/escape-case": "error",
1980
1654
  "unicorn/new-for-builtins": "error",
1981
1655
  "unicorn/no-instanceof-builtins": "error",
1982
1656
  "unicorn/no-new-array": "error",
1983
1657
  "unicorn/no-new-buffer": "error",
1984
- "unicorn/no-useless-undefined": ["error", {
1985
- checkArguments: false,
1986
- checkArrowFunctionBody: false
1987
- }],
1988
1658
  "unicorn/number-literal-case": "error",
1989
- "unicorn/prefer-classlist-toggle": "error",
1990
1659
  "unicorn/prefer-dom-node-text-content": "error",
1991
1660
  "unicorn/prefer-includes": "error",
1992
1661
  "unicorn/prefer-node-protocol": "error",
@@ -2052,14 +1721,9 @@ const flat_config_props = [
2052
1721
  "settings"
2053
1722
  ];
2054
1723
  const default_plugin_renaming = {
2055
- "@eslint-react": "react",
2056
- "@eslint-react/dom": "react-dom",
2057
- "@eslint-react/hooks-extra": "react-hooks-extra",
2058
- "@eslint-react/naming-convention": "react-naming-convention",
2059
- "@next/next": "next",
1724
+ "better-tailwindcss": "tailwindcss",
2060
1725
  "@stylistic": "style",
2061
1726
  "@typescript-eslint": "ts",
2062
- "better-tailwindcss": "tailwindcss",
2063
1727
  "import-lite": "import",
2064
1728
  "n": "node",
2065
1729
  "vitest": "test",
@@ -2076,62 +1740,46 @@ const default_plugin_renaming = {
2076
1740
  * The merged ESLint configurations.
2077
1741
  */
2078
1742
  function defineConfig(options = {}, ...userConfigs) {
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;
1743
+ const { autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, node: enableNode = true, pnpm: enableCatalogs = !!findUp("pnpm-workspace.yaml"), regexp: enableRegexp = true, svelte: enableSvelte = has_svelte(), tailwindcss: enableTailwindcss = has_tailwindcss(), type: appType = "app", typescript: enableTypeScript = has_typescript(), unicorn: enableUnicorn = true } = options;
2080
1744
  const is_in_editor = is_in_editor_env();
2081
- if (is_in_editor) console.log("[@ariel-salgado/eslint-config] Detected running in editor, some rules are disabled.");
2082
1745
  const stylistic_options = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2083
- if (stylistic_options && !("jsx" in stylistic_options)) stylistic_options.jsx = typeof enable_jsx === "object" ? true : enable_jsx;
2084
1746
  const configs = [];
2085
- 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({
2086
1748
  name: "ariel/gitignore",
2087
- ...enable_git_ignore
1749
+ ...enableGitignore
2088
1750
  })]));
2089
1751
  else configs.push(interop_default(import("eslint-config-flat-gitignore")).then((r) => [r({
2090
1752
  name: "ariel/gitignore",
2091
1753
  strict: false
2092
1754
  })]));
2093
1755
  const typescript_options = resolve_sub_options(options, "typescript");
2094
- const tsconfig_path = "tsconfigPath" in typescript_options ? typescript_options.tsconfigPath : void 0;
2095
- configs.push(ignores(user_ignores), javascript({ overrides: get_overrides(options, "javascript") }), comments(), perfectionist(), morgan());
2096
- if (enable_node) configs.push(node());
2097
- if (enable_jsdoc) configs.push(jsdoc({ stylistic: stylistic_options }));
2098
- 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({
2099
1760
  stylistic: stylistic_options,
2100
1761
  ...resolve_sub_options(options, "imports")
2101
1762
  }));
2102
- if (enable_e18e) configs.push(e18e({ ...enable_e18e === true ? {} : enable_e18e }));
2103
- if (enable_unicorn) configs.push(unicorn(enable_unicorn === true ? {} : enable_unicorn));
2104
- if (enable_jsx) configs.push(jsx(enable_jsx === true ? {} : enable_jsx));
2105
- 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({
2106
1766
  ...typescript_options,
2107
1767
  componentExts,
2108
1768
  overrides: get_overrides(options, "typescript"),
2109
- type: options.type
1769
+ type: appType
2110
1770
  }));
2111
1771
  if (stylistic_options) configs.push(stylistic({
2112
1772
  ...stylistic_options,
2113
1773
  overrides: get_overrides(options, "stylistic")
2114
1774
  }));
2115
- if (enable_regexp) configs.push(regexp(typeof enable_regexp === "boolean" ? {} : enable_regexp));
1775
+ if (enableRegexp) configs.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
2116
1776
  if (options.test ?? true) configs.push(test({ overrides: get_overrides(options, "test") }));
2117
- if (enable_react) configs.push(react({
2118
- ...typescript_options,
2119
- ...resolve_sub_options(options, "react"),
2120
- overrides: get_overrides(options, "react"),
2121
- tsconfigPath: tsconfig_path
2122
- }));
2123
- if (enable_nextjs) configs.push(nextjs({ overrides: get_overrides(options, "nextjs") }));
2124
- if (enable_solid) configs.push(solid({
2125
- overrides: get_overrides(options, "solid"),
2126
- tsconfigPath: tsconfig_path,
2127
- typescript: !!enable_typescript
2128
- }));
2129
- if (enable_svelte) configs.push(svelte({
1777
+ if (enableSvelte) configs.push(svelte({
2130
1778
  overrides: get_overrides(options, "svelte"),
2131
1779
  stylistic: stylistic_options,
2132
- typescript: !!enable_typescript
1780
+ typescript: !!enableTypeScript
2133
1781
  }));
2134
- if (enable_tailwindcss) configs.push(tailwindcss({
1782
+ if (enableTailwindcss) configs.push(tailwindcss({
2135
1783
  overrides: get_overrides(options, "tailwindcss"),
2136
1784
  stylistic: stylistic_options
2137
1785
  }));
@@ -2139,11 +1787,14 @@ function defineConfig(options = {}, ...userConfigs) {
2139
1787
  overrides: get_overrides(options, "jsonc"),
2140
1788
  stylistic: stylistic_options
2141
1789
  }), sort_package_json(), sort_ts_config());
2142
- if (enable_catalogs) configs.push(pnpm({
2143
- json: options.jsonc !== false,
2144
- yaml: options.yaml !== false,
2145
- ...resolve_sub_options(options, "pnpm")
2146
- }));
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
+ }
2147
1798
  if (options.yaml ?? true) configs.push(yaml({
2148
1799
  overrides: get_overrides(options, "yaml"),
2149
1800
  stylistic: stylistic_options
@@ -2158,13 +1809,14 @@ function defineConfig(options = {}, ...userConfigs) {
2158
1809
  }));
2159
1810
  configs.push(disables());
2160
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.");
2161
- const merged_config = flat_config_props.reduce((acc, key) => {
1812
+ const fused_config = flat_config_props.reduce((acc, key) => {
2162
1813
  if (key in options) acc[key] = options[key];
2163
1814
  return acc;
2164
1815
  }, {});
2165
- if (Object.keys(merged_config).length) configs.push([merged_config]);
1816
+ if (Object.keys(fused_config).length) configs.push([fused_config]);
2166
1817
  let composer = new FlatConfigComposer();
2167
1818
  composer = composer.append(...configs, ...userConfigs);
1819
+ if (options.markdown ?? true) composer = composer.append({ ignores: [GLOB_MARKDOWN] });
2168
1820
  if (autoRenamePlugins) composer = composer.renamePlugins(default_plugin_renaming);
2169
1821
  if (is_in_editor) composer = composer.disableRulesFix([
2170
1822
  "unused-imports/no-unused-imports",
@@ -2190,16 +1842,13 @@ const PRESET_FULL_ON = {
2190
1842
  imports: true,
2191
1843
  jsdoc: true,
2192
1844
  jsonc: true,
2193
- jsx: { a11y: true },
2194
1845
  markdown: true,
2195
- nextjs: true,
2196
1846
  node: true,
2197
1847
  pnpm: true,
2198
- react: { reactCompiler: true },
2199
1848
  regexp: true,
2200
- solid: true,
2201
1849
  stylistic: { experimental: true },
2202
1850
  svelte: true,
1851
+ tailwindcss: true,
2203
1852
  test: true,
2204
1853
  toml: true,
2205
1854
  typescript: { tsconfigPath: "tsconfig.json" },
@@ -2212,16 +1861,13 @@ const PRESET_FULL_OFF = {
2212
1861
  imports: false,
2213
1862
  jsdoc: false,
2214
1863
  jsonc: false,
2215
- jsx: false,
2216
1864
  markdown: false,
2217
- nextjs: false,
2218
1865
  node: false,
2219
1866
  pnpm: false,
2220
- react: false,
2221
1867
  regexp: false,
2222
- solid: false,
2223
1868
  stylistic: false,
2224
1869
  svelte: false,
1870
+ tailwindcss: false,
2225
1871
  test: false,
2226
1872
  toml: false,
2227
1873
  typescript: false,
@@ -2233,4 +1879,4 @@ const PRESET_FULL_OFF = {
2233
1879
  //#region src/index.ts
2234
1880
  var src_default = defineConfig;
2235
1881
  //#endregion
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 };
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 };