@hexadrop/eslint-config 0.0.1-beta.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 ADDED
@@ -0,0 +1,1918 @@
1
+ // src/factory.ts
2
+ import { FlatConfigComposer } from "eslint-flat-config-utils";
3
+
4
+ // src/config/astro/astro.config.ts
5
+ import globals from "globals";
6
+
7
+ // src/utils/combine.ts
8
+ async function combine(...configs) {
9
+ const resolved = await Promise.all(configs);
10
+ return resolved.flat();
11
+ }
12
+
13
+ // src/utils/extract-typed-flat-config-item.ts
14
+ var flatConfigProperties = [
15
+ "name",
16
+ "files",
17
+ "ignores",
18
+ "languageOptions",
19
+ "linterOptions",
20
+ "processor",
21
+ "plugins",
22
+ "rules",
23
+ "settings"
24
+ ];
25
+ function extractTypedFlatConfigItem(config) {
26
+ if (!config) {
27
+ return void 0;
28
+ }
29
+ const result = {};
30
+ for (const key of flatConfigProperties) {
31
+ if (key in config) {
32
+ result[key] = config[key];
33
+ }
34
+ }
35
+ if (Object.keys(result).length === 0) {
36
+ return void 0;
37
+ }
38
+ return result;
39
+ }
40
+
41
+ // src/utils/interop-default.ts
42
+ async function interopDefault(m) {
43
+ const resolved = await m;
44
+ return resolved.default || resolved;
45
+ }
46
+
47
+ // src/utils/plugin-config-override-rules.ts
48
+ import "eslint";
49
+
50
+ // src/utils/rename-rules.ts
51
+ function renameRules(rules, map) {
52
+ if (Object.keys(map).length === 0) {
53
+ return rules;
54
+ }
55
+ return Object.fromEntries(
56
+ Object.entries(rules).map(([key, value]) => {
57
+ for (const [from, to] of Object.entries(map)) {
58
+ if (key.startsWith(`${from}/`)) {
59
+ return [to + key.slice(from.length), value];
60
+ }
61
+ }
62
+ return [key, value];
63
+ })
64
+ );
65
+ }
66
+
67
+ // src/utils/plugin-config-override-rules.ts
68
+ function pluginConfigOverrideRules(plugin, configName, indexOrMap, map2) {
69
+ let index = 0;
70
+ let map = {};
71
+ if (typeof indexOrMap === "number") {
72
+ index = indexOrMap;
73
+ }
74
+ if (typeof indexOrMap === "object") {
75
+ map = indexOrMap;
76
+ } else if (typeof map2 === "object") {
77
+ map = map2;
78
+ }
79
+ let rules = {};
80
+ if (plugin.configs && configName in plugin.configs) {
81
+ const config = plugin.configs[configName];
82
+ if (config && "overrides" in config) {
83
+ const overrides = config.overrides;
84
+ const indexOverride = overrides ? overrides[index] : void 0;
85
+ if (indexOverride?.rules) {
86
+ rules = indexOverride.rules;
87
+ }
88
+ }
89
+ }
90
+ return renameRules(rules, map);
91
+ }
92
+ var plugin_config_override_rules_default = pluginConfigOverrideRules;
93
+
94
+ // src/utils/plugin-config-rules.ts
95
+ import "eslint";
96
+ function pluginConfigRules(plugin, configName, map = {}) {
97
+ let rules = {};
98
+ if (plugin.configs && configName in plugin.configs) {
99
+ const config = plugin.configs[configName];
100
+ if (config && "rules" in config && config.rules) {
101
+ rules = config.rules;
102
+ }
103
+ }
104
+ return renameRules(rules, map);
105
+ }
106
+
107
+ // src/utils/to-array.ts
108
+ function toArray(value) {
109
+ return Array.isArray(value) ? value : [value];
110
+ }
111
+
112
+ // src/const/plugin-prefix.ts
113
+ var PLUGIN_PREFIX = "hexadrop";
114
+ var plugin_prefix_default = PLUGIN_PREFIX;
115
+
116
+ // src/const/plugin-rename-typescript.ts
117
+ var PLUGIN_RENAME_TYPESCRIPT = {
118
+ "@typescript-eslint": "typescript"
119
+ };
120
+ var plugin_rename_typescript_default = PLUGIN_RENAME_TYPESCRIPT;
121
+
122
+ // src/const/plugin-rename.ts
123
+ var PLUGIN_RENAME = {
124
+ ...plugin_rename_typescript_default,
125
+ "@stylistic": "style",
126
+ "import-x": "import",
127
+ jsonc: "json",
128
+ n: "node",
129
+ "simple-import-sort": "import-sort",
130
+ "unused-imports": "import-unused",
131
+ vitest: "test",
132
+ yml: "yaml"
133
+ };
134
+ var plugin_rename_default = PLUGIN_RENAME;
135
+
136
+ // src/config/astro/astro.config-name.ts
137
+ var ASTRO_CONFIG_NAME = `${plugin_prefix_default}/astro`;
138
+ var ASTRO_CONFIG_NAME_SETUP = `${ASTRO_CONFIG_NAME}/setup`;
139
+ var ASTRO_CONFIG_NAME_SETUP_PARSER = `${ASTRO_CONFIG_NAME_SETUP}/parser`;
140
+ var ASTRO_CONFIG_NAME_SETUP_PARSER_JAVASCRIPT = `${ASTRO_CONFIG_NAME_SETUP_PARSER}/javascript`;
141
+ var ASTRO_CONFIG_NAME_SETUP_PARSER_TYPESCRIPT = `${ASTRO_CONFIG_NAME_SETUP_PARSER}/typescript`;
142
+ var ASTRO_CONFIG_NAME_RULES = `${ASTRO_CONFIG_NAME}/rules`;
143
+
144
+ // src/config/astro/astro.globs.ts
145
+ var GLOB_ASTRO = ["*.astro", "**/*.astro"];
146
+ var GLOB_ASTRO_JAVASCRIPT = ["**/*.astro/*.js", "*.astro/*.js"];
147
+ var GLOB_ASTRO_TYPESCRIPT = ["**/*.astro/*.ts", "*.astro/*.ts"];
148
+
149
+ // src/config/astro/astro.config.ts
150
+ async function astro(options) {
151
+ const { astro: astro2, typescript: typescript2 } = options;
152
+ if (!astro2) {
153
+ return [];
154
+ }
155
+ const [plugin, parser, parserTypescript] = await Promise.all([
156
+ interopDefault(import("eslint-plugin-astro")),
157
+ interopDefault(import("astro-eslint-parser")),
158
+ interopDefault(import("@typescript-eslint/parser"))
159
+ ]);
160
+ const configs = [
161
+ {
162
+ name: ASTRO_CONFIG_NAME_SETUP,
163
+ plugins: {
164
+ astro: plugin
165
+ }
166
+ },
167
+ {
168
+ files: GLOB_ASTRO,
169
+ languageOptions: {
170
+ globals: {
171
+ ...globals.node,
172
+ Astro: false,
173
+ Fragment: false
174
+ },
175
+ parser,
176
+ parserOptions: {
177
+ extraFileExtensions: [".astro"],
178
+ parser: typescript2 ? parserTypescript : void 0
179
+ },
180
+ sourceType: "module"
181
+ },
182
+ name: ASTRO_CONFIG_NAME_SETUP_PARSER,
183
+ processor: typescript2 ? "astro/client-side-ts" : "astro/astro"
184
+ },
185
+ {
186
+ files: GLOB_ASTRO_JAVASCRIPT,
187
+ languageOptions: {
188
+ globals: {
189
+ ...globals.browser
190
+ },
191
+ sourceType: "module"
192
+ },
193
+ name: ASTRO_CONFIG_NAME_SETUP_PARSER_JAVASCRIPT
194
+ }
195
+ ];
196
+ if (typescript2) {
197
+ configs.push({
198
+ files: GLOB_ASTRO_TYPESCRIPT,
199
+ languageOptions: {
200
+ globals: {
201
+ ...globals.browser
202
+ },
203
+ parser: parserTypescript,
204
+ parserOptions: {
205
+ project: typescript2 === true ? void 0 : toArray(typescript2)
206
+ },
207
+ sourceType: "module"
208
+ },
209
+ name: ASTRO_CONFIG_NAME_SETUP_PARSER_JAVASCRIPT
210
+ });
211
+ }
212
+ configs.push({
213
+ files: GLOB_ASTRO,
214
+ name: ASTRO_CONFIG_NAME_RULES,
215
+ rules: {
216
+ "astro/missing-client-only-directive-value": "error",
217
+ "astro/no-conflict-set-directives": "error",
218
+ "astro/no-deprecated-astro-canonicalurl": "error",
219
+ "astro/no-deprecated-astro-fetchcontent": "error",
220
+ "astro/no-deprecated-astro-resolve": "error",
221
+ "astro/no-deprecated-getentrybyslug": "error",
222
+ "astro/no-unused-define-vars-in-style": "error",
223
+ "astro/valid-compile": "error",
224
+ "no-useless-assignment": "off"
225
+ }
226
+ });
227
+ return configs;
228
+ }
229
+
230
+ // src/config/core/core.config.ts
231
+ import globals2 from "globals";
232
+
233
+ // src/config/markdown/markdown.config.ts
234
+ import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
235
+ import { parseForESLint } from "eslint-parser-plain";
236
+
237
+ // src/config/markdown/markdown.config-name.ts
238
+ var MARKDOWN_CONFIG_NAME = `${plugin_prefix_default}/markdown`;
239
+ var MARKDOWN_CONFIG_NAME_SETUP = `${MARKDOWN_CONFIG_NAME}/setup`;
240
+ var MARKDOWN_CONFIG_NAME_SETUP_PROCESSOR = `${MARKDOWN_CONFIG_NAME_SETUP}/processor`;
241
+ var MARKDOWN_CONFIG_NAME_SETUP_PARSER = `${MARKDOWN_CONFIG_NAME_SETUP}/parser`;
242
+
243
+ // src/config/core/core.globs.ts
244
+ var SOURCE_GLOBS = ["**/*.?([cm])[jt]s?(x)"];
245
+ var JAVASCRIPT_GLOBS = ["**/*.?([cm])js?(x)"];
246
+
247
+ // src/config/json/json.config-name.ts
248
+ var JSON_CONFIG_NAME = `${plugin_prefix_default}/json`;
249
+ var JSON_CONFIG_NAME_SETUP = `${JSON_CONFIG_NAME}/setup`;
250
+ var JSON_CONFIG_NAME_SETUP_PARSER = `${JSON_CONFIG_NAME_SETUP}/parser`;
251
+ var JSON_CONFIG_NAME_RULES = `${JSON_CONFIG_NAME}/rules`;
252
+
253
+ // src/config/json/json.globs.ts
254
+ var GLOB_JSON = ["**/*.json", "**/*.json5", "**/*.jsonc"];
255
+ var GLOB_JSON_PACKAGE = ["**/package.json"];
256
+ var GLOB_JSON_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
257
+
258
+ // src/config/json/json.config.ts
259
+ async function json(options) {
260
+ const { json: json2 } = options;
261
+ if (!json2) {
262
+ return [];
263
+ }
264
+ const [pluginJsonc, parserJsonc] = await Promise.all([
265
+ interopDefault(import("eslint-plugin-jsonc")),
266
+ interopDefault(import("jsonc-eslint-parser"))
267
+ ]);
268
+ const jsonPluginRename = plugin_rename_default.jsonc;
269
+ return [
270
+ {
271
+ name: JSON_CONFIG_NAME_SETUP,
272
+ plugins: {
273
+ [jsonPluginRename]: pluginJsonc
274
+ }
275
+ },
276
+ {
277
+ files: GLOB_JSON,
278
+ languageOptions: {
279
+ parser: parserJsonc
280
+ },
281
+ name: JSON_CONFIG_NAME_SETUP_PARSER
282
+ },
283
+ {
284
+ files: GLOB_JSON,
285
+ name: JSON_CONFIG_NAME_RULES,
286
+ rules: {
287
+ [`${jsonPluginRename}/no-bigint-literals`]: "error",
288
+ [`${jsonPluginRename}/no-binary-expression`]: "error",
289
+ [`${jsonPluginRename}/no-binary-numeric-literals`]: "error",
290
+ [`${jsonPluginRename}/no-dupe-keys`]: "error",
291
+ [`${jsonPluginRename}/no-escape-sequence-in-identifier`]: "error",
292
+ [`${jsonPluginRename}/no-floating-decimal`]: "error",
293
+ [`${jsonPluginRename}/no-hexadecimal-numeric-literals`]: "error",
294
+ [`${jsonPluginRename}/no-infinity`]: "error",
295
+ [`${jsonPluginRename}/no-multi-str`]: "error",
296
+ [`${jsonPluginRename}/no-nan`]: "error",
297
+ [`${jsonPluginRename}/no-number-props`]: "error",
298
+ [`${jsonPluginRename}/no-numeric-separators`]: "error",
299
+ [`${jsonPluginRename}/no-octal`]: "error",
300
+ [`${jsonPluginRename}/no-octal-escape`]: "error",
301
+ [`${jsonPluginRename}/no-octal-numeric-literals`]: "error",
302
+ [`${jsonPluginRename}/no-parenthesized`]: "error",
303
+ [`${jsonPluginRename}/no-plus-sign`]: "error",
304
+ [`${jsonPluginRename}/no-regexp-literals`]: "error",
305
+ [`${jsonPluginRename}/no-sparse-arrays`]: "error",
306
+ [`${jsonPluginRename}/no-template-literals`]: "error",
307
+ [`${jsonPluginRename}/no-undefined-value`]: "error",
308
+ [`${jsonPluginRename}/no-unicode-codepoint-escapes`]: "error",
309
+ [`${jsonPluginRename}/no-useless-escape`]: "error",
310
+ [`${jsonPluginRename}/space-unary-ops`]: "error",
311
+ [`${jsonPluginRename}/valid-json-number`]: "error",
312
+ [`${jsonPluginRename}/vue-custom-block/no-parsing-error`]: "error"
313
+ }
314
+ }
315
+ ];
316
+ }
317
+
318
+ // src/config/markdown/markdown.globs.ts
319
+ var GLOB_MARKDOWN = ["**/*.md"];
320
+ var GLOB_MARKDOWN_IN_MARKDOWN = ["**/*.md/*.md"];
321
+ var GLOB_MARKDOWN_SOURCE = SOURCE_GLOBS.flatMap((source) => GLOB_MARKDOWN.map((markdown2) => `${markdown2}/${source}`));
322
+ var GLOB_MARKDOWN_JSON = GLOB_JSON.flatMap((json2) => GLOB_MARKDOWN.map((markdown2) => `${markdown2}/${json2}`));
323
+ var GLOB_MARKDOWN_ASTRO = GLOB_ASTRO.flatMap((json2) => GLOB_MARKDOWN.map((markdown2) => `${markdown2}/${json2}`));
324
+
325
+ // src/config/markdown/markdown.config.ts
326
+ async function markdown(options) {
327
+ const { markdown: markdown2 } = options;
328
+ if (!markdown2) {
329
+ return [];
330
+ }
331
+ const pluginMarkdown = await interopDefault(import("eslint-plugin-markdown"));
332
+ const processors = pluginMarkdown.processors;
333
+ const processor = processors?.["markdown"];
334
+ return [
335
+ {
336
+ name: MARKDOWN_CONFIG_NAME_SETUP,
337
+ plugins: {
338
+ markdown: pluginMarkdown
339
+ }
340
+ },
341
+ {
342
+ files: GLOB_MARKDOWN,
343
+ ignores: GLOB_MARKDOWN_IN_MARKDOWN,
344
+ name: MARKDOWN_CONFIG_NAME_SETUP_PROCESSOR,
345
+ /*
346
+ * `eslint-plugin-markdown` only creates virtual files for code blocks,
347
+ * but not the markdown file itself. We use `eslint-merge-processors` to
348
+ * add a pass-through processor for the markdown file itself.
349
+ */
350
+ processor: mergeProcessors([processor, processorPassThrough])
351
+ },
352
+ {
353
+ files: GLOB_MARKDOWN,
354
+ languageOptions: {
355
+ parser: {
356
+ parseForESLint
357
+ }
358
+ },
359
+ name: MARKDOWN_CONFIG_NAME_SETUP_PARSER
360
+ }
361
+ ];
362
+ }
363
+
364
+ // src/config/core/core.config-name.ts
365
+ var CORE_CONFIG_NAME = `${plugin_prefix_default}/core`;
366
+ var CORE_CONFIG_NAME_SETUP = `${CORE_CONFIG_NAME}/setup`;
367
+ var CORE_CONFIG_NAME_RULES = `${CORE_CONFIG_NAME}/rules`;
368
+ var CORE_CONFIG_NAME_RULES_MARKDOWN_SOURCE = `${CORE_CONFIG_NAME_RULES}/markdown/source`;
369
+ var CORE_CONFIG_NAME_RULES_NODE = `${CORE_CONFIG_NAME_RULES}/node`;
370
+
371
+ // src/config/core/core.config.ts
372
+ async function core(options) {
373
+ const {
374
+ markdown: markdown2,
375
+ module: { node: useNodeModules },
376
+ node
377
+ } = options;
378
+ const nodePluginName = plugin_rename_default.n;
379
+ const configs = [
380
+ {
381
+ languageOptions: {
382
+ ecmaVersion: 2020,
383
+ globals: {
384
+ ...globals2.browser,
385
+ ...globals2.es2021,
386
+ ...globals2.node,
387
+ document: "readonly",
388
+ navigator: "readonly",
389
+ window: "readonly"
390
+ },
391
+ parserOptions: {
392
+ ecmaFeatures: {
393
+ jsx: true
394
+ },
395
+ ecmaVersion: "latest",
396
+ sourceType: "module"
397
+ },
398
+ sourceType: "module"
399
+ },
400
+ linterOptions: {
401
+ reportUnusedDisableDirectives: true
402
+ },
403
+ name: CORE_CONFIG_NAME_SETUP,
404
+ plugins: {
405
+ ...node && {
406
+ [nodePluginName]: await interopDefault(import("eslint-plugin-n"))
407
+ }
408
+ }
409
+ },
410
+ {
411
+ name: CORE_CONFIG_NAME_RULES,
412
+ rules: {
413
+ "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
414
+ "array-callback-return": ["error", { checkForEach: true }],
415
+ "block-scoped-var": "error",
416
+ camelcase: ["error", { properties: "never" }],
417
+ "consistent-this": ["error", "self"],
418
+ "constructor-super": "error",
419
+ "default-case-last": "error",
420
+ "dot-notation": "error",
421
+ eqeqeq: "error",
422
+ "for-direction": "error",
423
+ "func-name-matching": "error",
424
+ "func-names": ["error", "as-needed"],
425
+ "getter-return": "error",
426
+ "grouped-accessor-pairs": "error",
427
+ "guard-for-in": "error",
428
+ "max-depth": ["error", 4],
429
+ "max-params": "off",
430
+ "new-cap": ["error", { capIsNew: false }],
431
+ "no-alert": "error",
432
+ "no-array-constructor": "error",
433
+ "no-async-promise-executor": "error",
434
+ "no-await-in-loop": "error",
435
+ "no-bitwise": "error",
436
+ "no-caller": "error",
437
+ "no-case-declarations": "error",
438
+ "no-class-assign": "error",
439
+ "no-compare-neg-zero": "error",
440
+ "no-cond-assign": ["error", "always"],
441
+ "no-console": ["error", { allow: ["error"] }],
442
+ "no-const-assign": "error",
443
+ "no-constant-binary-expression": "error",
444
+ "no-constant-condition": "error",
445
+ "no-constructor-return": "error",
446
+ "no-control-regex": "error",
447
+ "no-debugger": "error",
448
+ "no-delete-var": "error",
449
+ "no-dupe-args": "error",
450
+ "no-dupe-class-members": "error",
451
+ "no-dupe-else-if": "error",
452
+ "no-dupe-keys": "error",
453
+ "no-duplicate-case": "error",
454
+ "no-duplicate-imports": "off",
455
+ "no-else-return": ["error", { allowElseIf: false }],
456
+ "no-empty": "error",
457
+ "no-empty-character-class": "error",
458
+ "no-empty-pattern": "error",
459
+ "no-empty-static-block": "error",
460
+ "no-eq-null": "error",
461
+ "no-eval": "error",
462
+ "no-ex-assign": "error",
463
+ "no-extend-native": "error",
464
+ "no-extra-bind": "error",
465
+ "no-extra-boolean-cast": "error",
466
+ "no-extra-label": "error",
467
+ "no-fallthrough": "error",
468
+ "no-func-assign": "error",
469
+ "no-global-assign": "error",
470
+ "no-implicit-coercion": "error",
471
+ "no-implicit-globals": "error",
472
+ "no-implied-eval": "error",
473
+ "no-import-assign": "error",
474
+ "no-inline-comments": "error",
475
+ "no-inner-declarations": "error",
476
+ "no-invalid-regexp": "error",
477
+ "no-invalid-this": "error",
478
+ "no-irregular-whitespace": "error",
479
+ "no-iterator": "error",
480
+ "no-label-var": "error",
481
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
482
+ "no-lone-blocks": "error",
483
+ "no-lonely-if": "error",
484
+ "no-loop-func": "error",
485
+ "no-loss-of-precision": "error",
486
+ "no-misleading-character-class": "error",
487
+ "no-multi-assign": "error",
488
+ "no-multi-str": "error",
489
+ "no-negated-condition": "error",
490
+ "no-new": "error",
491
+ "no-new-func": "error",
492
+ "no-new-native-nonconstructor": "error",
493
+ "no-new-wrappers": "error",
494
+ "no-nonoctal-decimal-escape": "error",
495
+ "no-obj-calls": "error",
496
+ "no-octal": "error",
497
+ "no-octal-escape": "error",
498
+ "no-param-reassign": "error",
499
+ "no-promise-executor-return": "error",
500
+ "no-proto": "error",
501
+ "no-prototype-builtins": "error",
502
+ "no-redeclare": "error",
503
+ "no-regex-spaces": "error",
504
+ "no-restricted-globals": [
505
+ "error",
506
+ { message: "Use `globalThis` instead.", name: "global" },
507
+ { message: "Use `globalThis` instead.", name: "self" }
508
+ ],
509
+ "no-restricted-properties": [
510
+ "error",
511
+ {
512
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
513
+ property: "__proto__"
514
+ },
515
+ { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
516
+ { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
517
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
518
+ { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
519
+ ],
520
+ "no-restricted-syntax": [
521
+ "error",
522
+ "DebuggerStatement",
523
+ "LabeledStatement",
524
+ "WithStatement",
525
+ "TSEnumDeclaration[const=true]",
526
+ "TSExportAssignment"
527
+ ],
528
+ "no-return-assign": "error",
529
+ "no-self-assign": "error",
530
+ "no-self-compare": "error",
531
+ "no-sequences": "error",
532
+ "no-setter-return": "error",
533
+ "no-shadow-restricted-names": "error",
534
+ "no-sparse-arrays": "error",
535
+ "no-template-curly-in-string": "error",
536
+ "no-this-before-super": "error",
537
+ "no-throw-literal": "error",
538
+ "no-undef": "error",
539
+ "no-undef-init": "error",
540
+ "no-underscore-dangle": "error",
541
+ "no-unexpected-multiline": "error",
542
+ "no-unmodified-loop-condition": "error",
543
+ "no-unneeded-ternary": "error",
544
+ "no-unreachable": "error",
545
+ "no-unreachable-loop": "error",
546
+ "no-unsafe-finally": "error",
547
+ "no-unsafe-negation": "error",
548
+ "no-unsafe-optional-chaining": "error",
549
+ "no-unused-expressions": "error",
550
+ "no-unused-labels": "error",
551
+ "no-unused-private-class-members": "error",
552
+ "no-use-before-define": [
553
+ "error",
554
+ {
555
+ allowNamedExports: false,
556
+ classes: true,
557
+ functions: false,
558
+ variables: true
559
+ }
560
+ ],
561
+ "no-useless-assignment": "error",
562
+ "no-useless-backreference": "error",
563
+ "no-useless-call": "error",
564
+ "no-useless-catch": "error",
565
+ "no-useless-computed-key": "error",
566
+ "no-useless-constructor": "error",
567
+ "no-useless-escape": "error",
568
+ "no-useless-rename": "error",
569
+ "no-useless-return": "error",
570
+ "no-var": "error",
571
+ "no-with": "error",
572
+ "object-shorthand": "error",
573
+ "one-var": "off",
574
+ "operator-assignment": ["error", "always"],
575
+ "prefer-arrow-callback": [
576
+ "error",
577
+ {
578
+ allowNamedFunctions: false,
579
+ allowUnboundThis: true
580
+ }
581
+ ],
582
+ "prefer-const": "error",
583
+ "prefer-exponentiation-operator": "error",
584
+ "prefer-named-capture-group": "error",
585
+ "prefer-numeric-literals": "error",
586
+ "prefer-object-has-own": "error",
587
+ "prefer-promise-reject-errors": "error",
588
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
589
+ "prefer-rest-params": "error",
590
+ "prefer-spread": "error",
591
+ "prefer-template": "error",
592
+ radix: "error",
593
+ "require-atomic-updates": "error",
594
+ "require-await": "error",
595
+ "require-yield": "error",
596
+ "symbol-description": "error",
597
+ "unicode-bom": ["error", "never"],
598
+ "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
599
+ "valid-typeof": ["error", { requireStringLiterals: true }],
600
+ "vars-on-top": "error",
601
+ yoda: "error"
602
+ }
603
+ }
604
+ ];
605
+ if (node) {
606
+ configs.push({
607
+ name: CORE_CONFIG_NAME_RULES_NODE,
608
+ rules: {
609
+ [`${nodePluginName}/handle-callback-err`]: ["error", "^(err|error)$"],
610
+ [`${nodePluginName}/no-exports-assign`]: "error",
611
+ [`${nodePluginName}/no-new-require`]: "error",
612
+ ...useNodeModules && {
613
+ [`${nodePluginName}/no-deprecated-api`]: "error",
614
+ [`${nodePluginName}/no-path-concat`]: "error",
615
+ [`${nodePluginName}/prefer-global/buffer`]: ["error", "never"],
616
+ [`${nodePluginName}/prefer-global/process`]: ["error", "never"],
617
+ [`${nodePluginName}/process-exit-as-throw`]: "error"
618
+ }
619
+ }
620
+ });
621
+ }
622
+ if (markdown2) {
623
+ configs.push({
624
+ files: GLOB_MARKDOWN_SOURCE,
625
+ name: CORE_CONFIG_NAME_RULES_MARKDOWN_SOURCE,
626
+ rules: {
627
+ "no-console": "off",
628
+ "no-inline-comments": "off"
629
+ }
630
+ });
631
+ }
632
+ return configs;
633
+ }
634
+
635
+ // src/config/ignore/ignore.config.ts
636
+ import fs from "node:fs";
637
+
638
+ // src/config/ignore/ignore.config-name.ts
639
+ var IGNORE_CONFIG_NAME = `${plugin_prefix_default}/ignore`;
640
+ var IGNORE_CONFIG_NAME_DEFAULT = IGNORE_CONFIG_NAME;
641
+ var IGNORE_CONFIG_NAME_ADDITIONAL = `${IGNORE_CONFIG_NAME}/additional`;
642
+ var IGNORE_CONFIG_NAME_GITIGNORE = `${IGNORE_CONFIG_NAME}/gitignore`;
643
+
644
+ // src/config/ignore/ignore.globs.ts
645
+ var IGNORE_GLOB = [
646
+ "**/node_modules",
647
+ "**/dist",
648
+ "**/package-lock.json",
649
+ "**/yarn.lock",
650
+ "**/pnpm-lock.yaml",
651
+ "**/bun.lockb",
652
+ "**/output",
653
+ "**/coverage",
654
+ "**/temp",
655
+ "**/.temp",
656
+ "**/tmp",
657
+ "**/.tmp",
658
+ "**/.history",
659
+ "**/.vitepress/cache",
660
+ "**/.nuxt",
661
+ "**/.next",
662
+ "**/.vercel",
663
+ "**/.changeset",
664
+ "**/.idea",
665
+ "**/.cache",
666
+ "**/.output",
667
+ "**/.vite-inspect",
668
+ "**/.yarn",
669
+ "**/CHANGELOG*.md",
670
+ "**/*.min.*",
671
+ "**/LICENSE*",
672
+ "**/__snapshots__"
673
+ ];
674
+ var ignore_globs_default = IGNORE_GLOB;
675
+
676
+ // src/config/ignore/ignore.config.ts
677
+ async function ignore({ ignore: ignore2 }) {
678
+ if (ignore2 === false) {
679
+ return [];
680
+ }
681
+ const config = [
682
+ {
683
+ ignores: ignore_globs_default,
684
+ name: IGNORE_CONFIG_NAME_DEFAULT
685
+ }
686
+ ];
687
+ if (typeof ignore2 === "object" && ignore2.globs) {
688
+ config.push({
689
+ ignores: ignore2.globs,
690
+ name: IGNORE_CONFIG_NAME_ADDITIONAL
691
+ });
692
+ }
693
+ if (typeof ignore2 === "boolean") {
694
+ if (fs.existsSync(".gitignore")) {
695
+ const gitignore2 = await interopDefault(import("eslint-config-flat-gitignore"));
696
+ return [...config, { ...gitignore2(), name: IGNORE_CONFIG_NAME_GITIGNORE }];
697
+ }
698
+ return [];
699
+ }
700
+ const gitignore = await interopDefault(import("eslint-config-flat-gitignore"));
701
+ return [...config, { ...gitignore(ignore2), name: IGNORE_CONFIG_NAME_GITIGNORE }];
702
+ }
703
+
704
+ // src/config/typescript/typescript.config-name.ts
705
+ var TYPESCRIPT_CONFIG_NAME = `${plugin_prefix_default}/typescript`;
706
+ var TYPESCRIPT_CONFIG_NAME_SETUP = `${TYPESCRIPT_CONFIG_NAME}/setup`;
707
+ var TYPESCRIPT_CONFIG_NAME_SETUP_PARSER = `${TYPESCRIPT_CONFIG_NAME_SETUP}/parser`;
708
+ var TYPESCRIPT_CONFIG_NAME_SETUP_PARSER_TYPEAWARE = `${TYPESCRIPT_CONFIG_NAME_SETUP_PARSER}/type-aware`;
709
+ var TYPESCRIPT_CONFIG_NAME_RULES = `${TYPESCRIPT_CONFIG_NAME}/rules`;
710
+ var TYPESCRIPT_CONFIG_NAME_RULES_DTS = `${TYPESCRIPT_CONFIG_NAME_RULES}/dts`;
711
+ var TYPESCRIPT_CONFIG_NAME_RULES_TEST = `${TYPESCRIPT_CONFIG_NAME_RULES}/test`;
712
+ var TYPESCRIPT_CONFIG_NAME_RULES_TYPEAWARE = `${TYPESCRIPT_CONFIG_NAME_RULES}/type-aware`;
713
+
714
+ // src/config/typescript/typescript.globs.ts
715
+ var TYPESCRIPT_GLOBS = ["**/*.?([cm])ts?(x)"];
716
+ var DTS_GLOBS = ["**/*.d.ts"];
717
+ var TEST_GLOBS = ["**/*.spec.[jt]s?(x)", "**/*.test.[jt]s?(x)"];
718
+
719
+ // src/config/typescript/typescript.parser.ts
720
+ import { cwd } from "node:process";
721
+ function typescriptParser({
722
+ files,
723
+ ignores,
724
+ parser,
725
+ parserOptions,
726
+ tsconfigPath
727
+ }) {
728
+ const config = {
729
+ files,
730
+ languageOptions: {
731
+ parser,
732
+ parserOptions: {
733
+ sourceType: "module",
734
+ ...tsconfigPath ? {
735
+ project: tsconfigPath,
736
+ tsconfigRootDir: cwd()
737
+ } : {},
738
+ ...parserOptions
739
+ }
740
+ },
741
+ name: tsconfigPath ? TYPESCRIPT_CONFIG_NAME_SETUP_PARSER_TYPEAWARE : TYPESCRIPT_CONFIG_NAME_SETUP_PARSER
742
+ };
743
+ if (ignores) {
744
+ config.ignores = ignores;
745
+ }
746
+ return config;
747
+ }
748
+
749
+ // src/config/typescript/typescript.config.ts
750
+ async function typescript(options) {
751
+ const { typescript: typescript2 } = options;
752
+ if (typescript2 === false) {
753
+ return [];
754
+ }
755
+ const [plugin, parser] = await Promise.all([
756
+ interopDefault(import("@typescript-eslint/eslint-plugin")),
757
+ interopDefault(import("@typescript-eslint/parser"))
758
+ ]);
759
+ const typescriptPluginRename = plugin_rename_default["@typescript-eslint"];
760
+ const config = [];
761
+ const isTypeAware = typeof typescript2 !== "boolean";
762
+ config.push({
763
+ name: TYPESCRIPT_CONFIG_NAME_SETUP,
764
+ plugins: {
765
+ typescript: plugin
766
+ }
767
+ });
768
+ if (typescript2 === true) {
769
+ config.push(
770
+ typescriptParser({
771
+ files: SOURCE_GLOBS,
772
+ parser
773
+ })
774
+ );
775
+ } else {
776
+ config.push(
777
+ typescriptParser({
778
+ files: [...JAVASCRIPT_GLOBS, ...GLOB_MARKDOWN_SOURCE],
779
+ parser
780
+ }),
781
+ typescriptParser({
782
+ files: TYPESCRIPT_GLOBS,
783
+ ignores: GLOB_MARKDOWN_SOURCE,
784
+ parser,
785
+ tsconfigPath: toArray(typescript2)
786
+ })
787
+ );
788
+ }
789
+ config.push(
790
+ {
791
+ files: SOURCE_GLOBS,
792
+ name: TYPESCRIPT_CONFIG_NAME_RULES,
793
+ rules: {
794
+ ...plugin_config_override_rules_default(plugin, "eslint-recommended", plugin_rename_typescript_default),
795
+ ...pluginConfigRules(plugin, "strict", plugin_rename_typescript_default),
796
+ [`${typescriptPluginRename}/explicit-module-boundary-types`]: ["error"],
797
+ [`${typescriptPluginRename}/no-extraneous-class`]: "off",
798
+ // Disable the following rules, as they are covered by the eslint-plugin-unused-imports
799
+ [`${typescriptPluginRename}/no-unused-vars`]: "off"
800
+ }
801
+ },
802
+ {
803
+ files: DTS_GLOBS,
804
+ name: TYPESCRIPT_CONFIG_NAME_RULES_DTS,
805
+ rules: {
806
+ [`${typescriptPluginRename}/triple-slash-reference`]: "off"
807
+ }
808
+ }
809
+ );
810
+ if (isTypeAware) {
811
+ config.push({
812
+ files: TYPESCRIPT_GLOBS,
813
+ ignores: GLOB_MARKDOWN_SOURCE,
814
+ name: TYPESCRIPT_CONFIG_NAME_RULES_TYPEAWARE,
815
+ rules: {
816
+ ...pluginConfigRules(plugin, "strict-type-checked-only", plugin_rename_typescript_default),
817
+ [`${typescriptPluginRename}/no-confusing-void-expression`]: ["error", { ignoreArrowShorthand: true }],
818
+ [`${typescriptPluginRename}/no-unused-vars`]: "off",
819
+ [`${typescriptPluginRename}/prefer-readonly`]: ["error"],
820
+ [`${typescriptPluginRename}/promise-function-async`]: ["error", { checkArrowFunctions: false }],
821
+ [`${typescriptPluginRename}/switch-exhaustiveness-check`]: ["error"]
822
+ }
823
+ });
824
+ }
825
+ config.push({
826
+ files: TEST_GLOBS,
827
+ name: TYPESCRIPT_CONFIG_NAME_RULES_TEST,
828
+ rules: {
829
+ [`${typescriptPluginRename}/no-confusing-void-expression`]: "off"
830
+ }
831
+ });
832
+ return config;
833
+ }
834
+
835
+ // src/config/imports/imports.config-name.ts
836
+ var IMPORTS_CONFIG_NAME = `${plugin_prefix_default}/imports`;
837
+ var IMPORTS_CONFIG_NAME_SETUP = `${IMPORTS_CONFIG_NAME}/setup`;
838
+ var IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT = `${IMPORTS_CONFIG_NAME_SETUP}/typescript`;
839
+ var IMPORTS_CONFIG_NAME_RULES = `${IMPORTS_CONFIG_NAME}/rules`;
840
+ var IMPORTS_CONFIG_NAME_RULES_WARNINGS = `${IMPORTS_CONFIG_NAME_RULES}/warnings`;
841
+ var IMPORTS_CONFIG_NAME_RULES_WARNINGS_ESLINT_CONFIG = `${IMPORTS_CONFIG_NAME_RULES_WARNINGS}/eslint-config`;
842
+ var IMPORTS_CONFIG_NAME_RULES_TYPESCRIPT = `${IMPORTS_CONFIG_NAME_RULES}/typescript`;
843
+ var IMPORTS_CONFIG_NAME_RULES_STATIC = `${IMPORTS_CONFIG_NAME_RULES}/static`;
844
+ var IMPORTS_CONFIG_NAME_RULES_STATIC_MARKDOWN_SOURCE = `${IMPORTS_CONFIG_NAME_RULES_STATIC}/markdown/source`;
845
+ var IMPORTS_CONFIG_NAME_RULES_STYLISTIC = `${IMPORTS_CONFIG_NAME_RULES}/stylistic`;
846
+ var IMPORTS_CONFIG_NAME_RULES_STYLISTIC_MARKDOWN_SOURCE = `${IMPORTS_CONFIG_NAME_RULES_STYLISTIC}//markdown/source`;
847
+
848
+ // src/config/imports/imports.config.ts
849
+ async function imports(options) {
850
+ const {
851
+ astro: astro2,
852
+ imports: imports2,
853
+ json: json2,
854
+ markdown: markdown2,
855
+ module: { amd, commonjs, ignore: ignoreModules, node: useNodeModules, webpack },
856
+ stylistic: stylistic2,
857
+ typescript: typescript2
858
+ } = options;
859
+ if (!imports2) {
860
+ return [];
861
+ }
862
+ const importXPlugin = "import-x";
863
+ const importXPluginRename = plugin_rename_default[importXPlugin];
864
+ const unusedImportsPrefix = plugin_rename_default["unused-imports"];
865
+ const importSortPrefix = plugin_rename_default["simple-import-sort"];
866
+ const configs = [];
867
+ configs.push({
868
+ name: IMPORTS_CONFIG_NAME_SETUP,
869
+ plugins: {
870
+ [importXPluginRename]: await interopDefault(import("eslint-plugin-import-x")),
871
+ ...stylistic2 && {
872
+ [importSortPrefix]: await interopDefault(import("eslint-plugin-simple-import-sort")),
873
+ [unusedImportsPrefix]: await interopDefault(import("eslint-plugin-unused-imports"))
874
+ }
875
+ },
876
+ settings: {
877
+ [`${importXPlugin}/resolver`]: {
878
+ node: true
879
+ }
880
+ }
881
+ });
882
+ if (typescript2) {
883
+ const typeScriptExtensions = [".ts", ".tsx"];
884
+ const allExtensions = [...typeScriptExtensions, ".js", ".jsx"];
885
+ configs.push({
886
+ files: TYPESCRIPT_GLOBS,
887
+ name: IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT,
888
+ settings: {
889
+ [`${importXPlugin}/extensions`]: typeScriptExtensions,
890
+ [`${importXPlugin}/external-module-folders`]: ["node_modules", "node_modules/@types"],
891
+ [`${importXPlugin}/parsers`]: {
892
+ "@typescript-eslint/parser": [...typeScriptExtensions, ".cts", ".mts"]
893
+ },
894
+ [`${importXPlugin}/resolver`]: {
895
+ node: {
896
+ extensions: allExtensions
897
+ },
898
+ typescript: true
899
+ }
900
+ }
901
+ });
902
+ }
903
+ configs.push(
904
+ {
905
+ name: IMPORTS_CONFIG_NAME_RULES_WARNINGS,
906
+ rules: {
907
+ // Warnings rules https://github.com/un-ts/eslint-plugin-import-x?tab=readme-ov-file#helpful-warnings
908
+ [`${importXPluginRename}/export`]: "error",
909
+ [`${importXPluginRename}/no-deprecated`]: "warn",
910
+ [`${importXPluginRename}/no-empty-named-blocks`]: "error",
911
+ [`${importXPluginRename}/no-extraneous-dependencies`]: "error",
912
+ [`${importXPluginRename}/no-mutable-exports`]: "error",
913
+ [`${importXPluginRename}/no-named-as-default`]: "warn",
914
+ [`${importXPluginRename}/no-named-as-default-member`]: "warn",
915
+ // Module system rules
916
+ ...!amd && {
917
+ [`${importXPluginRename}/no-amd`]: "error"
918
+ },
919
+ ...!commonjs && {
920
+ [`${importXPluginRename}/no-commonjs`]: "error"
921
+ },
922
+ ...!useNodeModules && {
923
+ [`${importXPluginRename}/no-nodejs-modules`]: "error"
924
+ },
925
+ [`${importXPluginRename}/default`]: "error"
926
+ }
927
+ },
928
+ {
929
+ name: IMPORTS_CONFIG_NAME_RULES_STATIC,
930
+ rules: {
931
+ // Static analysis rules https://github.com/un-ts/eslint-plugin-import-x?tab=readme-ov-file#static-analysis
932
+ [`${importXPluginRename}/named`]: "error",
933
+ [`${importXPluginRename}/no-absolute-path`]: "error",
934
+ [`${importXPluginRename}/no-cycle`]: "error",
935
+ [`${importXPluginRename}/no-import-module-exports`]: "error",
936
+ [`${importXPluginRename}/no-relative-packages`]: "error",
937
+ [`${importXPluginRename}/no-restricted-paths`]: "off",
938
+ [`${importXPluginRename}/no-self-import`]: "error",
939
+ [`${importXPluginRename}/no-unresolved`]: ["error", { amd, commonjs, ignore: ignoreModules }],
940
+ [`${importXPluginRename}/no-useless-path-segments`]: [
941
+ "error",
942
+ {
943
+ commonjs,
944
+ noUselessIndex: true
945
+ }
946
+ ],
947
+ ...!webpack && {
948
+ [`${importXPluginRename}/no-webpack-loader-syntax`]: "error"
949
+ },
950
+ ...commonjs && {
951
+ [`${importXPluginRename}/no-dynamic-require`]: "error"
952
+ }
953
+ }
954
+ }
955
+ /*
956
+ * TODO: Decide if we want to keep these rules
957
+ * {
958
+ * files: ESLINT_CONFIG_GLOBS,
959
+ * name: IMPORTS_CONFIG_NAME_RULES_WARNINGS_ESLINT_CONFIG,
960
+ * rules: {
961
+ * [`${importXPluginRename}/default`]: 'off',
962
+ * [`${importXPluginRename}/no-deprecated`]: 'off',
963
+ * [`${importXPluginRename}/no-named-as-default`]: 'off',
964
+ * [`${importXPluginRename}/no-named-as-default-member`]: 'off',
965
+ * },
966
+ * }
967
+ */
968
+ );
969
+ if (markdown2) {
970
+ configs.push({
971
+ files: [
972
+ ...GLOB_MARKDOWN_SOURCE,
973
+ ...json2 ? GLOB_MARKDOWN_JSON : [],
974
+ ...astro2 ? GLOB_MARKDOWN_ASTRO : []
975
+ ],
976
+ name: IMPORTS_CONFIG_NAME_RULES_STATIC_MARKDOWN_SOURCE,
977
+ rules: {
978
+ [`${importXPluginRename}/no-unresolved`]: "off"
979
+ }
980
+ });
981
+ }
982
+ if (stylistic2) {
983
+ configs.push({
984
+ name: IMPORTS_CONFIG_NAME_RULES_STYLISTIC,
985
+ rules: {
986
+ [`${importXPluginRename}/consistent-type-specifier-style`]: ["error", "prefer-top-level"],
987
+ [`${importXPluginRename}/exports-last`]: "error",
988
+ [`${importXPluginRename}/first`]: "error",
989
+ [`${importXPluginRename}/group-exports`]: "error",
990
+ [`${importXPluginRename}/newline-after-import`]: ["error", { count: 1 }],
991
+ [`${importXPluginRename}/no-anonymous-default-export`]: "error",
992
+ [`${importXPluginRename}/no-duplicates`]: "error",
993
+ [`${importXPluginRename}/no-namespace`]: "error",
994
+ [`${importXPluginRename}/prefer-default-export`]: "error",
995
+ ...webpack && {
996
+ [`${importXPluginRename}/dynamic-import-chunkname`]: "error"
997
+ },
998
+ // Sorting rules
999
+ [`${importSortPrefix}/exports`]: "error",
1000
+ [`${importSortPrefix}/imports`]: "error",
1001
+ // Unused imports rules
1002
+ [`${unusedImportsPrefix}/no-unused-imports`]: "error",
1003
+ [`${unusedImportsPrefix}/no-unused-vars`]: [
1004
+ "warn",
1005
+ {
1006
+ args: "after-used",
1007
+ argsIgnorePattern: "^_",
1008
+ ignoreRestSiblings: true,
1009
+ vars: "all",
1010
+ varsIgnorePattern: "^_"
1011
+ }
1012
+ ],
1013
+ "sort-imports": [
1014
+ "error",
1015
+ {
1016
+ allowSeparatedGroups: false,
1017
+ ignoreCase: false,
1018
+ ignoreDeclarationSort: true,
1019
+ ignoreMemberSort: true,
1020
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
1021
+ }
1022
+ ]
1023
+ }
1024
+ });
1025
+ if (markdown2) {
1026
+ configs.push({
1027
+ files: GLOB_MARKDOWN_SOURCE,
1028
+ name: IMPORTS_CONFIG_NAME_RULES_STYLISTIC_MARKDOWN_SOURCE,
1029
+ rules: {
1030
+ [`${unusedImportsPrefix}/no-unused-vars`]: ["off"]
1031
+ }
1032
+ });
1033
+ }
1034
+ }
1035
+ return configs;
1036
+ }
1037
+
1038
+ // src/config/react/react.config.ts
1039
+ import { fixupPluginRules } from "@eslint/compat";
1040
+ import { isPackageExists } from "local-pkg";
1041
+
1042
+ // src/config/react/react.config-name.ts
1043
+ var REACT_CONFIG_NAME = `${plugin_prefix_default}/react`;
1044
+ var REACT_CONFIG_NAME_SETUP = `${REACT_CONFIG_NAME}/setup`;
1045
+ var REACT_CONFIG_NAME_RULES = `${REACT_CONFIG_NAME}/rules`;
1046
+ var REACT_CONFIG_NAME_RULES_HOOKS = `${REACT_CONFIG_NAME_RULES}/hooks`;
1047
+ var REACT_CONFIG_NAME_RULES_REFRESH = `${REACT_CONFIG_NAME_RULES}/refresh`;
1048
+
1049
+ // src/config/react/react.globs.ts
1050
+ var GLOB_REACT_JSX = ["**/*.?([cm])jsx"];
1051
+ var GLOB_REACT_TSX = ["**/*.?([cm])tsx"];
1052
+
1053
+ // src/config/react/react.config.ts
1054
+ var REACT_REFRESH_ALLOW_CONSTANT_EXPORT_PACKAGES = ["vite"];
1055
+ async function react(options) {
1056
+ const { react: react2, typescript: typescript2 } = options;
1057
+ if (!react2) {
1058
+ return [];
1059
+ }
1060
+ const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
1061
+ interopDefault(import("eslint-plugin-react")),
1062
+ interopDefault(import("eslint-plugin-react-hooks")),
1063
+ interopDefault(import("eslint-plugin-react-refresh"))
1064
+ ]);
1065
+ const isAllowConstantExport = REACT_REFRESH_ALLOW_CONSTANT_EXPORT_PACKAGES.some((index) => isPackageExists(index));
1066
+ const files = [...GLOB_REACT_JSX, ...typescript2 ? GLOB_REACT_TSX : []];
1067
+ return [
1068
+ {
1069
+ name: REACT_CONFIG_NAME_SETUP,
1070
+ plugins: {
1071
+ react: fixupPluginRules(pluginReact),
1072
+ "react-hooks": pluginReactHooks,
1073
+ "react-refresh": pluginReactRefresh
1074
+ },
1075
+ settings: {
1076
+ react: {
1077
+ version: "detect"
1078
+ }
1079
+ }
1080
+ },
1081
+ {
1082
+ files,
1083
+ name: REACT_CONFIG_NAME_RULES,
1084
+ rules: {
1085
+ "react/display-name": "error",
1086
+ "react/jsx-key": "error",
1087
+ "react/jsx-no-comment-textnodes": "error",
1088
+ "react/jsx-no-duplicate-props": "error",
1089
+ "react/jsx-no-target-blank": "error",
1090
+ "react/jsx-uses-react": "error",
1091
+ "react/jsx-uses-vars": "error",
1092
+ "react/no-children-prop": "error",
1093
+ "react/no-danger-with-children": "error",
1094
+ "react/no-deprecated": "error",
1095
+ "react/no-direct-mutation-state": "error",
1096
+ "react/no-find-dom-node": "error",
1097
+ "react/no-is-mounted": "error",
1098
+ "react/no-render-return-value": "error",
1099
+ "react/no-string-refs": "error",
1100
+ "react/no-unescaped-entities": "error",
1101
+ "react/no-unknown-property": "error",
1102
+ "react/no-unsafe": "off",
1103
+ "react/react-in-jsx-scope": "off",
1104
+ "react/require-render-return": "error",
1105
+ ...!typescript2 && {
1106
+ "react/jsx-no-undef": "error",
1107
+ "react/prop-types": "error"
1108
+ }
1109
+ }
1110
+ },
1111
+ {
1112
+ files,
1113
+ name: REACT_CONFIG_NAME_RULES_HOOKS,
1114
+ rules: {
1115
+ "react-hooks/exhaustive-deps": "error",
1116
+ "react-hooks/rules-of-hooks": "error"
1117
+ }
1118
+ },
1119
+ {
1120
+ files,
1121
+ name: REACT_CONFIG_NAME_RULES_REFRESH,
1122
+ rules: {
1123
+ "react-refresh/only-export-components": ["warn", { allowConstantExport: isAllowConstantExport }]
1124
+ }
1125
+ }
1126
+ ];
1127
+ }
1128
+
1129
+ // src/config/stylistic/stylistic.config-name.ts
1130
+ var STYLISTIC_CONFIG_NAME = `${plugin_prefix_default}/stylistic`;
1131
+ var STYLISTIC_CONFIG_NAME_SETUP = `${STYLISTIC_CONFIG_NAME}/setup`;
1132
+ var STYLISTIC_CONFIG_NAME_RULES = `${STYLISTIC_CONFIG_NAME}/rules`;
1133
+ var STYLISTIC_CONFIG_NAME_RULES_UNICORN = `${STYLISTIC_CONFIG_NAME_RULES}/unicorn`;
1134
+ var STYLISTIC_CONFIG_NAME_RULES_UNICORN_MARKDOWN = `${STYLISTIC_CONFIG_NAME_RULES_UNICORN}/markdown`;
1135
+ var STYLISTIC_CONFIG_NAME_RULES_UNICORN_MARKDOWN_SOURCE = `${STYLISTIC_CONFIG_NAME_RULES_UNICORN_MARKDOWN}/source`;
1136
+ var STYLISTIC_CONFIG_NAME_RULES_PERFECTIONIST = `${STYLISTIC_CONFIG_NAME_RULES}/perfectionist`;
1137
+ var STYLISTIC_CONFIG_NAME_RULES_MARKDOWN = `${STYLISTIC_CONFIG_NAME_RULES}/markdown`;
1138
+ var STYLISTIC_CONFIG_NAME_RULES_MARKDOWN_SOURCE = `${STYLISTIC_CONFIG_NAME_RULES_MARKDOWN}/source`;
1139
+ var STYLISTIC_CONFIG_NAME_RULES_ASTRO = `${STYLISTIC_CONFIG_NAME_RULES}/astro`;
1140
+ var STYLISTIC_CONFIG_NAME_RULES_MARKDOWN_ASRTO = `${STYLISTIC_CONFIG_NAME_RULES}/astro`;
1141
+ var STYLISTIC_CONFIG_NAME_RULES_MARKDOWN_JSON = `${STYLISTIC_CONFIG_NAME_RULES}/json`;
1142
+ var STYLISTIC_CONFIG_NAME_RULES_JSON = `${STYLISTIC_CONFIG_NAME_RULES}/json`;
1143
+ var STYLISTIC_CONFIG_NAME_RULES_JSON_PACKAGE = `${STYLISTIC_CONFIG_NAME_RULES_JSON}/package.json`;
1144
+ var STYLISTIC_CONFIG_NAME_RULES_JSON_TSCONFIG = `${STYLISTIC_CONFIG_NAME_RULES_JSON}/tsconfig.json`;
1145
+ var STYLISTIC_CONFIG_NAME_RULES_TYPESCRIPT = `${STYLISTIC_CONFIG_NAME_RULES}/typescript`;
1146
+ var STYLISTIC_CONFIG_NAME_RULES_TYPESCRIPT_DTS = `${STYLISTIC_CONFIG_NAME_RULES_TYPESCRIPT}/dts`;
1147
+ var STYLISTIC_CONFIG_NAME_RULES_TYPESCRIPT_TYPE_AWARE = `${STYLISTIC_CONFIG_NAME_RULES_TYPESCRIPT}/type-aware`;
1148
+ var STYLISTIC_CONFIG_NAME_RULES_PRETTIER = `${STYLISTIC_CONFIG_NAME_RULES}/prettier`;
1149
+ var STYLISTIC_CONFIG_NAME_RULES_PRETTIER_ASTRO = `${STYLISTIC_CONFIG_NAME_RULES_PRETTIER}/astro`;
1150
+ var STYLISTIC_CONFIG_NAME_RULES_PRETTIER_MARKDOWN = `${STYLISTIC_CONFIG_NAME_RULES_PRETTIER}/markdown`;
1151
+ var STYLISTIC_CONFIG_NAME_RULES_PRETTIER_MARKDOWN_SOURCE = `${STYLISTIC_CONFIG_NAME_RULES_PRETTIER_MARKDOWN}/source`;
1152
+ var STYLISTIC_CONFIG_NAME_RULES_PRETTIER_MARKDOWN_ASTRO = `${STYLISTIC_CONFIG_NAME_RULES_PRETTIER_MARKDOWN}/astro`;
1153
+
1154
+ // src/config/stylistic/stylistic.options-prettier.ts
1155
+ function prettierOptions(options) {
1156
+ const {
1157
+ arrowParens,
1158
+ bracketSameLine,
1159
+ bracketSpacing,
1160
+ endOfLine,
1161
+ indent,
1162
+ indentSize,
1163
+ printWidth,
1164
+ quoteProps,
1165
+ quotes,
1166
+ semicolons,
1167
+ singleAttributePerLine,
1168
+ trailingComma
1169
+ } = options;
1170
+ return {
1171
+ arrowParens,
1172
+ bracketSameLine,
1173
+ bracketSpacing,
1174
+ endOfLine,
1175
+ jsxSingleQuote: quotes === "single",
1176
+ printWidth,
1177
+ quoteProps,
1178
+ semi: semicolons,
1179
+ singleAttributePerLine,
1180
+ singleQuote: quotes === "single",
1181
+ tabWidth: indentSize,
1182
+ trailingComma,
1183
+ useTabs: indent === "tab"
1184
+ };
1185
+ }
1186
+
1187
+ // src/config/stylistic/stylistic.options-stylistic.ts
1188
+ function stylisticOptions(options) {
1189
+ const {
1190
+ arrowParens,
1191
+ braceStyle,
1192
+ bracketSpacing,
1193
+ indent,
1194
+ indentSize,
1195
+ quoteProps,
1196
+ quotes,
1197
+ semicolons,
1198
+ trailingComma
1199
+ } = options;
1200
+ return {
1201
+ arrowParens: arrowParens === "always",
1202
+ blockSpacing: bracketSpacing,
1203
+ braceStyle,
1204
+ commaDangle: trailingComma === "es5" ? "only-multiline" : trailingComma === "none" ? "never" : "always",
1205
+ indent: indent === "tab" ? "tab" : indentSize,
1206
+ jsx: true,
1207
+ quoteProps: quoteProps === "preserve" ? "as-needed" : quoteProps,
1208
+ quotes,
1209
+ semi: semicolons
1210
+ };
1211
+ }
1212
+
1213
+ // src/config/stylistic/stylistic.config.ts
1214
+ async function stylistic(options) {
1215
+ const { astro: astro2, json: json2, markdown: markdown2, stylistic: stylistic2, typescript: typescript2 } = options;
1216
+ if (stylistic2 === false) {
1217
+ return [];
1218
+ }
1219
+ const { format, indent, indentSize, perfectionist, unicorn } = stylistic2;
1220
+ const isTypeAware = typeof typescript2 !== "boolean";
1221
+ const typescriptPluginRename = plugin_rename_default["@typescript-eslint"];
1222
+ const stylisticPluginRename = plugin_rename_default["@stylistic"];
1223
+ const jsonPluginRename = plugin_rename_default.jsonc;
1224
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
1225
+ const pluginStylisticOptions = stylisticOptions(stylistic2);
1226
+ const pluginStylisticConfig = pluginStylistic.configs.customize(pluginStylisticOptions);
1227
+ const pluginStylisticRules = pluginStylisticConfig.rules;
1228
+ const pluginUnicorn = await interopDefault(import("eslint-plugin-unicorn"));
1229
+ const pluginPerfectionist = await interopDefault(import("eslint-plugin-perfectionist/configs/recommended-natural"));
1230
+ const config = [
1231
+ {
1232
+ name: STYLISTIC_CONFIG_NAME_SETUP,
1233
+ plugins: {
1234
+ style: pluginStylistic,
1235
+ ...unicorn && {
1236
+ unicorn: pluginUnicorn
1237
+ },
1238
+ ...perfectionist && {
1239
+ perfectionist: pluginPerfectionist.plugins.perfectionist
1240
+ },
1241
+ ...format && {
1242
+ format: await interopDefault(import("eslint-plugin-format"))
1243
+ }
1244
+ }
1245
+ },
1246
+ {
1247
+ name: STYLISTIC_CONFIG_NAME_RULES,
1248
+ rules: {
1249
+ ...renameRules(pluginStylisticRules, plugin_rename_default),
1250
+ [`${stylisticPluginRename}/arrow-parens`]: ["error", "as-needed"],
1251
+ [`${stylisticPluginRename}/implicit-arrow-linebreak`]: "off",
1252
+ [`${stylisticPluginRename}/indent`]: "off",
1253
+ [`${stylisticPluginRename}/indent-binary-ops`]: "off",
1254
+ [`${stylisticPluginRename}/jsx-closing-bracket-location`]: [
1255
+ "error",
1256
+ {
1257
+ nonEmpty: "after-props",
1258
+ selfClosing: "tag-aligned"
1259
+ }
1260
+ ],
1261
+ [`${stylisticPluginRename}/jsx-curly-newline`]: "off",
1262
+ [`${stylisticPluginRename}/jsx-indent`]: "off",
1263
+ [`${stylisticPluginRename}/jsx-one-expression-per-line`]: "off",
1264
+ [`${stylisticPluginRename}/jsx-quotes`]: ["error", "prefer-single"],
1265
+ [`${stylisticPluginRename}/jsx-sort-props`]: "error",
1266
+ [`${stylisticPluginRename}/line-comment-position`]: ["error", { position: "above" }],
1267
+ [`${stylisticPluginRename}/max-len`]: "off",
1268
+ [`${stylisticPluginRename}/multiline-comment-style`]: ["error", "starred-block"],
1269
+ [`${stylisticPluginRename}/no-extra-semi`]: "error",
1270
+ [`${stylisticPluginRename}/padding-line-between-statements`]: [
1271
+ "error",
1272
+ { blankLine: "always", next: "return", prev: "*" }
1273
+ ],
1274
+ curly: ["error", "all"],
1275
+ ...format && {
1276
+ [`${stylisticPluginRename}/operator-linebreak`]: "off"
1277
+ }
1278
+ }
1279
+ }
1280
+ ];
1281
+ if (markdown2) {
1282
+ config.push({
1283
+ files: [
1284
+ ...GLOB_MARKDOWN_SOURCE,
1285
+ ...json2 ? GLOB_MARKDOWN_JSON : [],
1286
+ ...astro2 ? GLOB_MARKDOWN_ASTRO : []
1287
+ ],
1288
+ name: STYLISTIC_CONFIG_NAME_RULES_MARKDOWN_SOURCE,
1289
+ rules: {
1290
+ [`${stylisticPluginRename}/indent`]: ["error", 2],
1291
+ [`${stylisticPluginRename}/line-comment-position`]: "off",
1292
+ [`${stylisticPluginRename}/multiline-comment-style`]: "off"
1293
+ }
1294
+ });
1295
+ }
1296
+ if (typescript2) {
1297
+ const plugin = await interopDefault(import("@typescript-eslint/eslint-plugin"));
1298
+ config.push({
1299
+ files: SOURCE_GLOBS,
1300
+ name: STYLISTIC_CONFIG_NAME_RULES_TYPESCRIPT,
1301
+ rules: {
1302
+ ...pluginConfigRules(plugin, "stylistic", plugin_rename_typescript_default),
1303
+ [`${typescriptPluginRename}/consistent-type-assertions`]: "off",
1304
+ [`${typescriptPluginRename}/member-ordering`]: [
1305
+ "error",
1306
+ {
1307
+ default: {
1308
+ memberTypes: [
1309
+ // Index signature
1310
+ "signature",
1311
+ "call-signature",
1312
+ // Fields
1313
+ "public-static-field",
1314
+ "protected-static-field",
1315
+ "private-static-field",
1316
+ "#private-static-field",
1317
+ "public-decorated-field",
1318
+ "protected-decorated-field",
1319
+ "private-decorated-field",
1320
+ "public-instance-field",
1321
+ "protected-instance-field",
1322
+ "private-instance-field",
1323
+ "#private-instance-field",
1324
+ "public-abstract-field",
1325
+ "protected-abstract-field",
1326
+ "public-field",
1327
+ "protected-field",
1328
+ "private-field",
1329
+ "#private-field",
1330
+ "static-field",
1331
+ "instance-field",
1332
+ "abstract-field",
1333
+ "decorated-field",
1334
+ "field",
1335
+ // Static initialization
1336
+ "static-initialization",
1337
+ // Constructors
1338
+ "public-constructor",
1339
+ "protected-constructor",
1340
+ "private-constructor",
1341
+ "constructor",
1342
+ // Getters
1343
+ "public-static-get",
1344
+ "protected-static-get",
1345
+ "private-static-get",
1346
+ "#private-static-get",
1347
+ "public-decorated-get",
1348
+ "protected-decorated-get",
1349
+ "private-decorated-get",
1350
+ "public-instance-get",
1351
+ "protected-instance-get",
1352
+ "private-instance-get",
1353
+ "#private-instance-get",
1354
+ "public-abstract-get",
1355
+ "protected-abstract-get",
1356
+ "public-get",
1357
+ "protected-get",
1358
+ "private-get",
1359
+ "#private-get",
1360
+ "static-get",
1361
+ "instance-get",
1362
+ "abstract-get",
1363
+ "decorated-get",
1364
+ "get",
1365
+ // Setters
1366
+ "public-static-set",
1367
+ "protected-static-set",
1368
+ "private-static-set",
1369
+ "#private-static-set",
1370
+ "public-decorated-set",
1371
+ "protected-decorated-set",
1372
+ "private-decorated-set",
1373
+ "public-instance-set",
1374
+ "protected-instance-set",
1375
+ "private-instance-set",
1376
+ "#private-instance-set",
1377
+ "public-abstract-set",
1378
+ "protected-abstract-set",
1379
+ "public-set",
1380
+ "protected-set",
1381
+ "private-set",
1382
+ "#private-set",
1383
+ "static-set",
1384
+ "instance-set",
1385
+ "abstract-set",
1386
+ "decorated-set",
1387
+ "set",
1388
+ // Methods
1389
+ "public-static-method",
1390
+ "protected-static-method",
1391
+ "private-static-method",
1392
+ "#private-static-method",
1393
+ "public-decorated-method",
1394
+ "protected-decorated-method",
1395
+ "private-decorated-method",
1396
+ "public-instance-method",
1397
+ "protected-instance-method",
1398
+ "private-instance-method",
1399
+ "#private-instance-method",
1400
+ "public-abstract-method",
1401
+ "protected-abstract-method",
1402
+ "public-method",
1403
+ "protected-method",
1404
+ "private-method",
1405
+ "#private-method",
1406
+ "static-method",
1407
+ "instance-method",
1408
+ "abstract-method",
1409
+ "decorated-method",
1410
+ "method"
1411
+ ],
1412
+ order: "natural"
1413
+ }
1414
+ }
1415
+ ]
1416
+ }
1417
+ });
1418
+ if (isTypeAware) {
1419
+ config.push({
1420
+ files: TYPESCRIPT_GLOBS,
1421
+ ignores: GLOB_MARKDOWN_SOURCE,
1422
+ name: STYLISTIC_CONFIG_NAME_RULES_TYPESCRIPT_TYPE_AWARE,
1423
+ rules: {
1424
+ ...pluginConfigRules(plugin, "stylistic-type-checked-only", plugin_rename_typescript_default),
1425
+ // Move this rule here cause needs tsconfig.json
1426
+ [`${typescriptPluginRename}/consistent-type-assertions`]: "error"
1427
+ }
1428
+ });
1429
+ }
1430
+ config.push({
1431
+ files: DTS_GLOBS,
1432
+ name: STYLISTIC_CONFIG_NAME_RULES_TYPESCRIPT_DTS,
1433
+ rules: {
1434
+ [`${stylisticPluginRename}/multiline-comment-style`]: "off",
1435
+ [`${stylisticPluginRename}/spaced-comment`]: "off"
1436
+ }
1437
+ });
1438
+ }
1439
+ if (json2) {
1440
+ config.push(
1441
+ {
1442
+ files: GLOB_JSON,
1443
+ name: STYLISTIC_CONFIG_NAME_RULES_JSON,
1444
+ rules: {
1445
+ [`${jsonPluginRename}/array-bracket-spacing`]: ["error", "never"],
1446
+ [`${jsonPluginRename}/comma-dangle`]: ["error", "never"],
1447
+ [`${jsonPluginRename}/comma-style`]: ["error", "last"],
1448
+ [`${jsonPluginRename}/indent`]: ["error", indent === "space" ? indentSize : indent],
1449
+ [`${jsonPluginRename}/key-spacing`]: ["error", { afterColon: true, beforeColon: false }],
1450
+ [`${jsonPluginRename}/object-curly-newline`]: ["error", { consistent: true, multiline: true }],
1451
+ [`${jsonPluginRename}/object-curly-spacing`]: ["error", "always"],
1452
+ [`${jsonPluginRename}/object-property-newline`]: [
1453
+ "error",
1454
+ { allowMultiplePropertiesPerLine: true }
1455
+ ],
1456
+ [`${jsonPluginRename}/quote-props`]: "error",
1457
+ [`${jsonPluginRename}/quotes`]: "error"
1458
+ }
1459
+ },
1460
+ {
1461
+ files: GLOB_JSON_PACKAGE,
1462
+ name: STYLISTIC_CONFIG_NAME_RULES_JSON_PACKAGE,
1463
+ rules: {
1464
+ "jsonc/sort-array-values": [
1465
+ "error",
1466
+ {
1467
+ order: { type: "asc" },
1468
+ pathPattern: "^files$"
1469
+ }
1470
+ ],
1471
+ "jsonc/sort-keys": [
1472
+ "error",
1473
+ {
1474
+ order: [
1475
+ "name",
1476
+ "displayName",
1477
+ "version",
1478
+ "author",
1479
+ "publisher",
1480
+ "description",
1481
+ "keywords",
1482
+ "categories",
1483
+ "repository",
1484
+ "homepage",
1485
+ "bugs",
1486
+ "funding",
1487
+ "license",
1488
+ "private",
1489
+ "publishConfig",
1490
+ "type",
1491
+ "sideEffects",
1492
+ "bin",
1493
+ "icon",
1494
+ "files",
1495
+ "main",
1496
+ "module",
1497
+ "unpkg",
1498
+ "jsdelivr",
1499
+ "types",
1500
+ "exports",
1501
+ "typesVersions",
1502
+ "scripts",
1503
+ "peerDependencies",
1504
+ "peerDependenciesMeta",
1505
+ "dependencies",
1506
+ "optionalDependencies",
1507
+ "devDependencies",
1508
+ "overrides",
1509
+ "resolutions",
1510
+ "engines",
1511
+ "packageManager",
1512
+ "pnpm",
1513
+ "activationEvents",
1514
+ "contributes",
1515
+ "husky",
1516
+ "simple-git-hooks",
1517
+ "lint-staged",
1518
+ "eslintConfig"
1519
+ ],
1520
+ pathPattern: "^$"
1521
+ },
1522
+ {
1523
+ order: { type: "asc" },
1524
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
1525
+ },
1526
+ {
1527
+ order: { type: "asc" },
1528
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1529
+ },
1530
+ {
1531
+ order: { type: "asc" },
1532
+ pathPattern: "^(?:scripts)$"
1533
+ },
1534
+ {
1535
+ order: ["types", "import", "require", "default"],
1536
+ pathPattern: "^exports.*$"
1537
+ },
1538
+ {
1539
+ order: [
1540
+ // Client hooks only
1541
+ "pre-commit",
1542
+ "prepare-commit-msg",
1543
+ "commit-msg",
1544
+ "post-commit",
1545
+ "pre-rebase",
1546
+ "post-rewrite",
1547
+ "post-checkout",
1548
+ "post-merge",
1549
+ "pre-push",
1550
+ "pre-auto-gc"
1551
+ ],
1552
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1553
+ }
1554
+ ]
1555
+ }
1556
+ },
1557
+ {
1558
+ files: GLOB_JSON_TSCONFIG,
1559
+ name: STYLISTIC_CONFIG_NAME_RULES_JSON_TSCONFIG,
1560
+ rules: {
1561
+ "jsonc/sort-keys": [
1562
+ "error",
1563
+ {
1564
+ order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
1565
+ pathPattern: "^$"
1566
+ },
1567
+ {
1568
+ order: [
1569
+ /* Projects */
1570
+ "incremental",
1571
+ "composite",
1572
+ "tsBuildInfoFile",
1573
+ "disableSourceOfProjectReferenceRedirect",
1574
+ "disableSolutionSearching",
1575
+ "disableReferencedProjectLoad",
1576
+ /* Language and Environment */
1577
+ "target",
1578
+ "jsx",
1579
+ "jsxFactory",
1580
+ "jsxFragmentFactory",
1581
+ "jsxImportSource",
1582
+ "lib",
1583
+ "moduleDetection",
1584
+ "noLib",
1585
+ "reactNamespace",
1586
+ "useDefineForClassFields",
1587
+ "emitDecoratorMetadata",
1588
+ "experimentalDecorators",
1589
+ /* Modules */
1590
+ "baseUrl",
1591
+ "rootDir",
1592
+ "rootDirs",
1593
+ "customConditions",
1594
+ "module",
1595
+ "moduleResolution",
1596
+ "moduleSuffixes",
1597
+ "noResolve",
1598
+ "paths",
1599
+ "resolveJsonModule",
1600
+ "resolvePackageJsonExports",
1601
+ "resolvePackageJsonImports",
1602
+ "typeRoots",
1603
+ "types",
1604
+ "allowArbitraryExtensions",
1605
+ "allowImportingTsExtensions",
1606
+ "allowUmdGlobalAccess",
1607
+ /* JavaScript Support */
1608
+ "allowJs",
1609
+ "checkJs",
1610
+ "maxNodeModuleJsDepth",
1611
+ /* Type Checking */
1612
+ "strict",
1613
+ "strictBindCallApply",
1614
+ "strictFunctionTypes",
1615
+ "strictNullChecks",
1616
+ "strictPropertyInitialization",
1617
+ "allowUnreachableCode",
1618
+ "allowUnusedLabels",
1619
+ "alwaysStrict",
1620
+ "exactOptionalPropertyTypes",
1621
+ "noFallthroughCasesInSwitch",
1622
+ "noImplicitAny",
1623
+ "noImplicitOverride",
1624
+ "noImplicitReturns",
1625
+ "noImplicitThis",
1626
+ "noPropertyAccessFromIndexSignature",
1627
+ "noUncheckedIndexedAccess",
1628
+ "noUnusedLocals",
1629
+ "noUnusedParameters",
1630
+ "useUnknownInCatchVariables",
1631
+ /* Emit */
1632
+ "declaration",
1633
+ "declarationDir",
1634
+ "declarationMap",
1635
+ "downlevelIteration",
1636
+ "emitBOM",
1637
+ "emitDeclarationOnly",
1638
+ "importHelpers",
1639
+ "importsNotUsedAsValues",
1640
+ "inlineSourceMap",
1641
+ "inlineSources",
1642
+ "mapRoot",
1643
+ "newLine",
1644
+ "noEmit",
1645
+ "noEmitHelpers",
1646
+ "noEmitOnError",
1647
+ "outDir",
1648
+ "outFile",
1649
+ "preserveConstEnums",
1650
+ "preserveValueImports",
1651
+ "removeComments",
1652
+ "sourceMap",
1653
+ "sourceRoot",
1654
+ "stripInternal",
1655
+ /* Interop Constraints */
1656
+ "allowSyntheticDefaultImports",
1657
+ "esModuleInterop",
1658
+ "forceConsistentCasingInFileNames",
1659
+ "isolatedModules",
1660
+ "preserveSymlinks",
1661
+ "verbatimModuleSyntax",
1662
+ /* Completeness */
1663
+ "skipDefaultLibCheck",
1664
+ "skipLibCheck"
1665
+ ],
1666
+ pathPattern: "^compilerOptions$"
1667
+ }
1668
+ ]
1669
+ }
1670
+ }
1671
+ );
1672
+ }
1673
+ if (astro2) {
1674
+ config.push({
1675
+ files: GLOB_ASTRO,
1676
+ name: STYLISTIC_CONFIG_NAME_RULES_ASTRO,
1677
+ rules: {
1678
+ "astro/prefer-class-list-directive": "error",
1679
+ "astro/prefer-object-class-list": "error",
1680
+ "astro/prefer-split-class-list": "error",
1681
+ "astro/semi": "error"
1682
+ }
1683
+ });
1684
+ }
1685
+ if (unicorn) {
1686
+ const unicornFlatRecommended = pluginUnicorn.configs ? pluginUnicorn.configs["flat/recommended"] : void 0;
1687
+ const unicornRules = unicornFlatRecommended?.rules;
1688
+ config.push({
1689
+ name: STYLISTIC_CONFIG_NAME_RULES_UNICORN,
1690
+ rules: {
1691
+ ...unicornRules,
1692
+ "unicorn/consistent-function-scoping": "off",
1693
+ "unicorn/no-array-reduce": "off",
1694
+ "unicorn/no-nested-ternary": "off",
1695
+ "unicorn/no-static-only-class": "off",
1696
+ "unicorn/prefer-dom-node-dataset": "off",
1697
+ "unicorn/prevent-abbreviations": [
1698
+ "error",
1699
+ {
1700
+ allowList: {
1701
+ Env: true,
1702
+ ProcessEnv: true,
1703
+ Props: true,
1704
+ env: true
1705
+ }
1706
+ }
1707
+ ]
1708
+ }
1709
+ });
1710
+ if (markdown2) {
1711
+ config.push(
1712
+ {
1713
+ files: GLOB_MARKDOWN,
1714
+ name: STYLISTIC_CONFIG_NAME_RULES_UNICORN_MARKDOWN,
1715
+ rules: {
1716
+ "unicorn/filename-case": "off"
1717
+ }
1718
+ },
1719
+ {
1720
+ files: [
1721
+ ...GLOB_MARKDOWN_SOURCE,
1722
+ ...json2 ? GLOB_MARKDOWN_JSON : [],
1723
+ ...astro2 ? GLOB_MARKDOWN_ASTRO : []
1724
+ ],
1725
+ name: STYLISTIC_CONFIG_NAME_RULES_UNICORN_MARKDOWN_SOURCE,
1726
+ rules: {
1727
+ "unicorn/filename-case": "off"
1728
+ }
1729
+ }
1730
+ );
1731
+ }
1732
+ }
1733
+ if (perfectionist) {
1734
+ config.push({
1735
+ name: STYLISTIC_CONFIG_NAME_RULES_PERFECTIONIST,
1736
+ rules: {
1737
+ ...pluginPerfectionist.rules,
1738
+ "perfectionist/sort-classes": "off",
1739
+ "perfectionist/sort-exports": "off",
1740
+ "perfectionist/sort-imports": "off",
1741
+ "perfectionist/sort-interfaces": "off",
1742
+ "perfectionist/sort-named-exports": "off",
1743
+ "perfectionist/sort-named-imports": "off",
1744
+ "perfectionist/sort-object-types": "off"
1745
+ }
1746
+ });
1747
+ }
1748
+ if (format) {
1749
+ const prettierConfig = prettierOptions(stylistic2);
1750
+ config.push({
1751
+ files: typescript2 ? SOURCE_GLOBS : JAVASCRIPT_GLOBS,
1752
+ ignores: [
1753
+ ...GLOB_MARKDOWN_SOURCE,
1754
+ ...json2 ? GLOB_MARKDOWN_JSON : [],
1755
+ ...astro2 ? GLOB_MARKDOWN_ASTRO : []
1756
+ ],
1757
+ name: STYLISTIC_CONFIG_NAME_RULES_PRETTIER,
1758
+ rules: {
1759
+ "format/prettier": ["error", prettierConfig]
1760
+ }
1761
+ });
1762
+ if (astro2) {
1763
+ config.push({
1764
+ files: GLOB_ASTRO,
1765
+ name: STYLISTIC_CONFIG_NAME_RULES_PRETTIER_ASTRO,
1766
+ rules: {
1767
+ "format/prettier": [
1768
+ "error",
1769
+ {
1770
+ ...prettierConfig,
1771
+ parser: "astro",
1772
+ plugins: ["prettier-plugin-astro"]
1773
+ }
1774
+ ]
1775
+ }
1776
+ });
1777
+ }
1778
+ if (markdown2) {
1779
+ config.push({
1780
+ files: GLOB_MARKDOWN_SOURCE,
1781
+ name: STYLISTIC_CONFIG_NAME_RULES_PRETTIER_MARKDOWN_SOURCE,
1782
+ rules: {
1783
+ "format/prettier": ["error", { ...prettierConfig, tabWidth: 2, useTabs: false }]
1784
+ }
1785
+ });
1786
+ if (astro2) {
1787
+ config.push({
1788
+ files: GLOB_MARKDOWN_ASTRO,
1789
+ name: STYLISTIC_CONFIG_NAME_RULES_PRETTIER_MARKDOWN_ASTRO,
1790
+ rules: {
1791
+ "format/prettier": [
1792
+ "error",
1793
+ {
1794
+ ...prettierConfig,
1795
+ parser: "astro",
1796
+ plugins: ["prettier-plugin-astro"],
1797
+ tabWidth: 2,
1798
+ useTabs: false
1799
+ }
1800
+ ]
1801
+ }
1802
+ });
1803
+ }
1804
+ }
1805
+ }
1806
+ if (json2) {
1807
+ config.push({
1808
+ files: GLOB_MARKDOWN_JSON,
1809
+ name: STYLISTIC_CONFIG_NAME_RULES_MARKDOWN_JSON,
1810
+ rules: {
1811
+ "json/indent": ["error", 2]
1812
+ }
1813
+ });
1814
+ }
1815
+ if (astro2) {
1816
+ config.push({
1817
+ files: GLOB_MARKDOWN_ASTRO,
1818
+ name: STYLISTIC_CONFIG_NAME_RULES_MARKDOWN_ASRTO,
1819
+ rules: {
1820
+ [`${stylisticPluginRename}/indent`]: ["error", 2]
1821
+ }
1822
+ });
1823
+ }
1824
+ return config;
1825
+ }
1826
+
1827
+ // src/options/hexadrop-eslint.options.ts
1828
+ import { existsSync } from "node:fs";
1829
+ import path from "node:path";
1830
+ import process from "node:process";
1831
+ import { isPackageExists as isPackageExists2 } from "local-pkg";
1832
+ function getCwdTsconfigPath() {
1833
+ const root = process.cwd();
1834
+ const cwdTsconfigPath = path.resolve(root, "tsconfig.json");
1835
+ if (existsSync(cwdTsconfigPath)) {
1836
+ return "tsconfig.json";
1837
+ }
1838
+ return void 0;
1839
+ }
1840
+ function defaultOptions(options = {}) {
1841
+ let typescript2 = false;
1842
+ const installedTypescript = isPackageExists2("typescript");
1843
+ const installedReact = isPackageExists2("react");
1844
+ const installedAstro = isPackageExists2("astro");
1845
+ if (options.typescript === true) {
1846
+ typescript2 = true;
1847
+ } else if (installedTypescript) {
1848
+ if (options.typescript === void 0) {
1849
+ typescript2 = getCwdTsconfigPath() ?? true;
1850
+ } else if (options.typescript === "string" || Array.isArray(options.typescript)) {
1851
+ typescript2 = options.typescript.length > 0 ? options.typescript : true;
1852
+ }
1853
+ }
1854
+ return {
1855
+ astro: options.astro ?? installedAstro,
1856
+ ignore: options.ignore ?? true,
1857
+ imports: options.imports ?? true,
1858
+ json: options.json ?? true,
1859
+ markdown: options.markdown ?? true,
1860
+ module: {
1861
+ amd: false,
1862
+ commonjs: false,
1863
+ node: true,
1864
+ webpack: false,
1865
+ ...options.module,
1866
+ ignore: [String.raw`bun\:.*`, String.raw`astro\:.*`, ...options.module?.ignore ?? []]
1867
+ },
1868
+ node: options.node ?? true,
1869
+ react: options.react ?? installedReact,
1870
+ stylistic: options.stylistic === false ? false : {
1871
+ arrowParens: "avoid",
1872
+ braceStyle: "1tbs",
1873
+ bracketSameLine: true,
1874
+ bracketSpacing: true,
1875
+ endOfLine: "lf",
1876
+ format: true,
1877
+ imports: true,
1878
+ indent: "tab",
1879
+ indentSize: 4,
1880
+ perfectionist: true,
1881
+ printWidth: 120,
1882
+ quoteProps: "as-needed",
1883
+ quotes: "single",
1884
+ semicolons: true,
1885
+ singleAttributePerLine: true,
1886
+ trailingComma: "es5",
1887
+ unicorn: true,
1888
+ ...options.stylistic
1889
+ },
1890
+ typescript: typescript2
1891
+ };
1892
+ }
1893
+
1894
+ // src/factory.ts
1895
+ function hexadrop(optionsOrFlatConfigItem, ...configs) {
1896
+ const options = defaultOptions(optionsOrFlatConfigItem);
1897
+ let pipeline = new FlatConfigComposer(
1898
+ ignore(options),
1899
+ core(options),
1900
+ astro(options),
1901
+ typescript(options),
1902
+ react(options),
1903
+ json(options),
1904
+ markdown(options),
1905
+ imports(options),
1906
+ stylistic(options)
1907
+ ).renamePlugins(plugin_rename_default);
1908
+ const flatConfig = extractTypedFlatConfigItem(optionsOrFlatConfigItem);
1909
+ if (flatConfig) {
1910
+ pipeline = pipeline.append(flatConfig);
1911
+ }
1912
+ pipeline = pipeline.append(...configs);
1913
+ return pipeline;
1914
+ }
1915
+ export {
1916
+ combine,
1917
+ hexadrop as default
1918
+ };