@ariel-salgado/eslint-config 0.2.0-beta.1 → 0.3.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.js DELETED
@@ -1,1936 +0,0 @@
1
- import { FlatConfigComposer } from "eslint-flat-config-utils";
2
- import { fileURLToPath } from "node:url";
3
- import { isPackageExists } from "local-pkg";
4
- import process$1 from "node:process";
5
- import plugin_node from "eslint-plugin-n";
6
- import plugin_ariel from "eslint-plugin-ariel";
7
- import { configs as plugin_regexp } from "eslint-plugin-regexp";
8
- import plugin_unicorn from "eslint-plugin-unicorn";
9
- import plugin_morgan from "eslint-plugin-de-morgan";
10
- import plugin_import from "eslint-plugin-import-lite";
11
- import plugin_ignore from "eslint-config-flat-gitignore";
12
- import plugin_perfectionist from "eslint-plugin-perfectionist";
13
- import plugin_unused_imports from "eslint-plugin-unused-imports";
14
- import plugin_comments from "@eslint-community/eslint-plugin-eslint-comments";
15
- import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
16
- import globals from "globals";
17
-
18
- //#region src/utils.ts
19
- const scope_url = fileURLToPath(new URL(".", import.meta.url));
20
- const is_cwd_in_scope = isPackageExists("@ariel-salgado/eslint-config");
21
- const parser_plain = {
22
- meta: { name: "parser-plain" },
23
- parseForESLint: (code) => ({
24
- ast: {
25
- body: [],
26
- comments: [],
27
- loc: {
28
- end: code.length,
29
- start: 0
30
- },
31
- range: [0, code.length],
32
- tokens: [],
33
- type: "Program"
34
- },
35
- scopeManager: null,
36
- services: { isPlain: true },
37
- visitorKeys: { Program: [] }
38
- })
39
- };
40
- async function combine(...configs) {
41
- return (await Promise.all(configs)).flat();
42
- }
43
- function rename_rules(rules, map) {
44
- return Object.fromEntries(Object.entries(rules).map(([key, value]) => {
45
- for (const [from, to] of Object.entries(map)) if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];
46
- return [key, value];
47
- }));
48
- }
49
- function rename_plugin_in_configs(configs, map) {
50
- return configs.map((i) => {
51
- const clone = { ...i };
52
- if (clone.rules) clone.rules = rename_rules(clone.rules, map);
53
- if (clone.plugins) clone.plugins = Object.fromEntries(Object.entries(clone.plugins).map(([key, value]) => {
54
- if (key in map) return [map[key], value];
55
- return [key, value];
56
- }));
57
- return clone;
58
- });
59
- }
60
- function to_array(value) {
61
- return Array.isArray(value) ? value : [value];
62
- }
63
- async function interop_default(m) {
64
- const resolved = await m;
65
- return resolved.default || resolved;
66
- }
67
- function is_package_in_scope(name) {
68
- return isPackageExists(name, { paths: [scope_url] });
69
- }
70
- async function ensure_packages(packages) {
71
- if (process.env.CI || process.stdout.isTTY === false || is_cwd_in_scope === false) return;
72
- const non_existing_packages = packages.filter((i) => i && !is_package_in_scope(i));
73
- if (non_existing_packages.length === 0) return;
74
- 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 }));
75
- }
76
-
77
- //#endregion
78
- //#region src/env.ts
79
- function has_typescript() {
80
- return isPackageExists("typescript");
81
- }
82
- function has_svelte() {
83
- return isPackageExists("svelte") || isPackageExists("@sveltejs/kit");
84
- }
85
- function has_tailwindcss() {
86
- return isPackageExists("tailwindcss") || isPackageExists("@tailwindcss/vite");
87
- }
88
- function has_react() {
89
- return isPackageExists("react") || isPackageExists("react-dom");
90
- }
91
- function has_nextjs() {
92
- return isPackageExists("next");
93
- }
94
- function has_solid() {
95
- return isPackageExists("solid-js");
96
- }
97
- function is_in_git_hooks_or_lint_staged() {
98
- return !!(process$1.env.GIT_PARAMS || process$1.env.VSCODE_GIT_COMMAND || process$1.env.npm_lifecycle_script?.startsWith("lint-staged"));
99
- }
100
- function is_in_editor_env() {
101
- if (process$1.env.CI) return false;
102
- if (is_in_git_hooks_or_lint_staged()) return false;
103
- return !!(process$1.env.VSCODE_PID || process$1.env.VSCODE_CWD || process$1.env.JETBRAINS_IDE || process$1.env.VIM || process$1.env.NVIM);
104
- }
105
-
106
- //#endregion
107
- //#region src/globs.ts
108
- const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
109
- const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
110
- const GLOB_JS = "**/*.?([cm])js";
111
- const GLOB_JSX = "**/*.?([cm])jsx";
112
- const GLOB_TS = "**/*.?([cm])ts";
113
- const GLOB_TSX = "**/*.?([cm])tsx";
114
- const GLOB_STYLE = "**/*.{c,le,sc}ss";
115
- const GLOB_CSS = "**/*.css";
116
- const GLOB_POSTCSS = "**/*.{p,post}css";
117
- const GLOB_LESS = "**/*.less";
118
- const GLOB_SCSS = "**/*.scss";
119
- const GLOB_JSON = "**/*.json";
120
- const GLOB_JSON5 = "**/*.json5";
121
- const GLOB_JSONC = "**/*.jsonc";
122
- const GLOB_MARKDOWN = "**/*.md";
123
- const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
124
- const GLOB_SVELTE = "**/*.svelte?(.{js,ts})";
125
- const GLOB_YAML = "**/*.y?(a)ml";
126
- const GLOB_TOML = "**/*.toml";
127
- const GLOB_XML = "**/*.xml";
128
- const GLOB_SVG = "**/*.svg";
129
- const GLOB_HTML = "**/*.htm?(l)";
130
- const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
131
- const GLOB_TESTS = [
132
- `**/__tests__/**/*.${GLOB_SRC_EXT}`,
133
- `**/*.spec.${GLOB_SRC_EXT}`,
134
- `**/*.test.${GLOB_SRC_EXT}`,
135
- `**/*.bench.${GLOB_SRC_EXT}`,
136
- `**/*.benchmark.${GLOB_SRC_EXT}`
137
- ];
138
- const GLOB_ALL_SRC = [
139
- GLOB_SRC,
140
- GLOB_STYLE,
141
- GLOB_JSON,
142
- GLOB_JSON5,
143
- GLOB_MARKDOWN,
144
- GLOB_SVELTE,
145
- GLOB_YAML,
146
- GLOB_XML,
147
- GLOB_HTML
148
- ];
149
- const GLOB_EXCLUDE = [
150
- "**/node_modules",
151
- "**/dist",
152
- "**/package-lock.json",
153
- "**/pnpm-lock.yaml",
154
- "**/bun.lockb",
155
- "**/output",
156
- "**/coverage",
157
- "**/temp",
158
- "**/.temp",
159
- "**/tmp",
160
- "**/.tmp",
161
- "**/.history",
162
- "**/.svelte-kit",
163
- "**/.vercel",
164
- "**/.changeset",
165
- "**/.idea",
166
- "**/.cache",
167
- "**/.output",
168
- "**/.vite-inspect",
169
- "**/vite.config.*.timestamp-*",
170
- "**/CHANGELOG*.md",
171
- "**/*.min.*",
172
- "**/LICENSE*",
173
- "**/__snapshots__",
174
- "**/auto-import?(s).d.ts",
175
- "**/components.d.ts"
176
- ];
177
-
178
- //#endregion
179
- //#region src/configs/jsx.ts
180
- async function jsx(options = {}) {
181
- const { a11y } = options;
182
- const base_config = {
183
- files: [GLOB_JSX, GLOB_TSX],
184
- languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
185
- name: "ariel/jsx/setup",
186
- plugins: {},
187
- rules: {}
188
- };
189
- if (!a11y) return [base_config];
190
- await ensure_packages(["eslint-plugin-jsx-a11y"]);
191
- const jsx_a11y_plugin = await interop_default(import("eslint-plugin-jsx-a11y"));
192
- const a11y_config = jsx_a11y_plugin.flatConfigs.recommended;
193
- const a11y_rules = {
194
- ...a11y_config.rules || {},
195
- ...typeof a11y === "object" && a11y.overrides ? a11y.overrides : {}
196
- };
197
- return [{
198
- ...base_config,
199
- ...a11y_config,
200
- files: base_config.files,
201
- languageOptions: {
202
- ...base_config.languageOptions,
203
- ...a11y_config.languageOptions
204
- },
205
- name: base_config.name,
206
- plugins: {
207
- ...base_config.plugins,
208
- "jsx-a11y": jsx_a11y_plugin
209
- },
210
- rules: {
211
- ...base_config.rules,
212
- ...a11y_rules
213
- }
214
- }];
215
- }
216
-
217
- //#endregion
218
- //#region src/configs/node.ts
219
- async function node() {
220
- return [{
221
- name: "ariel/node/rules",
222
- plugins: { node: plugin_node },
223
- rules: {
224
- "node/handle-callback-err": ["error", "^(err|error)$"],
225
- "node/no-deprecated-api": "error",
226
- "node/no-exports-assign": "error",
227
- "node/no-new-require": "error",
228
- "node/no-path-concat": "error",
229
- "node/no-unsupported-features/es-builtins": "error",
230
- "node/prefer-global/buffer": ["error", "never"],
231
- "node/prefer-global/process": "off",
232
- "node/process-exit-as-throw": "error"
233
- }
234
- }];
235
- }
236
-
237
- //#endregion
238
- //#region src/configs/pnpm.ts
239
- async function pnpm() {
240
- const [plugin_pnpm, yaml_parser, jsonc_parser] = await Promise.all([
241
- interop_default(import("eslint-plugin-pnpm")),
242
- interop_default(import("yaml-eslint-parser")),
243
- interop_default(import("jsonc-eslint-parser"))
244
- ]);
245
- return [{
246
- files: ["package.json", "**/package.json"],
247
- languageOptions: { parser: jsonc_parser },
248
- name: "ariel/pnpm/package-json",
249
- plugins: { pnpm: plugin_pnpm },
250
- rules: {
251
- "pnpm/json-enforce-catalog": "error",
252
- "pnpm/json-prefer-workspace-settings": "error",
253
- "pnpm/json-valid-catalog": "error"
254
- }
255
- }, {
256
- files: ["pnpm-workspace.yaml"],
257
- languageOptions: { parser: yaml_parser },
258
- name: "ariel/pnpm/pnpm-workspace-yaml",
259
- plugins: { pnpm: plugin_pnpm },
260
- rules: {
261
- "pnpm/yaml-no-duplicate-catalog-item": "error",
262
- "pnpm/yaml-no-unused-catalog-item": "error"
263
- }
264
- }];
265
- }
266
-
267
- //#endregion
268
- //#region src/configs/sort.ts
269
- async function sort_package_json() {
270
- return [{
271
- files: ["**/package.json"],
272
- name: "ariel/sort/package-json",
273
- rules: {
274
- "jsonc/sort-array-values": ["error", {
275
- order: { type: "asc" },
276
- pathPattern: "^files$"
277
- }],
278
- "jsonc/sort-keys": [
279
- "error",
280
- {
281
- order: [
282
- "publisher",
283
- "name",
284
- "displayName",
285
- "type",
286
- "version",
287
- "private",
288
- "packageManager",
289
- "description",
290
- "author",
291
- "contributors",
292
- "license",
293
- "funding",
294
- "homepage",
295
- "repository",
296
- "bugs",
297
- "keywords",
298
- "categories",
299
- "sideEffects",
300
- "imports",
301
- "exports",
302
- "main",
303
- "module",
304
- "unpkg",
305
- "jsdelivr",
306
- "types",
307
- "typesVersions",
308
- "bin",
309
- "icon",
310
- "files",
311
- "engines",
312
- "activationEvents",
313
- "contributes",
314
- "scripts",
315
- "peerDependencies",
316
- "peerDependenciesMeta",
317
- "dependencies",
318
- "optionalDependencies",
319
- "devDependencies",
320
- "pnpm",
321
- "overrides",
322
- "resolutions",
323
- "husky",
324
- "simple-git-hooks",
325
- "lint-staged",
326
- "eslintConfig",
327
- "tsdown"
328
- ],
329
- pathPattern: "^$"
330
- },
331
- {
332
- order: { type: "asc" },
333
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
334
- },
335
- {
336
- order: { type: "asc" },
337
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
338
- },
339
- {
340
- order: { type: "asc" },
341
- pathPattern: "^workspaces\\.catalog$"
342
- },
343
- {
344
- order: { type: "asc" },
345
- pathPattern: "^workspaces\\.catalogs\\.[^.]+$"
346
- },
347
- {
348
- order: [
349
- "types",
350
- "require",
351
- "import",
352
- "default"
353
- ],
354
- pathPattern: "^exports.*$"
355
- },
356
- {
357
- order: [
358
- "pre-commit",
359
- "prepare-commit-msg",
360
- "commit-msg",
361
- "post-commit",
362
- "pre-rebase",
363
- "post-rewrite",
364
- "post-checkout",
365
- "post-merge",
366
- "pre-push",
367
- "pre-auto-gc"
368
- ],
369
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
370
- }
371
- ]
372
- }
373
- }];
374
- }
375
- async function sort_ts_config() {
376
- return [{
377
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
378
- name: "ariel/sort/tsconfig-json",
379
- rules: { "jsonc/sort-keys": [
380
- "error",
381
- {
382
- order: [
383
- "extends",
384
- "compilerOptions",
385
- "references",
386
- "files",
387
- "include",
388
- "exclude"
389
- ],
390
- pathPattern: "^$"
391
- },
392
- {
393
- order: [
394
- "incremental",
395
- "composite",
396
- "tsBuildInfoFile",
397
- "disableSourceOfProjectReferenceRedirect",
398
- "disableSolutionSearching",
399
- "disableReferencedProjectLoad",
400
- "target",
401
- "jsx",
402
- "jsxFactory",
403
- "jsxFragmentFactory",
404
- "jsxImportSource",
405
- "lib",
406
- "moduleDetection",
407
- "noLib",
408
- "reactNamespace",
409
- "useDefineForClassFields",
410
- "emitDecoratorMetadata",
411
- "experimentalDecorators",
412
- "libReplacement",
413
- "baseUrl",
414
- "rootDir",
415
- "rootDirs",
416
- "customConditions",
417
- "module",
418
- "moduleResolution",
419
- "moduleSuffixes",
420
- "noResolve",
421
- "paths",
422
- "resolveJsonModule",
423
- "resolvePackageJsonExports",
424
- "resolvePackageJsonImports",
425
- "typeRoots",
426
- "types",
427
- "allowArbitraryExtensions",
428
- "allowImportingTsExtensions",
429
- "allowUmdGlobalAccess",
430
- "allowJs",
431
- "checkJs",
432
- "maxNodeModuleJsDepth",
433
- "strict",
434
- "strictBindCallApply",
435
- "strictFunctionTypes",
436
- "strictNullChecks",
437
- "strictPropertyInitialization",
438
- "allowUnreachableCode",
439
- "allowUnusedLabels",
440
- "alwaysStrict",
441
- "exactOptionalPropertyTypes",
442
- "noFallthroughCasesInSwitch",
443
- "noImplicitAny",
444
- "noImplicitOverride",
445
- "noImplicitReturns",
446
- "noImplicitThis",
447
- "noPropertyAccessFromIndexSignature",
448
- "noUncheckedIndexedAccess",
449
- "noUnusedLocals",
450
- "noUnusedParameters",
451
- "useUnknownInCatchVariables",
452
- "declaration",
453
- "declarationDir",
454
- "declarationMap",
455
- "downlevelIteration",
456
- "emitBOM",
457
- "emitDeclarationOnly",
458
- "importHelpers",
459
- "importsNotUsedAsValues",
460
- "inlineSourceMap",
461
- "inlineSources",
462
- "mapRoot",
463
- "newLine",
464
- "noEmit",
465
- "noEmitHelpers",
466
- "noEmitOnError",
467
- "outDir",
468
- "outFile",
469
- "preserveConstEnums",
470
- "preserveValueImports",
471
- "removeComments",
472
- "sourceMap",
473
- "sourceRoot",
474
- "stripInternal",
475
- "allowSyntheticDefaultImports",
476
- "esModuleInterop",
477
- "forceConsistentCasingInFileNames",
478
- "isolatedDeclarations",
479
- "isolatedModules",
480
- "preserveSymlinks",
481
- "verbatimModuleSyntax",
482
- "erasableSyntaxOnly",
483
- "skipDefaultLibCheck",
484
- "skipLibCheck"
485
- ],
486
- pathPattern: "^compilerOptions$"
487
- }
488
- ] }
489
- }];
490
- }
491
-
492
- //#endregion
493
- //#region src/configs/test.ts
494
- let _plugin_test;
495
- async function test(options = {}) {
496
- const { files = GLOB_TESTS, overrides = {} } = options;
497
- const [plugin_vitest, plugin_no_only_tests] = await Promise.all([interop_default(import("@vitest/eslint-plugin")), interop_default(import("eslint-plugin-no-only-tests"))]);
498
- _plugin_test = _plugin_test || {
499
- ...plugin_vitest,
500
- rules: {
501
- ...plugin_vitest.rules,
502
- ...plugin_no_only_tests.rules
503
- }
504
- };
505
- return [{
506
- name: "ariel/test/setup",
507
- plugins: { test: _plugin_test }
508
- }, {
509
- files,
510
- name: "ariel/test/rules",
511
- rules: {
512
- "test/consistent-test-it": ["error", {
513
- fn: "it",
514
- withinDescribe: "it"
515
- }],
516
- "test/no-identical-title": "error",
517
- "test/no-import-node-test": "error",
518
- "test/no-only-tests": "warn",
519
- "test/prefer-hooks-in-order": "error",
520
- "test/prefer-lowercase-title": "error",
521
- "ariel/no-top-level-await": "off",
522
- "no-unused-expressions": "off",
523
- "node/prefer-global/process": "off",
524
- "ts/explicit-function-return-type": "off",
525
- ...overrides
526
- }
527
- }];
528
- }
529
-
530
- //#endregion
531
- //#region src/configs/toml.ts
532
- async function toml(options = {}) {
533
- const { files = [GLOB_TOML], overrides = {}, stylistic: stylistic$1 = true } = options;
534
- const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
535
- const [plugin_toml, parser_toml] = await Promise.all([interop_default(import("eslint-plugin-toml")), interop_default(import("toml-eslint-parser"))]);
536
- return [{
537
- name: "ariel/toml/setup",
538
- plugins: { toml: plugin_toml }
539
- }, {
540
- files,
541
- languageOptions: { parser: parser_toml },
542
- name: "ariel/toml/rules",
543
- rules: {
544
- "style/spaced-comment": "off",
545
- "toml/comma-style": "error",
546
- "toml/keys-order": "error",
547
- "toml/no-space-dots": "error",
548
- "toml/no-unreadable-number-separator": "error",
549
- "toml/precision-of-fractional-seconds": "error",
550
- "toml/precision-of-integer": "error",
551
- "toml/tables-order": "error",
552
- "toml/vue-custom-block/no-parsing-error": "error",
553
- ...stylistic$1 ? {
554
- "toml/array-bracket-newline": "error",
555
- "toml/array-bracket-spacing": "error",
556
- "toml/array-element-newline": "error",
557
- "toml/indent": ["error", indent === "tab" ? 2 : indent],
558
- "toml/inline-table-curly-spacing": "error",
559
- "toml/key-spacing": "error",
560
- "toml/padding-line-between-pairs": "error",
561
- "toml/padding-line-between-tables": "error",
562
- "toml/quoted-keys": "error",
563
- "toml/spaced-comment": "error",
564
- "toml/table-bracket-spacing": "error"
565
- } : {},
566
- ...overrides
567
- }
568
- }];
569
- }
570
-
571
- //#endregion
572
- //#region src/configs/yaml.ts
573
- async function yaml(options = {}) {
574
- const { files = [GLOB_YAML], overrides = {}, stylistic: stylistic$1 = true } = options;
575
- const { indent = 2, quotes = "single" } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
576
- const [plugin_yaml, parser_yaml] = await Promise.all([interop_default(import("eslint-plugin-yml")), interop_default(import("yaml-eslint-parser"))]);
577
- return [
578
- {
579
- name: "ariel/yaml/setup",
580
- plugins: { yaml: plugin_yaml }
581
- },
582
- {
583
- files,
584
- languageOptions: { parser: parser_yaml },
585
- name: "ariel/yaml/rules",
586
- rules: {
587
- "style/spaced-comment": "off",
588
- "yaml/block-mapping": "error",
589
- "yaml/block-sequence": "error",
590
- "yaml/no-empty-key": "error",
591
- "yaml/no-empty-sequence-entry": "error",
592
- "yaml/no-irregular-whitespace": "error",
593
- "yaml/plain-scalar": "error",
594
- "yaml/vue-custom-block/no-parsing-error": "error",
595
- ...stylistic$1 ? {
596
- "yaml/block-mapping-question-indicator-newline": "error",
597
- "yaml/block-sequence-hyphen-indicator-newline": "error",
598
- "yaml/flow-mapping-curly-newline": "error",
599
- "yaml/flow-mapping-curly-spacing": "error",
600
- "yaml/flow-sequence-bracket-newline": "error",
601
- "yaml/flow-sequence-bracket-spacing": "error",
602
- "yaml/indent": ["error", indent === "tab" ? 2 : indent],
603
- "yaml/key-spacing": "error",
604
- "yaml/no-tab-indent": "error",
605
- "yaml/quotes": ["error", {
606
- avoidEscape: true,
607
- prefer: quotes === "backtick" ? "single" : quotes
608
- }],
609
- "yaml/spaced-comment": "error"
610
- } : {},
611
- ...overrides
612
- }
613
- },
614
- {
615
- files: ["pnpm-workspace.yaml"],
616
- name: "ariel/yaml/pnpm-workspace",
617
- rules: { "yaml/sort-keys": [
618
- "error",
619
- {
620
- order: [
621
- "packages",
622
- "overrides",
623
- "patchedDependencies",
624
- "hoistPattern",
625
- "catalog",
626
- "catalogs",
627
- "allowedDeprecatedVersions",
628
- "allowNonAppliedPatches",
629
- "configDependencies",
630
- "ignoredBuiltDependencies",
631
- "ignoredOptionalDependencies",
632
- "neverBuiltDependencies",
633
- "onlyBuiltDependencies",
634
- "onlyBuiltDependenciesFile",
635
- "packageExtensions",
636
- "peerDependencyRules",
637
- "supportedArchitectures"
638
- ],
639
- pathPattern: "^$"
640
- },
641
- {
642
- order: { type: "asc" },
643
- pathPattern: ".*"
644
- }
645
- ] }
646
- }
647
- ];
648
- }
649
-
650
- //#endregion
651
- //#region src/configs/solid.ts
652
- async function solid(options = {}) {
653
- const { files = [GLOB_JSX, GLOB_TSX], overrides = {}, typescript: typescript$1 = true } = options;
654
- await ensure_packages(["eslint-plugin-solid"]);
655
- const tsconfig_path = options?.tsconfigPath ? to_array(options.tsconfigPath) : void 0;
656
- const is_type_aware = !!tsconfig_path;
657
- const [plugin_solid, parser_ts] = await Promise.all([interop_default(import("eslint-plugin-solid")), interop_default(import("@typescript-eslint/parser"))]);
658
- return [{
659
- name: "ariel/solid/setup",
660
- plugins: { solid: plugin_solid }
661
- }, {
662
- files,
663
- languageOptions: {
664
- parser: parser_ts,
665
- parserOptions: {
666
- ecmaFeatures: { jsx: true },
667
- ...is_type_aware ? { project: tsconfig_path } : {}
668
- },
669
- sourceType: "module"
670
- },
671
- name: "ariel/solid/rules",
672
- rules: {
673
- "solid/components-return-once": "warn",
674
- "solid/event-handlers": ["error", {
675
- ignoreCase: false,
676
- warnOnSpread: false
677
- }],
678
- "solid/imports": "error",
679
- "solid/jsx-no-duplicate-props": "error",
680
- "solid/jsx-no-script-url": "error",
681
- "solid/jsx-no-undef": "error",
682
- "solid/jsx-uses-vars": "error",
683
- "solid/no-destructure": "error",
684
- "solid/no-innerhtml": ["error", { allowStatic: true }],
685
- "solid/no-react-deps": "error",
686
- "solid/no-react-specific-props": "error",
687
- "solid/no-unknown-namespaces": "error",
688
- "solid/prefer-for": "error",
689
- "solid/reactivity": "warn",
690
- "solid/self-closing-comp": "error",
691
- "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
692
- ...typescript$1 ? {
693
- "solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
694
- "solid/no-unknown-namespaces": "off"
695
- } : {},
696
- ...overrides
697
- }
698
- }];
699
- }
700
-
701
- //#endregion
702
- //#region src/configs/react.ts
703
- const react_refresh_allow_constant_export_packages = ["vite"];
704
- const remix_packages = [
705
- "@remix-run/node",
706
- "@remix-run/react",
707
- "@remix-run/serve",
708
- "@remix-run/dev"
709
- ];
710
- const react_router_packages = [
711
- "@react-router/node",
712
- "@react-router/react",
713
- "@react-router/serve",
714
- "@react-router/dev"
715
- ];
716
- const next_js_packages = ["next"];
717
- async function react(options = {}) {
718
- const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, tsconfigPath } = options;
719
- await ensure_packages([
720
- "@eslint-react/eslint-plugin",
721
- "eslint-plugin-react-hooks",
722
- "eslint-plugin-react-refresh"
723
- ]);
724
- const is_type_aware = !!tsconfigPath;
725
- const type_aware_rules = { "react/no-leaked-conditional-rendering": "warn" };
726
- const [plugin_react, plugin_react_hooks, plugin_react_refresh] = await Promise.all([
727
- interop_default(import("@eslint-react/eslint-plugin")),
728
- interop_default(import("eslint-plugin-react-hooks")),
729
- interop_default(import("eslint-plugin-react-refresh"))
730
- ]);
731
- const is_allow_constant_export = react_refresh_allow_constant_export_packages.some((i) => isPackageExists(i));
732
- const is_using_remix = remix_packages.some((i) => isPackageExists(i));
733
- const is_using_react_router = react_router_packages.some((i) => isPackageExists(i));
734
- const is_using_next = next_js_packages.some((i) => isPackageExists(i));
735
- const plugins = plugin_react.configs.all.plugins;
736
- return [
737
- {
738
- name: "ariel/react/setup",
739
- plugins: {
740
- "react": plugins["@eslint-react"],
741
- "react-dom": plugins["@eslint-react/dom"],
742
- "react-hooks": plugin_react_hooks,
743
- "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
744
- "react-naming-convention": plugins["@eslint-react/naming-convention"],
745
- "react-refresh": plugin_react_refresh,
746
- "react-web-api": plugins["@eslint-react/web-api"]
747
- }
748
- },
749
- {
750
- files,
751
- languageOptions: {
752
- parserOptions: { ecmaFeatures: { jsx: true } },
753
- sourceType: "module"
754
- },
755
- name: "ariel/react/rules",
756
- rules: {
757
- "react/jsx-no-comment-textnodes": "warn",
758
- "react/jsx-no-duplicate-props": "warn",
759
- "react/jsx-uses-vars": "warn",
760
- "react/no-access-state-in-setstate": "error",
761
- "react/no-array-index-key": "warn",
762
- "react/no-children-count": "warn",
763
- "react/no-children-for-each": "warn",
764
- "react/no-children-map": "warn",
765
- "react/no-children-only": "warn",
766
- "react/no-children-to-array": "warn",
767
- "react/no-clone-element": "warn",
768
- "react/no-component-will-mount": "error",
769
- "react/no-component-will-receive-props": "error",
770
- "react/no-component-will-update": "error",
771
- "react/no-context-provider": "warn",
772
- "react/no-create-ref": "error",
773
- "react/no-default-props": "error",
774
- "react/no-direct-mutation-state": "error",
775
- "react/no-duplicate-key": "warn",
776
- "react/no-forward-ref": "warn",
777
- "react/no-implicit-key": "warn",
778
- "react/no-missing-key": "error",
779
- "react/no-nested-component-definitions": "error",
780
- "react/no-prop-types": "error",
781
- "react/no-redundant-should-component-update": "error",
782
- "react/no-set-state-in-component-did-mount": "warn",
783
- "react/no-set-state-in-component-did-update": "warn",
784
- "react/no-set-state-in-component-will-update": "warn",
785
- "react/no-string-refs": "error",
786
- "react/no-unnecessary-use-prefix": "warn",
787
- "react/no-unsafe-component-will-mount": "warn",
788
- "react/no-unsafe-component-will-receive-props": "warn",
789
- "react/no-unsafe-component-will-update": "warn",
790
- "react/no-unstable-context-value": "warn",
791
- "react/no-unstable-default-props": "warn",
792
- "react/no-unused-class-component-members": "warn",
793
- "react/no-unused-state": "warn",
794
- "react/no-use-context": "warn",
795
- "react/no-useless-forward-ref": "warn",
796
- "react/prefer-use-state-lazy-initialization": "warn",
797
- "react-dom/no-dangerously-set-innerhtml": "warn",
798
- "react-dom/no-dangerously-set-innerhtml-with-children": "error",
799
- "react-dom/no-find-dom-node": "error",
800
- "react-dom/no-flush-sync": "error",
801
- "react-dom/no-hydrate": "error",
802
- "react-dom/no-missing-button-type": "warn",
803
- "react-dom/no-missing-iframe-sandbox": "warn",
804
- "react-dom/no-namespace": "error",
805
- "react-dom/no-render": "error",
806
- "react-dom/no-render-return-value": "error",
807
- "react-dom/no-script-url": "warn",
808
- "react-dom/no-unsafe-iframe-sandbox": "warn",
809
- "react-dom/no-unsafe-target-blank": "warn",
810
- "react-dom/no-use-form-state": "error",
811
- "react-dom/no-void-elements-with-children": "error",
812
- ...plugin_react_hooks.configs.recommended.rules,
813
- "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
814
- "react-web-api/no-leaked-event-listener": "warn",
815
- "react-web-api/no-leaked-interval": "warn",
816
- "react-web-api/no-leaked-resize-observer": "warn",
817
- "react-web-api/no-leaked-timeout": "warn",
818
- "react-refresh/only-export-components": ["warn", {
819
- allowConstantExport: is_allow_constant_export,
820
- allowExportNames: [...is_using_next ? [
821
- "dynamic",
822
- "dynamicParams",
823
- "revalidate",
824
- "fetchCache",
825
- "runtime",
826
- "preferredRegion",
827
- "maxDuration",
828
- "config",
829
- "generateStaticParams",
830
- "metadata",
831
- "generateMetadata",
832
- "viewport",
833
- "generateViewport"
834
- ] : [], ...is_using_remix || is_using_react_router ? [
835
- "meta",
836
- "links",
837
- "headers",
838
- "loader",
839
- "action",
840
- "clientLoader",
841
- "clientAction",
842
- "handle",
843
- "shouldRevalidate"
844
- ] : []]
845
- }],
846
- ...overrides
847
- }
848
- },
849
- ...is_type_aware ? [{
850
- files: filesTypeAware,
851
- ignores: ignoresTypeAware,
852
- name: "ariel/react/type-aware-rules",
853
- rules: { ...type_aware_rules }
854
- }] : []
855
- ];
856
- }
857
-
858
- //#endregion
859
- //#region src/configs/jsdoc.ts
860
- async function jsdoc(options = {}) {
861
- const { stylistic: stylistic$1 = true } = options;
862
- return [{
863
- name: "ariel/jsdoc/rules",
864
- plugins: { jsdoc: await interop_default(import("eslint-plugin-jsdoc")) },
865
- rules: {
866
- "jsdoc/check-access": "warn",
867
- "jsdoc/check-param-names": "warn",
868
- "jsdoc/check-property-names": "warn",
869
- "jsdoc/check-types": "warn",
870
- "jsdoc/empty-tags": "warn",
871
- "jsdoc/implements-on-classes": "warn",
872
- "jsdoc/no-defaults": "warn",
873
- "jsdoc/no-multi-asterisks": "warn",
874
- "jsdoc/require-param-name": "warn",
875
- "jsdoc/require-property": "warn",
876
- "jsdoc/require-property-description": "warn",
877
- "jsdoc/require-property-name": "warn",
878
- "jsdoc/require-returns-check": "warn",
879
- "jsdoc/require-returns-description": "warn",
880
- "jsdoc/require-yields-check": "warn",
881
- ...stylistic$1 ? {
882
- "jsdoc/check-alignment": "warn",
883
- "jsdoc/multiline-blocks": "warn"
884
- } : {}
885
- }
886
- }];
887
- }
888
-
889
- //#endregion
890
- //#region src/configs/jsonc.ts
891
- async function jsonc(options = {}) {
892
- const { files = [
893
- GLOB_JSON,
894
- GLOB_JSON5,
895
- GLOB_JSONC
896
- ], overrides = {}, stylistic: stylistic$1 = true } = options;
897
- const { indent = 2 } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
898
- const [plugin_jsonc, parser_jsonc] = await Promise.all([interop_default(import("eslint-plugin-jsonc")), interop_default(import("jsonc-eslint-parser"))]);
899
- return [{
900
- name: "ariel/jsonc/setup",
901
- plugins: { jsonc: plugin_jsonc }
902
- }, {
903
- files,
904
- languageOptions: { parser: parser_jsonc },
905
- name: "ariel/jsonc/rules",
906
- rules: {
907
- "jsonc/no-bigint-literals": "error",
908
- "jsonc/no-binary-expression": "error",
909
- "jsonc/no-binary-numeric-literals": "error",
910
- "jsonc/no-dupe-keys": "error",
911
- "jsonc/no-escape-sequence-in-identifier": "error",
912
- "jsonc/no-floating-decimal": "error",
913
- "jsonc/no-hexadecimal-numeric-literals": "error",
914
- "jsonc/no-infinity": "error",
915
- "jsonc/no-multi-str": "error",
916
- "jsonc/no-nan": "error",
917
- "jsonc/no-number-props": "error",
918
- "jsonc/no-numeric-separators": "error",
919
- "jsonc/no-octal": "error",
920
- "jsonc/no-octal-escape": "error",
921
- "jsonc/no-octal-numeric-literals": "error",
922
- "jsonc/no-parenthesized": "error",
923
- "jsonc/no-plus-sign": "error",
924
- "jsonc/no-regexp-literals": "error",
925
- "jsonc/no-sparse-arrays": "error",
926
- "jsonc/no-template-literals": "error",
927
- "jsonc/no-undefined-value": "error",
928
- "jsonc/no-unicode-codepoint-escapes": "error",
929
- "jsonc/no-useless-escape": "error",
930
- "jsonc/space-unary-ops": "error",
931
- "jsonc/valid-json-number": "error",
932
- "jsonc/vue-custom-block/no-parsing-error": "error",
933
- ...stylistic$1 ? {
934
- "jsonc/array-bracket-spacing": ["error", "never"],
935
- "jsonc/comma-dangle": ["error", "never"],
936
- "jsonc/comma-style": ["error", "last"],
937
- "jsonc/indent": ["error", indent],
938
- "jsonc/key-spacing": ["error", {
939
- afterColon: true,
940
- beforeColon: false
941
- }],
942
- "jsonc/object-curly-newline": ["error", {
943
- consistent: true,
944
- multiline: true
945
- }],
946
- "jsonc/object-curly-spacing": ["error", "always"],
947
- "jsonc/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
948
- "jsonc/quote-props": "error",
949
- "jsonc/quotes": "error"
950
- } : {},
951
- ...overrides
952
- }
953
- }];
954
- }
955
-
956
- //#endregion
957
- //#region src/configs/nextjs.ts
958
- function normalize_rules(rules) {
959
- return Object.fromEntries(Object.entries(rules).map(([key, value]) => [key, typeof value === "string" ? [value] : value]));
960
- }
961
- async function nextjs(options = {}) {
962
- const { files = [GLOB_SRC], overrides = {} } = options;
963
- await ensure_packages(["@next/eslint-plugin-next"]);
964
- const plugin_nextjs = await interop_default(import("@next/eslint-plugin-next"));
965
- return [{
966
- name: "ariel/nextjs/setup",
967
- plugins: { next: plugin_nextjs }
968
- }, {
969
- files,
970
- languageOptions: {
971
- parserOptions: { ecmaFeatures: { jsx: true } },
972
- sourceType: "module"
973
- },
974
- name: "ariel/nextjs/rules",
975
- rules: {
976
- ...normalize_rules(plugin_nextjs.configs.recommended.rules),
977
- ...normalize_rules(plugin_nextjs.configs["core-web-vitals"].rules),
978
- ...overrides
979
- },
980
- settings: { react: { version: "detect" } }
981
- }];
982
- }
983
-
984
- //#endregion
985
- //#region src/configs/morgan.ts
986
- async function morgan() {
987
- return [{
988
- name: "ariel/morgan/rules",
989
- plugins: { morgan: plugin_morgan },
990
- rules: {
991
- "morgan/no-negated-conjunction": "error",
992
- "morgan/no-negated-disjunction": "error"
993
- }
994
- }];
995
- }
996
-
997
- //#endregion
998
- //#region src/configs/regexp.ts
999
- async function regexp(options = {}) {
1000
- const config = plugin_regexp["flat/recommended"];
1001
- const rules = { ...config.rules };
1002
- if (options.level === "warn") {
1003
- for (const key of Object.keys(rules)) if (rules[key] === "error") rules[key] = "warn";
1004
- }
1005
- return [{
1006
- ...config,
1007
- name: "ariel/regexp/rules",
1008
- rules: {
1009
- ...rules,
1010
- ...options.overrides
1011
- }
1012
- }];
1013
- }
1014
-
1015
- //#endregion
1016
- //#region src/configs/svelte.ts
1017
- async function svelte(options = {}) {
1018
- const { files = [GLOB_SVELTE], overrides = {}, stylistic: stylistic$1 = true } = options;
1019
- const { indent = "tab", quotes = "single" } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
1020
- await ensure_packages(["eslint-plugin-svelte"]);
1021
- const [plugin_svelte, parser_svelte] = await Promise.all([interop_default(import("eslint-plugin-svelte")), interop_default(import("svelte-eslint-parser"))]);
1022
- return [{
1023
- name: "ariel/svelte/setup",
1024
- plugins: { svelte: plugin_svelte }
1025
- }, {
1026
- files,
1027
- languageOptions: {
1028
- parser: parser_svelte,
1029
- parserOptions: {
1030
- extraFileExtensions: [".svelte"],
1031
- parser: options.typescript ? await interop_default(import("@typescript-eslint/parser")) : null
1032
- }
1033
- },
1034
- name: "ariel/svelte/rules",
1035
- processor: plugin_svelte.processors[".svelte"],
1036
- rules: {
1037
- "no-undef": "off",
1038
- "prefer-const": "off",
1039
- "no-unused-vars": ["error", {
1040
- args: "none",
1041
- caughtErrors: "none",
1042
- ignoreRestSiblings: true,
1043
- vars: "all",
1044
- varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1045
- }],
1046
- "svelte/comment-directive": "error",
1047
- "svelte/no-at-debug-tags": "warn",
1048
- "svelte/no-at-html-tags": "error",
1049
- "svelte/no-dupe-else-if-blocks": "error",
1050
- "svelte/no-dupe-style-properties": "error",
1051
- "svelte/no-dupe-use-directives": "error",
1052
- "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1053
- "svelte/no-inner-declarations": "error",
1054
- "svelte/no-not-function-handler": "error",
1055
- "svelte/no-object-in-text-mustaches": "error",
1056
- "svelte/no-reactive-functions": "error",
1057
- "svelte/no-reactive-literals": "error",
1058
- "svelte/no-shorthand-style-property-overrides": "error",
1059
- "svelte/no-unknown-style-directive-property": "error",
1060
- "svelte/no-unused-svelte-ignore": "error",
1061
- "svelte/no-useless-mustaches": "error",
1062
- "svelte/require-store-callbacks-use-set-param": "error",
1063
- "svelte/sort-attributes": "error",
1064
- "svelte/system": "error",
1065
- "svelte/valid-each-key": "error",
1066
- "style/indent": "off",
1067
- "unused-imports/no-unused-vars": ["error", {
1068
- args: "after-used",
1069
- argsIgnorePattern: "^_",
1070
- vars: "all",
1071
- varsIgnorePattern: "^(_|\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1072
- }],
1073
- ...stylistic$1 ? {
1074
- "style/no-trailing-spaces": "off",
1075
- "svelte/derived-has-same-inputs-outputs": "error",
1076
- "svelte/html-closing-bracket-spacing": "error",
1077
- "svelte/html-quotes": ["error", { prefer: quotes === "backtick" ? "single" : quotes }],
1078
- "svelte/indent": ["error", {
1079
- alignAttributesVertically: true,
1080
- indent
1081
- }],
1082
- "svelte/mustache-spacing": "error",
1083
- "svelte/no-spaces-around-equal-signs-in-attribute": "error",
1084
- "svelte/no-trailing-spaces": "error",
1085
- "svelte/spaced-html-comment": "error"
1086
- } : {},
1087
- ...overrides
1088
- }
1089
- }];
1090
- }
1091
-
1092
- //#endregion
1093
- //#region src/configs/ignores.ts
1094
- async function ignores(ignores$1 = []) {
1095
- return [{
1096
- name: "ariel/global-ignores",
1097
- ignores: [...GLOB_EXCLUDE, ...ignores$1]
1098
- }, {
1099
- name: "ariel/gitignore",
1100
- ...plugin_ignore({ strict: false })
1101
- }];
1102
- }
1103
-
1104
- //#endregion
1105
- //#region src/configs/imports.ts
1106
- async function imports(options = {}) {
1107
- const { overrides = {}, stylistic: stylistic$1 = true } = options;
1108
- return [{
1109
- name: "ariel/imports/rules",
1110
- plugins: {
1111
- ariel: plugin_ariel,
1112
- import: plugin_import
1113
- },
1114
- rules: {
1115
- "ariel/import-dedupe": "error",
1116
- "ariel/no-import-dist": "error",
1117
- "ariel/no-import-node-modules-by-path": "error",
1118
- "import/consistent-type-specifier-style": ["error", "top-level"],
1119
- "import/first": "error",
1120
- "import/no-duplicates": "error",
1121
- "import/no-mutable-exports": "error",
1122
- "import/no-named-default": "error",
1123
- "import/no-default-export": "off",
1124
- ...stylistic$1 ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
1125
- ...overrides
1126
- }
1127
- }];
1128
- }
1129
-
1130
- //#endregion
1131
- //#region src/configs/unicorn.ts
1132
- async function unicorn(options = {}) {
1133
- const { allRecommended = false, overrides = {} } = options;
1134
- return [{
1135
- name: "ariel/unicorn/rules",
1136
- plugins: { unicorn: plugin_unicorn },
1137
- rules: {
1138
- ...allRecommended ? plugin_unicorn.configs.recommended.rules : {
1139
- "unicorn/consistent-empty-array-spread": "error",
1140
- "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
1141
- "unicorn/custom-error-definition": "error",
1142
- "unicorn/filename-case": ["error", {
1143
- cases: {
1144
- kebabCase: true,
1145
- pascalCase: true
1146
- },
1147
- ignore: [/^[A-Z]+\..*$/, /import_map\.json/]
1148
- }],
1149
- "unicorn/error-message": "error",
1150
- "unicorn/escape-case": "error",
1151
- "unicorn/new-for-builtins": "error",
1152
- "unicorn/no-instanceof-builtins": "error",
1153
- "unicorn/no-new-array": "error",
1154
- "unicorn/no-new-buffer": "error",
1155
- "unicorn/no-useless-undefined": ["error", {
1156
- checkArguments: false,
1157
- checkArrowFunctionBody: false
1158
- }],
1159
- "unicorn/number-literal-case": "error",
1160
- "unicorn/prefer-classlist-toggle": "error",
1161
- "unicorn/prefer-dom-node-text-content": "error",
1162
- "unicorn/prefer-includes": "error",
1163
- "unicorn/prefer-node-protocol": "error",
1164
- "unicorn/prefer-number-properties": "error",
1165
- "unicorn/prefer-string-starts-ends-with": "error",
1166
- "unicorn/prefer-type-error": "error",
1167
- "unicorn/throw-new-error": "error"
1168
- },
1169
- ...overrides
1170
- }
1171
- }];
1172
- }
1173
-
1174
- //#endregion
1175
- //#region src/configs/comments.ts
1176
- async function comments() {
1177
- return [{
1178
- name: "ariel/eslint-comments/rules",
1179
- plugins: { "eslint-comments": plugin_comments },
1180
- rules: {
1181
- "eslint-comments/no-aggregating-enable": "error",
1182
- "eslint-comments/no-duplicate-disable": "error",
1183
- "eslint-comments/no-unlimited-disable": "error",
1184
- "eslint-comments/no-unused-enable": "error"
1185
- }
1186
- }];
1187
- }
1188
-
1189
- //#endregion
1190
- //#region src/configs/disables.ts
1191
- async function disables() {
1192
- return [
1193
- {
1194
- files: [`**/scripts/${GLOB_SRC}`],
1195
- name: "ariel/disables/scripts",
1196
- rules: {
1197
- "no-console": "off",
1198
- "ts/explicit-function-return-type": "off"
1199
- }
1200
- },
1201
- {
1202
- files: ["**/*.d.?([cm])ts"],
1203
- name: "ariel/disables/dts",
1204
- rules: {
1205
- "eslint-comments/no-unlimited-disable": "off",
1206
- "no-restricted-syntax": "off",
1207
- "unused-imports/no-unused-vars": "off"
1208
- }
1209
- },
1210
- {
1211
- files: ["**/*.js", "**/*.cjs"],
1212
- name: "ariel/disables/cjs",
1213
- rules: { "ts/no-require-imports": "off" }
1214
- },
1215
- {
1216
- files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
1217
- name: "ariel/disables/config-files",
1218
- rules: {
1219
- "no-console": "off",
1220
- "ts/explicit-function-return-type": "off"
1221
- }
1222
- }
1223
- ];
1224
- }
1225
-
1226
- //#endregion
1227
- //#region src/configs/markdown.ts
1228
- async function markdown(options = {}) {
1229
- const { componentExts = [], files = [GLOB_MARKDOWN], overrides = {} } = options;
1230
- const markdown$1 = await interop_default(import("@eslint/markdown"));
1231
- return [
1232
- {
1233
- name: "ariel/markdown/setup",
1234
- plugins: { markdown: markdown$1 }
1235
- },
1236
- {
1237
- files,
1238
- ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1239
- name: "ariel/markdown/processor",
1240
- processor: mergeProcessors([markdown$1.processors.markdown, processorPassThrough])
1241
- },
1242
- {
1243
- files,
1244
- languageOptions: { parser: parser_plain },
1245
- name: "ariel/markdown/parser"
1246
- },
1247
- {
1248
- files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
1249
- languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
1250
- name: "ariel/markdown/disables",
1251
- rules: {
1252
- "no-alert": "off",
1253
- "no-console": "off",
1254
- "no-labels": "off",
1255
- "no-lone-blocks": "off",
1256
- "no-restricted-syntax": "off",
1257
- "no-undef": "off",
1258
- "no-unused-expressions": "off",
1259
- "no-unused-labels": "off",
1260
- "no-unused-vars": "off",
1261
- "node/prefer-global/process": "off",
1262
- "style/comma-dangle": "off",
1263
- "style/eol-last": "off",
1264
- "style/padding-line-between-statements": "off",
1265
- "ts/consistent-type-imports": "off",
1266
- "ts/explicit-function-return-type": "off",
1267
- "ts/no-namespace": "off",
1268
- "ts/no-redeclare": "off",
1269
- "ts/no-require-imports": "off",
1270
- "ts/no-unused-expressions": "off",
1271
- "ts/no-unused-vars": "off",
1272
- "ts/no-use-before-define": "off",
1273
- "unicode-bom": "off",
1274
- "unused-imports/no-unused-imports": "off",
1275
- "unused-imports/no-unused-vars": "off",
1276
- ...overrides
1277
- }
1278
- }
1279
- ];
1280
- }
1281
-
1282
- //#endregion
1283
- //#region src/configs/stylistic.ts
1284
- const defaults = {
1285
- indent: "tab",
1286
- jsx: true,
1287
- quotes: "single",
1288
- semi: true
1289
- };
1290
- async function stylistic(options = {}) {
1291
- const { indent, jsx: jsx$1, overrides = {}, quotes, semi } = {
1292
- ...defaults,
1293
- ...options
1294
- };
1295
- const plugin_stylistic = await interop_default(import("@stylistic/eslint-plugin"));
1296
- const config = plugin_stylistic.configs.customize({
1297
- indent,
1298
- jsx: jsx$1,
1299
- pluginName: "style",
1300
- quotes,
1301
- semi
1302
- });
1303
- return [{
1304
- name: "ariel/stylistic/rules",
1305
- plugins: {
1306
- ariel: plugin_ariel,
1307
- style: plugin_stylistic
1308
- },
1309
- rules: {
1310
- ...config.rules,
1311
- "ariel/consistent-chaining": "error",
1312
- "ariel/consistent-list-newline": "error",
1313
- "ariel/if-newline": "error",
1314
- "ariel/curly": "error",
1315
- "style/generator-star-spacing": ["error", {
1316
- after: true,
1317
- before: false
1318
- }],
1319
- "style/yield-star-spacing": ["error", {
1320
- after: true,
1321
- before: false
1322
- }],
1323
- ...overrides
1324
- }
1325
- }];
1326
- }
1327
-
1328
- //#endregion
1329
- //#region src/configs/javascript.ts
1330
- async function javascript(options = {}) {
1331
- const { overrides = {} } = options;
1332
- return [{
1333
- languageOptions: {
1334
- ecmaVersion: "latest",
1335
- globals: {
1336
- ...globals.browser,
1337
- ...globals.es2026,
1338
- ...globals.node,
1339
- document: "readonly",
1340
- navigator: "readonly",
1341
- window: "readonly"
1342
- },
1343
- parserOptions: {
1344
- ecmaFeatures: { jsx: true },
1345
- ecmaVersion: "latest",
1346
- sourceType: "module"
1347
- },
1348
- sourceType: "module"
1349
- },
1350
- linterOptions: { reportUnusedDisableDirectives: true },
1351
- name: "ariel/javascript/setup"
1352
- }, {
1353
- name: "ariel/javascript/rules",
1354
- plugins: {
1355
- "ariel": plugin_ariel,
1356
- "unused-imports": plugin_unused_imports
1357
- },
1358
- rules: {
1359
- "accessor-pairs": ["error", {
1360
- enforceForClassMembers: true,
1361
- setWithoutGet: true
1362
- }],
1363
- "ariel/prefer-for-of": "warn",
1364
- "array-callback-return": "error",
1365
- "block-scoped-var": "error",
1366
- "constructor-super": "error",
1367
- "default-case-last": "error",
1368
- "dot-notation": ["error", { allowKeywords: true }],
1369
- "eqeqeq": ["error", "smart"],
1370
- "for-direction": "error",
1371
- "new-cap": ["error", {
1372
- capIsNew: false,
1373
- newIsCap: true,
1374
- properties: true
1375
- }],
1376
- "no-alert": "error",
1377
- "no-array-constructor": "error",
1378
- "no-async-promise-executor": "error",
1379
- "no-caller": "error",
1380
- "no-case-declarations": "error",
1381
- "no-class-assign": "error",
1382
- "no-compare-neg-zero": "error",
1383
- "no-cond-assign": ["error", "always"],
1384
- "no-console": ["warn", { allow: [
1385
- "warn",
1386
- "error",
1387
- "info",
1388
- "clear"
1389
- ] }],
1390
- "no-const-assign": "error",
1391
- "no-constant-binary-expression": "error",
1392
- "no-control-regex": "error",
1393
- "no-debugger": "error",
1394
- "no-delete-var": "error",
1395
- "no-dupe-args": "error",
1396
- "no-dupe-class-members": "error",
1397
- "no-dupe-keys": "error",
1398
- "no-duplicate-case": "error",
1399
- "no-duplicate-imports": "off",
1400
- "no-empty": ["error", { allowEmptyCatch: true }],
1401
- "no-empty-character-class": "error",
1402
- "no-empty-pattern": "error",
1403
- "no-eval": "error",
1404
- "no-ex-assign": "error",
1405
- "no-extend-native": "error",
1406
- "no-extra-bind": "error",
1407
- "no-extra-boolean-cast": "error",
1408
- "no-fallthrough": "error",
1409
- "no-func-assign": "error",
1410
- "no-global-assign": "error",
1411
- "no-implied-eval": "error",
1412
- "no-import-assign": "error",
1413
- "no-invalid-regexp": "error",
1414
- "no-irregular-whitespace": "error",
1415
- "no-iterator": "error",
1416
- "no-labels": ["error", {
1417
- allowLoop: false,
1418
- allowSwitch: false
1419
- }],
1420
- "no-lone-blocks": "error",
1421
- "no-lonely-if": "error",
1422
- "no-loss-of-precision": "error",
1423
- "no-misleading-character-class": "error",
1424
- "no-multi-str": "error",
1425
- "no-new": "error",
1426
- "no-new-func": "error",
1427
- "no-new-native-nonconstructor": "error",
1428
- "no-new-wrappers": "error",
1429
- "no-obj-calls": "error",
1430
- "no-octal": "error",
1431
- "no-octal-escape": "error",
1432
- "no-proto": "error",
1433
- "no-prototype-builtins": "error",
1434
- "no-redeclare": ["error", { builtinGlobals: false }],
1435
- "no-regex-spaces": "error",
1436
- "no-restricted-globals": [
1437
- "error",
1438
- {
1439
- message: "Use `globalThis` instead.",
1440
- name: "global"
1441
- },
1442
- {
1443
- message: "Use `globalThis` instead.",
1444
- name: "self"
1445
- }
1446
- ],
1447
- "no-restricted-properties": [
1448
- "error",
1449
- {
1450
- message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
1451
- property: "__proto__"
1452
- },
1453
- {
1454
- message: "Use `Object.defineProperty` instead.",
1455
- property: "__defineGetter__"
1456
- },
1457
- {
1458
- message: "Use `Object.defineProperty` instead.",
1459
- property: "__defineSetter__"
1460
- },
1461
- {
1462
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
1463
- property: "__lookupGetter__"
1464
- },
1465
- {
1466
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
1467
- property: "__lookupSetter__"
1468
- }
1469
- ],
1470
- "no-restricted-syntax": [
1471
- "error",
1472
- "TSEnumDeclaration[const=true]",
1473
- "TSExportAssignment",
1474
- "ForInStatement",
1475
- "LabeledStatement",
1476
- "WithStatement"
1477
- ],
1478
- "no-self-assign": ["error", { props: true }],
1479
- "no-self-compare": "error",
1480
- "no-sequences": "error",
1481
- "no-shadow-restricted-names": "error",
1482
- "no-sparse-arrays": "error",
1483
- "no-template-curly-in-string": "error",
1484
- "no-this-before-super": "error",
1485
- "no-throw-literal": "error",
1486
- "no-undef": "error",
1487
- "no-undef-init": "error",
1488
- "no-unexpected-multiline": "error",
1489
- "no-unmodified-loop-condition": "error",
1490
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
1491
- "no-unreachable": "error",
1492
- "no-unreachable-loop": "error",
1493
- "no-unsafe-finally": "error",
1494
- "no-unsafe-negation": "error",
1495
- "no-unsafe-optional-chaining": "error",
1496
- "no-unused-expressions": ["error", {
1497
- allowShortCircuit: true,
1498
- allowTaggedTemplates: true,
1499
- allowTernary: true
1500
- }],
1501
- "no-unused-private-class-members": "error",
1502
- "no-unused-vars": ["off"],
1503
- "no-use-before-define": ["error", {
1504
- classes: false,
1505
- functions: false,
1506
- variables: true
1507
- }],
1508
- "no-useless-backreference": "error",
1509
- "no-useless-call": "error",
1510
- "no-useless-catch": "error",
1511
- "no-useless-computed-key": "error",
1512
- "no-useless-constructor": "error",
1513
- "no-useless-rename": "error",
1514
- "no-useless-return": "error",
1515
- "no-var": "error",
1516
- "no-with": "error",
1517
- "object-shorthand": [
1518
- "error",
1519
- "always",
1520
- {
1521
- avoidQuotes: true,
1522
- ignoreConstructors: false
1523
- }
1524
- ],
1525
- "one-var": ["error", { initialized: "never" }],
1526
- "prefer-arrow-callback": ["error", {
1527
- allowNamedFunctions: false,
1528
- allowUnboundThis: true
1529
- }],
1530
- "prefer-const": ["warn", {
1531
- destructuring: "all",
1532
- ignoreReadBeforeAssign: true
1533
- }],
1534
- "prefer-exponentiation-operator": "error",
1535
- "prefer-promise-reject-errors": "error",
1536
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
1537
- "prefer-rest-params": "error",
1538
- "prefer-spread": "error",
1539
- "prefer-template": "error",
1540
- "require-yield": "error",
1541
- "symbol-description": "error",
1542
- "unicode-bom": ["error", "never"],
1543
- "unused-imports/no-unused-imports": "warn",
1544
- "unused-imports/no-unused-vars": ["error", {
1545
- args: "after-used",
1546
- argsIgnorePattern: "^_",
1547
- ignoreRestSiblings: true,
1548
- vars: "all",
1549
- varsIgnorePattern: "^_"
1550
- }],
1551
- "use-isnan": ["error", {
1552
- enforceForIndexOf: true,
1553
- enforceForSwitchCase: true
1554
- }],
1555
- "valid-typeof": ["error", { requireStringLiterals: true }],
1556
- "vars-on-top": "error",
1557
- "yoda": ["error", "never"],
1558
- ...overrides
1559
- }
1560
- }];
1561
- }
1562
-
1563
- //#endregion
1564
- //#region src/configs/typescript.ts
1565
- async function typescript(options = {}) {
1566
- const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
1567
- const files = options.files ?? [
1568
- GLOB_TS,
1569
- GLOB_JSX,
1570
- ...componentExts.map((ext) => `**/*.${ext}`)
1571
- ];
1572
- const files_type_aware = options.filesTypeAware ?? [GLOB_TS, GLOB_JSX];
1573
- const ignores_type_aware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`];
1574
- const tsconfig_path = options?.tsconfigPath ? options.tsconfigPath : void 0;
1575
- const is_type_aware = !!tsconfig_path;
1576
- const type_aware_rules = {
1577
- "dot-notation": "off",
1578
- "no-implied-eval": "off",
1579
- "ts/await-thenable": "error",
1580
- "ts/dot-notation": ["error", { allowKeywords: true }],
1581
- "ts/no-floating-promises": "error",
1582
- "ts/no-for-in-array": "error",
1583
- "ts/no-implied-eval": "error",
1584
- "ts/no-misused-promises": "error",
1585
- "ts/no-unnecessary-type-assertion": "error",
1586
- "ts/no-unsafe-argument": "error",
1587
- "ts/no-unsafe-assignment": "error",
1588
- "ts/no-unsafe-call": "error",
1589
- "ts/no-unsafe-member-access": "error",
1590
- "ts/no-unsafe-return": "error",
1591
- "ts/promise-function-async": "error",
1592
- "ts/restrict-plus-operands": "error",
1593
- "ts/restrict-template-expressions": "error",
1594
- "ts/return-await": ["error", "in-try-catch"],
1595
- "ts/strict-boolean-expressions": ["error", {
1596
- allowNullableBoolean: true,
1597
- allowNullableObject: true
1598
- }],
1599
- "ts/switch-exhaustiveness-check": "error",
1600
- "ts/unbound-method": "error"
1601
- };
1602
- const [plugin_ts, parser_ts] = await Promise.all([interop_default(import("@typescript-eslint/eslint-plugin")), interop_default(import("@typescript-eslint/parser"))]);
1603
- function make_parser(type_aware, files$1, ignores$1) {
1604
- return {
1605
- files: files$1,
1606
- ...ignores$1 ? { ignores: ignores$1 } : {},
1607
- languageOptions: {
1608
- parser: parser_ts,
1609
- parserOptions: {
1610
- extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1611
- sourceType: "module",
1612
- ...type_aware ? {
1613
- projectService: {
1614
- allowDefaultProject: ["./*.js"],
1615
- defaultProject: tsconfig_path
1616
- },
1617
- tsconfigRootDir: process$1.cwd()
1618
- } : {},
1619
- ...parserOptions
1620
- }
1621
- },
1622
- name: `ariel/typescript/${type_aware ? "type-aware-parser" : "parser"}`
1623
- };
1624
- }
1625
- return [
1626
- {
1627
- name: "ariel/typescript/setup",
1628
- plugins: {
1629
- ariel: plugin_ariel,
1630
- ts: plugin_ts
1631
- }
1632
- },
1633
- ...is_type_aware ? [make_parser(false, files), make_parser(true, files_type_aware, ignores_type_aware)] : [make_parser(false, files)],
1634
- {
1635
- files,
1636
- name: "ariel/typescript/rules",
1637
- rules: {
1638
- ...rename_rules(plugin_ts.configs["eslint-recommended"].overrides[0].rules, { "@typescript-eslint": "ts" }),
1639
- ...rename_rules(plugin_ts.configs.strict.rules, { "@typescript-eslint": "ts" }),
1640
- "no-dupe-class-members": "off",
1641
- "no-redeclare": "off",
1642
- "no-use-before-define": "off",
1643
- "no-useless-constructor": "error",
1644
- "ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
1645
- "ts/consistent-type-definitions": ["error", "interface"],
1646
- "ts/consistent-type-imports": ["error", {
1647
- disallowTypeAnnotations: false,
1648
- fixStyle: "separate-type-imports",
1649
- prefer: "type-imports"
1650
- }],
1651
- "ts/method-signature-style": ["error", "property"],
1652
- "ts/no-dupe-class-members": "error",
1653
- "ts/no-dynamic-delete": "off",
1654
- "ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
1655
- "ts/no-explicit-any": "off",
1656
- "ts/no-extraneous-class": "off",
1657
- "ts/no-import-type-side-effects": "error",
1658
- "ts/no-invalid-void-type": "off",
1659
- "ts/no-non-null-assertion": "off",
1660
- "ts/no-redeclare": ["error", { builtinGlobals: false }],
1661
- "ts/no-require-imports": "error",
1662
- "ts/no-unused-expressions": ["error", {
1663
- allowShortCircuit: true,
1664
- allowTaggedTemplates: true,
1665
- allowTernary: true
1666
- }],
1667
- "ts/no-unused-vars": "off",
1668
- "ts/no-use-before-define": ["error", {
1669
- classes: false,
1670
- functions: false,
1671
- variables: true
1672
- }],
1673
- "ts/no-useless-constructor": "off",
1674
- "ts/no-wrapper-object-types": "error",
1675
- "ts/triple-slash-reference": "off",
1676
- "ts/unified-signatures": "off",
1677
- ...type === "lib" ? { "ts/explicit-function-return-type": ["error", {
1678
- allowExpressions: true,
1679
- allowHigherOrderFunctions: true,
1680
- allowIIFEs: true
1681
- }] } : {},
1682
- ...overrides
1683
- }
1684
- },
1685
- ...is_type_aware ? [{
1686
- files: files_type_aware,
1687
- ignores: ignores_type_aware,
1688
- name: "ariel/typescript/rules-type-aware",
1689
- rules: {
1690
- ...type_aware_rules,
1691
- ...overridesTypeAware
1692
- }
1693
- }] : []
1694
- ];
1695
- }
1696
-
1697
- //#endregion
1698
- //#region src/configs/tailwindcss.ts
1699
- async function tailwindcss(options = {}) {
1700
- const { files = [
1701
- GLOB_SVELTE,
1702
- GLOB_JSX,
1703
- GLOB_TSX
1704
- ], overrides = {}, entryPoint = "src/app.css", printWidth = 100, stylistic: stylistic$1 = true } = options;
1705
- const { indent = "tab" } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
1706
- await ensure_packages(["eslint-plugin-better-tailwindcss"]);
1707
- const plugin_tailwindcss = await interop_default(import("eslint-plugin-better-tailwindcss"));
1708
- return [{
1709
- name: "ariel/tailwindcss/setup",
1710
- plugins: { tailwindcss: plugin_tailwindcss }
1711
- }, {
1712
- files,
1713
- name: "ariel/tailwindcss/rules",
1714
- rules: {
1715
- ...plugin_tailwindcss.configs.recommended.rules,
1716
- "tailwindcss/enforce-consistent-line-wrapping": ["error", {
1717
- indent,
1718
- printWidth,
1719
- preferSingleLine: true
1720
- }],
1721
- "tailwindcss/enforce-consistent-important-position": "error",
1722
- "tailwindcss/enforce-shorthand-classes": "error",
1723
- "tailwindcss/no-deprecated-classes": "error",
1724
- "tailwindcss/no-unregistered-classes": ["error", { detectComponentClasses: true }],
1725
- ...overrides
1726
- },
1727
- settings: { "better-tailwindcss": { entryPoint } }
1728
- }];
1729
- }
1730
-
1731
- //#endregion
1732
- //#region src/configs/perfectionist.ts
1733
- async function perfectionist() {
1734
- return [{
1735
- name: "ariel/perfectionist/setup",
1736
- plugins: { perfectionist: plugin_perfectionist },
1737
- rules: {
1738
- "perfectionist/sort-exports": ["error", {
1739
- order: "asc",
1740
- type: "line-length",
1741
- groups: ["type-export", "value-export"],
1742
- newlinesBetween: 1
1743
- }],
1744
- "perfectionist/sort-imports": ["error", {
1745
- type: "line-length",
1746
- order: "asc",
1747
- groups: [
1748
- "type-default",
1749
- "type-named",
1750
- "side-effect",
1751
- "external-default",
1752
- "external-named",
1753
- "internal",
1754
- "parent",
1755
- "sibling",
1756
- "index"
1757
- ],
1758
- customGroups: [
1759
- {
1760
- groupName: "type-default",
1761
- selector: "type",
1762
- modifiers: ["default"]
1763
- },
1764
- {
1765
- groupName: "type-named",
1766
- selector: "type",
1767
- modifiers: ["named"]
1768
- },
1769
- {
1770
- groupName: "external-default",
1771
- selector: "external",
1772
- modifiers: ["default"]
1773
- },
1774
- {
1775
- groupName: "external-named",
1776
- selector: "external",
1777
- modifiers: ["named"]
1778
- }
1779
- ],
1780
- newlinesBetween: "always",
1781
- sortSideEffects: true
1782
- }],
1783
- "perfectionist/sort-named-imports": ["error", {
1784
- order: "asc",
1785
- type: "line-length"
1786
- }],
1787
- "perfectionist/sort-named-exports": ["error", {
1788
- order: "asc",
1789
- type: "line-length"
1790
- }]
1791
- }
1792
- }];
1793
- }
1794
-
1795
- //#endregion
1796
- //#region src/factory.ts
1797
- const flat_config_props = [
1798
- "name",
1799
- "languageOptions",
1800
- "linterOptions",
1801
- "processor",
1802
- "plugins",
1803
- "rules",
1804
- "settings"
1805
- ];
1806
- const default_plugin_renaming = {
1807
- "@eslint-react": "react",
1808
- "@eslint-react/dom": "react-dom",
1809
- "@eslint-react/hooks-extra": "react-hooks-extra",
1810
- "@eslint-react/naming-convention": "react-naming-convention",
1811
- "@next/next": "next",
1812
- "@stylistic": "style",
1813
- "@typescript-eslint": "ts",
1814
- "better-tailwindcss": "tailwindcss",
1815
- "import-lite": "import",
1816
- "n": "node",
1817
- "vitest": "test",
1818
- "yml": "yaml"
1819
- };
1820
- /**
1821
- * Construct an array of ESLint flat config items.
1822
- *
1823
- * @param {OptionsConfig & TypedFlatConfigItem} options
1824
- * The options for generating the ESLint configurations.
1825
- * @param {Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>[]} userConfigs
1826
- * The user configurations to be merged with the generated configurations.
1827
- * @returns {Promise<TypedFlatConfigItem[]>}
1828
- * The merged ESLint configurations.
1829
- */
1830
- function ariel(options = {}, ...userConfigs) {
1831
- const { autoRenamePlugins = true, componentExts = [], gitignore: enable_git_ignore = true, imports: enable_imports = true, jsx: enable_jsx = true, nextjs: enable_nextjs = has_nextjs(), pnpm: enable_catalogs = false, 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;
1832
- const is_in_editor = is_in_editor_env();
1833
- if (is_in_editor) console.log("[@ariel-salgado/eslint-config] Detected running in editor, some rules are disabled.");
1834
- const stylistic_options = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
1835
- if (stylistic_options && !("jsx" in stylistic_options)) stylistic_options.jsx = typeof enable_jsx === "object" ? true : enable_jsx;
1836
- const configs = [];
1837
- if (enable_git_ignore) if (typeof enable_git_ignore !== "boolean") configs.push(interop_default(import("eslint-config-flat-gitignore")).then((r) => [r({
1838
- name: "ariel/gitignore",
1839
- ...enable_git_ignore
1840
- })]));
1841
- else configs.push(interop_default(import("eslint-config-flat-gitignore")).then((r) => [r({
1842
- name: "ariel/gitignore",
1843
- strict: false
1844
- })]));
1845
- const typescript_options = resolve_sub_options(options, "typescript");
1846
- const tsconfig_path = "tsconfigPath" in typescript_options ? typescript_options.tsconfigPath : void 0;
1847
- configs.push(ignores(options.ignores), javascript({ overrides: get_overrides(options, "javascript") }), comments(), node(), jsdoc({ stylistic: stylistic_options }), imports({ stylistic: stylistic_options }), perfectionist(), morgan());
1848
- if (enable_imports) configs.push(imports(enable_imports === true ? { stylistic: stylistic_options } : {
1849
- stylistic: stylistic_options,
1850
- ...enable_imports
1851
- }));
1852
- if (enable_unicorn) configs.push(unicorn(enable_unicorn === true ? {} : enable_unicorn));
1853
- if (enable_jsx) configs.push(jsx(enable_jsx === true ? {} : enable_jsx));
1854
- if (enable_typescript) configs.push(typescript({
1855
- ...typescript_options,
1856
- componentExts,
1857
- overrides: get_overrides(options, "typescript"),
1858
- type: options.type
1859
- }));
1860
- if (stylistic_options) configs.push(stylistic({
1861
- ...stylistic_options,
1862
- overrides: get_overrides(options, "stylistic")
1863
- }));
1864
- if (enable_regexp) configs.push(regexp(typeof enable_regexp === "boolean" ? {} : enable_regexp));
1865
- if (options.test ?? true) configs.push(test({ overrides: get_overrides(options, "test") }));
1866
- if (enable_react) configs.push(react({
1867
- ...typescript_options,
1868
- overrides: get_overrides(options, "react"),
1869
- tsconfigPath: tsconfig_path
1870
- }));
1871
- if (enable_nextjs) configs.push(nextjs({ overrides: get_overrides(options, "nextjs") }));
1872
- if (enable_solid) configs.push(solid({
1873
- overrides: get_overrides(options, "solid"),
1874
- tsconfigPath: tsconfig_path,
1875
- typescript: !!enable_typescript
1876
- }));
1877
- if (enable_svelte) configs.push(svelte({
1878
- overrides: get_overrides(options, "svelte"),
1879
- stylistic: stylistic_options,
1880
- typescript: !!enable_typescript
1881
- }));
1882
- if (enable_tailwindcss) configs.push(tailwindcss({
1883
- overrides: get_overrides(options, "tailwindcss"),
1884
- stylistic: stylistic_options
1885
- }));
1886
- if (options.jsonc ?? true) configs.push(jsonc({
1887
- overrides: get_overrides(options, "jsonc"),
1888
- stylistic: stylistic_options
1889
- }), sort_package_json(), sort_ts_config());
1890
- if (enable_catalogs) configs.push(pnpm());
1891
- if (options.yaml ?? true) configs.push(yaml({
1892
- overrides: get_overrides(options, "yaml"),
1893
- stylistic: stylistic_options
1894
- }));
1895
- if (options.toml ?? true) configs.push(toml({
1896
- overrides: get_overrides(options, "toml"),
1897
- stylistic: stylistic_options
1898
- }));
1899
- if (options.markdown ?? true) configs.push(markdown({
1900
- componentExts,
1901
- overrides: get_overrides(options, "markdown")
1902
- }));
1903
- configs.push(disables());
1904
- 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.");
1905
- const merged_config = flat_config_props.reduce((acc, key) => {
1906
- if (key in options) acc[key] = options[key];
1907
- return acc;
1908
- }, {});
1909
- if (Object.keys(merged_config).length) configs.push([merged_config]);
1910
- let composer = new FlatConfigComposer();
1911
- composer = composer.append(...configs, ...userConfigs);
1912
- if (autoRenamePlugins) composer = composer.renamePlugins(default_plugin_renaming);
1913
- if (is_in_editor) composer = composer.disableRulesFix([
1914
- "unused-imports/no-unused-imports",
1915
- "test/no-only-tests",
1916
- "prefer-const"
1917
- ], { builtinRules: () => import(["eslint", "use-at-your-own-risk"].join("/")).then((r) => r.builtinRules) });
1918
- return composer;
1919
- }
1920
- function resolve_sub_options(options, key) {
1921
- return typeof options[key] === "boolean" ? {} : options[key] || {};
1922
- }
1923
- function get_overrides(options, key) {
1924
- const sub = resolve_sub_options(options, key);
1925
- return {
1926
- ...options.overrides?.[key],
1927
- ..."overrides" in sub ? sub.overrides : {}
1928
- };
1929
- }
1930
-
1931
- //#endregion
1932
- //#region src/index.ts
1933
- var src_default = ariel;
1934
-
1935
- //#endregion
1936
- 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, ariel, combine, comments, src_default as default, default_plugin_renaming, defaults, 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 };