@hexadrop/eslint-config 0.1.18 → 0.1.19

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