@heyq02/rslint-config 0.0.1 → 0.0.3-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,865 @@
1
+ import eslint_plugin_de_morgan from "eslint-plugin-de-morgan";
2
+ import eslint_plugin_eslint_comments from "@eslint-community/eslint-plugin-eslint-comments";
3
+ import { globalIgnores, globals, importPlugin, jestPlugin, js, jsxA11yPlugin, nodePlugin, promisePlugin, reactHooksPlugin, reactPlugin, rstestPlugin, ts, unicornPlugin } from "@rslint/core";
4
+ import eslint_plugin_regexp from "eslint-plugin-regexp";
5
+ import eslint_plugin_unused_imports from "eslint-plugin-unused-imports";
6
+ import { isPackageExists } from "local-pkg";
7
+ import node_process from "node:process";
8
+ const GLOB_SRC_EXT = '?([cm])[jt]s?(x)';
9
+ const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
10
+ const GLOB_JS = '**/*.?([cm])js';
11
+ const GLOB_JSX = '**/*.jsx';
12
+ const GLOB_TS = '**/*.?([cm])ts';
13
+ const GLOB_TSX = '**/*.tsx';
14
+ const GLOB_TESTS = [
15
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
16
+ `**/*.spec.${GLOB_SRC_EXT}`,
17
+ `**/*.test.${GLOB_SRC_EXT}`,
18
+ `**/*.bench.${GLOB_SRC_EXT}`,
19
+ `**/*.benchmark.${GLOB_SRC_EXT}`
20
+ ];
21
+ const GLOB_NODE_MODULES = '**/node_modules';
22
+ const GLOB_DIST = '**/dist';
23
+ const GLOB_LOCKFILE = [
24
+ '**/package-lock.json',
25
+ '**/yarn.lock',
26
+ '**/pnpm-lock.yaml',
27
+ '**/bun.lock',
28
+ '**/bun.lockb'
29
+ ];
30
+ const GLOB_EXCLUDE = [
31
+ GLOB_NODE_MODULES,
32
+ GLOB_DIST,
33
+ ...GLOB_LOCKFILE,
34
+ '**/coverage',
35
+ '**/temp',
36
+ '**/tmp',
37
+ '**/fixtures',
38
+ '**/output',
39
+ '**/.vitepress/cache',
40
+ '**/.nuxt',
41
+ '**/.next',
42
+ '**/.vercel',
43
+ '**/.changeset',
44
+ '**/.idea',
45
+ '**/.output',
46
+ '**/.vite-inspect',
47
+ '**/.nitro',
48
+ '**/.turbo',
49
+ '**/CHANGELOG*.md',
50
+ '**/*.min.*',
51
+ '**/LICENSE*',
52
+ '**/__snapshots__',
53
+ '**/auto-import?(s).d.ts',
54
+ '**/components.d.ts'
55
+ ];
56
+ function asESLintPlugin(plugin) {
57
+ return plugin;
58
+ }
59
+ const deMorgan = ()=>[
60
+ {
61
+ files: [
62
+ GLOB_SRC
63
+ ],
64
+ name: 'heyq02/de-morgan',
65
+ plugins: {
66
+ 'de-morgan': asESLintPlugin(eslint_plugin_de_morgan)
67
+ },
68
+ rules: {
69
+ 'de-morgan/no-negated-conjunction': 'error',
70
+ 'de-morgan/no-negated-disjunction': 'error'
71
+ }
72
+ }
73
+ ];
74
+ const eslintComments = ()=>[
75
+ {
76
+ files: [
77
+ GLOB_SRC
78
+ ],
79
+ name: 'heyq02/eslint-comments',
80
+ plugins: {
81
+ '@eslint-community/eslint-comments': asESLintPlugin(eslint_plugin_eslint_comments)
82
+ },
83
+ rules: {
84
+ '@eslint-community/eslint-comments/disable-enable-pair': [
85
+ 'error',
86
+ {
87
+ allowWholeFile: true
88
+ }
89
+ ],
90
+ '@eslint-community/eslint-comments/no-aggregating-enable': 'error',
91
+ '@eslint-community/eslint-comments/no-duplicate-disable': 'error',
92
+ '@eslint-community/eslint-comments/no-unlimited-disable': 'error',
93
+ '@eslint-community/eslint-comments/no-unused-enable': 'error'
94
+ }
95
+ }
96
+ ];
97
+ const ignores = (extra = [])=>[
98
+ {
99
+ ...globalIgnores([
100
+ ...GLOB_EXCLUDE,
101
+ ...extra
102
+ ]),
103
+ name: 'heyq02/global-ignores'
104
+ }
105
+ ];
106
+ const DEFAULT_SORT_IMPORT_GROUPS = [
107
+ 'type',
108
+ [
109
+ 'builtin',
110
+ 'external'
111
+ ],
112
+ 'internal',
113
+ [
114
+ 'parent',
115
+ 'sibling',
116
+ 'index'
117
+ ],
118
+ 'unknown'
119
+ ];
120
+ const DEFAULT_INTERNAL_PATTERN = [
121
+ '~/',
122
+ '@/',
123
+ '#'
124
+ ];
125
+ const PREDEFINED_GROUPS = new Set([
126
+ 'builtin',
127
+ 'external',
128
+ 'internal',
129
+ 'unknown',
130
+ 'parent',
131
+ 'sibling',
132
+ 'index',
133
+ 'object',
134
+ 'type'
135
+ ]);
136
+ function internalPatternToRegex(patterns) {
137
+ const escaped = patterns.map((pattern)=>pattern.replaceAll(/[.*+?^${}()|[\]\\]/g, '\\$&')).filter(Boolean);
138
+ if (0 === escaped.length) return '';
139
+ return `^(?:${escaped.join('|')})`;
140
+ }
141
+ function toPatterns(value) {
142
+ return Array.isArray(value) ? value : [
143
+ value
144
+ ];
145
+ }
146
+ function customGroupsToPathGroups(customGroups) {
147
+ return customGroups.flatMap((entry)=>{
148
+ const group = entry.group ?? 'external';
149
+ const position = entry.position ?? 'before';
150
+ return toPatterns(entry.elementNamePattern).map((pattern)=>({
151
+ pattern,
152
+ group,
153
+ position
154
+ }));
155
+ });
156
+ }
157
+ function resolveSortImports(options = true) {
158
+ const opts = true === options ? {} : options;
159
+ const { groups = DEFAULT_SORT_IMPORT_GROUPS, newlinesBetween = true, customGroups = [], internalPattern = DEFAULT_INTERNAL_PATTERN, order = 'asc', ignoreCase = true, named = true, sortSideEffects = false } = opts;
160
+ const pathGroups = customGroupsToPathGroups(customGroups);
161
+ const normalizedGroups = groups.map((item)=>{
162
+ if (Array.isArray(item)) {
163
+ const filtered = item.filter((g)=>PREDEFINED_GROUPS.has(g));
164
+ return filtered.length > 0 ? filtered : null;
165
+ }
166
+ return PREDEFINED_GROUPS.has(item) ? item : null;
167
+ }).filter((item)=>Boolean(item));
168
+ const rule = {
169
+ groups: normalizedGroups.length > 0 ? normalizedGroups : DEFAULT_SORT_IMPORT_GROUPS,
170
+ 'newlines-between': newlinesBetween ? 'always' : 'never',
171
+ alphabetize: {
172
+ order,
173
+ caseInsensitive: ignoreCase
174
+ },
175
+ named,
176
+ warnOnUnassignedImports: sortSideEffects,
177
+ ...pathGroups.length > 0 ? {
178
+ pathGroups,
179
+ pathGroupsExcludedImportTypes: [
180
+ 'builtin',
181
+ 'object'
182
+ ]
183
+ } : {}
184
+ };
185
+ const settings = {};
186
+ const internalRegex = internalPatternToRegex(internalPattern);
187
+ if (internalRegex) settings['import/internal-regex'] = internalRegex;
188
+ return {
189
+ rule,
190
+ settings
191
+ };
192
+ }
193
+ const imports = (options = {})=>{
194
+ const { typescript = false, sortImports: sortImportsOption = true } = options;
195
+ const configs = [
196
+ {
197
+ ...importPlugin.configs.recommended,
198
+ files: [
199
+ GLOB_SRC
200
+ ],
201
+ name: 'heyq02/imports/recommended'
202
+ },
203
+ {
204
+ files: [
205
+ GLOB_SRC
206
+ ],
207
+ name: 'heyq02/imports',
208
+ rules: {
209
+ 'import/first': 'error',
210
+ 'import/no-default-export': 'error',
211
+ 'import/no-duplicates': [
212
+ 'error',
213
+ {
214
+ 'prefer-inline': true
215
+ }
216
+ ],
217
+ 'import/no-mutable-exports': 'error',
218
+ 'import/no-named-default': 'error',
219
+ ...typescript ? {
220
+ 'import/default': 'off',
221
+ 'import/named': 'off',
222
+ 'import/namespace': 'off',
223
+ 'import/no-unresolved': 'off'
224
+ } : {}
225
+ }
226
+ }
227
+ ];
228
+ if (sortImportsOption) {
229
+ const { rule, settings } = resolveSortImports(sortImportsOption);
230
+ configs.push({
231
+ files: [
232
+ GLOB_SRC
233
+ ],
234
+ name: 'heyq02/imports/sort',
235
+ ...Object.keys(settings).length > 0 ? {
236
+ settings
237
+ } : {},
238
+ rules: {
239
+ 'import/order': [
240
+ 'error',
241
+ rule
242
+ ]
243
+ }
244
+ });
245
+ }
246
+ return configs;
247
+ };
248
+ const restrictedSyntaxJs = [
249
+ 'ForInStatement',
250
+ 'LabeledStatement'
251
+ ];
252
+ const javascript = ()=>[
253
+ {
254
+ ...js.configs.recommended,
255
+ name: 'heyq02/js/recommended'
256
+ },
257
+ {
258
+ files: [
259
+ GLOB_SRC
260
+ ],
261
+ languageOptions: {
262
+ ecmaVersion: 'latest',
263
+ globals: {
264
+ ...globals.browser,
265
+ ...globals.es2026,
266
+ ...globals.nodeBuiltin
267
+ },
268
+ sourceType: 'module'
269
+ },
270
+ name: 'heyq02/js',
271
+ rules: {
272
+ 'array-callback-return': 'error',
273
+ 'block-scoped-var': 'error',
274
+ 'dot-notation': 'warn',
275
+ eqeqeq: [
276
+ 'error',
277
+ 'smart'
278
+ ],
279
+ 'no-alert': 'warn',
280
+ 'no-console': [
281
+ 'warn',
282
+ {
283
+ allow: [
284
+ 'warn',
285
+ 'error',
286
+ 'info',
287
+ 'clear'
288
+ ]
289
+ }
290
+ ],
291
+ 'no-debugger': 'warn',
292
+ 'no-duplicate-imports': 'error',
293
+ 'no-empty': [
294
+ 'error',
295
+ {
296
+ allowEmptyCatch: true
297
+ }
298
+ ],
299
+ 'no-fallthrough': [
300
+ 'warn',
301
+ {
302
+ commentPattern: String.raw`break[\s\w]*omitted`
303
+ }
304
+ ],
305
+ 'no-inner-declarations': 'error',
306
+ 'no-lonely-if': 'error',
307
+ 'no-multi-str': 'error',
308
+ 'no-restricted-syntax': [
309
+ 'error',
310
+ ...restrictedSyntaxJs
311
+ ],
312
+ 'no-unused-expressions': [
313
+ 'error',
314
+ {
315
+ allowShortCircuit: true,
316
+ allowTaggedTemplates: true,
317
+ allowTernary: true
318
+ }
319
+ ],
320
+ 'no-unused-vars': [
321
+ 'error',
322
+ {
323
+ args: 'after-used',
324
+ argsIgnorePattern: '^_',
325
+ ignoreRestSiblings: true,
326
+ varsIgnorePattern: '^_'
327
+ }
328
+ ],
329
+ 'no-useless-call': 'error',
330
+ 'no-useless-computed-key': 'error',
331
+ 'no-useless-constructor': 'error',
332
+ 'no-useless-rename': 'error',
333
+ 'no-var': 'error',
334
+ 'no-void': 'error',
335
+ 'object-shorthand': [
336
+ 'error',
337
+ 'always',
338
+ {
339
+ avoidQuotes: true,
340
+ ignoreConstructors: false
341
+ }
342
+ ],
343
+ 'one-var': [
344
+ 'error',
345
+ {
346
+ initialized: 'never'
347
+ }
348
+ ],
349
+ 'prefer-arrow-callback': [
350
+ 'error',
351
+ {
352
+ allowNamedFunctions: false,
353
+ allowUnboundThis: true
354
+ }
355
+ ],
356
+ 'prefer-const': [
357
+ 'warn',
358
+ {
359
+ destructuring: 'all',
360
+ ignoreReadBeforeAssign: true
361
+ }
362
+ ],
363
+ 'prefer-exponentiation-operator': 'error',
364
+ 'prefer-regex-literals': [
365
+ 'error',
366
+ {
367
+ disallowRedundantWrapping: true
368
+ }
369
+ ],
370
+ 'prefer-rest-params': 'error',
371
+ 'prefer-spread': 'error',
372
+ 'prefer-template': 'error',
373
+ 'require-await': 'error',
374
+ 'unicode-bom': [
375
+ 'error',
376
+ 'never'
377
+ ],
378
+ 'use-isnan': [
379
+ 'error',
380
+ {
381
+ enforceForIndexOf: true,
382
+ enforceForSwitchCase: true
383
+ }
384
+ ],
385
+ 'valid-typeof': [
386
+ 'error',
387
+ {
388
+ requireStringLiterals: true
389
+ }
390
+ ],
391
+ 'vars-on-top': 'error'
392
+ }
393
+ }
394
+ ];
395
+ const jest = ()=>[
396
+ {
397
+ ...jestPlugin.configs.recommended,
398
+ files: [
399
+ ...GLOB_TESTS
400
+ ],
401
+ name: 'heyq02/jest/recommended'
402
+ },
403
+ {
404
+ ...jestPlugin.configs.style,
405
+ files: [
406
+ ...GLOB_TESTS
407
+ ],
408
+ name: 'heyq02/jest/style'
409
+ }
410
+ ];
411
+ const node = (preset = 'module')=>{
412
+ if ('mixed' === preset) return nodePlugin.configs.recommended.map((entry, index)=>({
413
+ ...entry,
414
+ name: entry.name ?? `heyq02/node/recommended-${index}`
415
+ }));
416
+ if ("script" === preset) return [
417
+ {
418
+ ...nodePlugin.configs.recommendedScript,
419
+ files: [
420
+ GLOB_SRC
421
+ ],
422
+ name: "heyq02/node/recommended-script"
423
+ }
424
+ ];
425
+ return [
426
+ {
427
+ ...nodePlugin.configs.recommendedModule,
428
+ files: [
429
+ GLOB_SRC
430
+ ],
431
+ name: 'heyq02/node/recommended-module'
432
+ },
433
+ {
434
+ files: [
435
+ GLOB_SRC
436
+ ],
437
+ name: 'heyq02/node',
438
+ plugins: [
439
+ 'node'
440
+ ],
441
+ rules: {
442
+ 'node/handle-callback-err': [
443
+ 'error',
444
+ '^(err|error)$'
445
+ ],
446
+ 'node/no-deprecated-api': 'error',
447
+ 'node/no-exports-assign': 'error',
448
+ 'node/no-new-require': 'error',
449
+ 'node/no-path-concat': 'error',
450
+ 'node/prefer-global/buffer': [
451
+ 'error',
452
+ 'never'
453
+ ],
454
+ 'node/prefer-global/process': [
455
+ 'error',
456
+ 'never'
457
+ ],
458
+ 'node/process-exit-as-throw': 'error'
459
+ }
460
+ }
461
+ ];
462
+ };
463
+ const promise = ()=>[
464
+ {
465
+ ...promisePlugin.configs.recommended,
466
+ files: [
467
+ GLOB_SRC
468
+ ],
469
+ name: 'heyq02/promise/recommended'
470
+ },
471
+ {
472
+ files: [
473
+ GLOB_SRC
474
+ ],
475
+ name: 'heyq02/promise',
476
+ rules: {
477
+ 'promise/always-return': 'off',
478
+ 'promise/catch-or-return': 'off',
479
+ 'promise/no-nesting': 'off'
480
+ }
481
+ }
482
+ ];
483
+ const reactFiles = [
484
+ GLOB_JSX,
485
+ GLOB_TSX,
486
+ '**/*.{jsx,tsx}'
487
+ ];
488
+ const jsxA11y = ()=>[
489
+ {
490
+ ...jsxA11yPlugin.configs.recommended,
491
+ files: reactFiles,
492
+ name: 'heyq02/jsx-a11y/recommended'
493
+ }
494
+ ];
495
+ const react = (options = {})=>{
496
+ const configs = [
497
+ {
498
+ ...reactPlugin.configs.recommended,
499
+ files: reactFiles,
500
+ name: 'heyq02/react/recommended'
501
+ },
502
+ {
503
+ ...reactHooksPlugin.configs.recommended,
504
+ files: reactFiles,
505
+ name: 'heyq02/react-hooks/recommended'
506
+ }
507
+ ];
508
+ if (false !== options.jsxA11y) configs.push(...jsxA11y());
509
+ return configs;
510
+ };
511
+ const regexp = ()=>{
512
+ const recommended = eslint_plugin_regexp.configs["flat/recommended"];
513
+ return [
514
+ {
515
+ files: [
516
+ GLOB_SRC
517
+ ],
518
+ name: 'heyq02/regexp',
519
+ plugins: {
520
+ regexp: asESLintPlugin(eslint_plugin_regexp)
521
+ },
522
+ rules: recommended.rules
523
+ }
524
+ ];
525
+ };
526
+ const rstest = ()=>[
527
+ {
528
+ ...rstestPlugin.configs.recommended,
529
+ files: [
530
+ ...GLOB_TESTS
531
+ ],
532
+ name: 'heyq02/rstest/recommended'
533
+ }
534
+ ];
535
+ const specialCases = ()=>[
536
+ {
537
+ files: [
538
+ "**/scripts/*",
539
+ '**/cli.*',
540
+ '**/bin/**'
541
+ ],
542
+ name: 'heyq02/special/cli',
543
+ rules: {
544
+ 'no-console': 'off'
545
+ }
546
+ },
547
+ {
548
+ files: [
549
+ `**/*.{test,spec}.${GLOB_SRC_EXT}`
550
+ ],
551
+ name: 'heyq02/special/tests',
552
+ rules: {
553
+ 'no-unused-expressions': 'off',
554
+ "@typescript-eslint/no-unused-expressions": 'off'
555
+ }
556
+ },
557
+ {
558
+ files: [
559
+ `**/*config*.${GLOB_SRC_EXT}`,
560
+ `**/{views,pages,routes,middleware,plugins,api,modules}/${GLOB_SRC}`,
561
+ `**/{index,vite,esbuild,rollup,rolldown,webpack,rspack,farm,unloader,nuxt,rslint}.${GLOB_SRC_EXT}`,
562
+ '**/*.d.ts',
563
+ '**/.prettierrc*',
564
+ '**/.oxfmtrc*',
565
+ '**/oxfmt.config.*'
566
+ ],
567
+ name: 'heyq02/special/allow-default-export',
568
+ rules: {
569
+ 'import/no-default-export': 'off'
570
+ }
571
+ },
572
+ {
573
+ files: [
574
+ '**/ISSUE_TEMPLATE/**'
575
+ ],
576
+ name: 'heyq02/special/github',
577
+ rules: {
578
+ 'unicorn/filename-case': 'off'
579
+ }
580
+ },
581
+ {
582
+ files: [
583
+ GLOB_JSX,
584
+ GLOB_TSX
585
+ ],
586
+ name: 'heyq02/special/components',
587
+ rules: {
588
+ 'unicorn/no-anonymous-default-export': 'off',
589
+ 'import/no-default-export': 'off'
590
+ }
591
+ }
592
+ ];
593
+ function resolveTypeScriptOptions(options) {
594
+ if (true === options) return {
595
+ typeChecked: false,
596
+ strict: false,
597
+ stylistic: true
598
+ };
599
+ return {
600
+ typeChecked: options.typeChecked ?? false,
601
+ strict: options.strict ?? false,
602
+ stylistic: options.stylistic ?? true,
603
+ projectService: options.projectService
604
+ };
605
+ }
606
+ const typescript_typescript = (options = true)=>{
607
+ const opts = resolveTypeScriptOptions(options);
608
+ const baseline = opts.strict && opts.typeChecked ? ts.configs.strictTypeChecked : opts.strict ? ts.configs.strict : opts.typeChecked ? ts.configs.recommendedTypeChecked : ts.configs.recommended;
609
+ const stylistic = opts.stylistic ? opts.typeChecked ? ts.configs.stylisticTypeChecked : ts.configs.stylistic : [];
610
+ const enableProjectService = opts.projectService ?? (opts.typeChecked ? true : void 0);
611
+ return [
612
+ ...baseline,
613
+ ...stylistic,
614
+ {
615
+ files: [
616
+ GLOB_TS,
617
+ GLOB_TSX
618
+ ],
619
+ name: "heyq02/typescript",
620
+ ...void 0 === enableProjectService ? {} : {
621
+ languageOptions: {
622
+ parserOptions: {
623
+ projectService: enableProjectService
624
+ }
625
+ }
626
+ },
627
+ rules: {
628
+ "@typescript-eslint/ban-ts-comment": 'off',
629
+ "@typescript-eslint/consistent-type-assertions": [
630
+ 'error',
631
+ {
632
+ assertionStyle: 'as',
633
+ objectLiteralTypeAssertions: 'allow-as-parameter'
634
+ }
635
+ ],
636
+ "@typescript-eslint/consistent-type-imports": [
637
+ 'error',
638
+ {
639
+ disallowTypeAnnotations: false,
640
+ fixStyle: 'inline-type-imports'
641
+ }
642
+ ],
643
+ "@typescript-eslint/method-signature-style": [
644
+ 'error',
645
+ 'property'
646
+ ],
647
+ "@typescript-eslint/no-empty-object-type": 'off',
648
+ "@typescript-eslint/no-explicit-any": 'off',
649
+ "@typescript-eslint/no-import-type-side-effects": 'error',
650
+ "@typescript-eslint/no-non-null-assertion": 'off',
651
+ "@typescript-eslint/no-redeclare": 'error',
652
+ "@typescript-eslint/no-unused-expressions": [
653
+ 'error',
654
+ {
655
+ allowShortCircuit: true,
656
+ allowTaggedTemplates: true,
657
+ allowTernary: true
658
+ }
659
+ ],
660
+ "@typescript-eslint/no-unused-vars": [
661
+ 'error',
662
+ {
663
+ args: 'after-used',
664
+ argsIgnorePattern: '^_',
665
+ ignoreRestSiblings: true,
666
+ varsIgnorePattern: '^_'
667
+ }
668
+ ],
669
+ "@typescript-eslint/no-useless-constructor": 'error',
670
+ "@typescript-eslint/prefer-as-const": 'warn',
671
+ "@typescript-eslint/prefer-literal-enum-member": [
672
+ 'error',
673
+ {
674
+ allowBitwiseExpressions: true
675
+ }
676
+ ],
677
+ 'no-restricted-syntax': [
678
+ 'error',
679
+ ...restrictedSyntaxJs,
680
+ 'TSEnumDeclaration[const=true]'
681
+ ],
682
+ 'no-unused-vars': 'off'
683
+ }
684
+ },
685
+ {
686
+ files: [
687
+ '**/*.d.ts'
688
+ ],
689
+ name: "heyq02/typescript/dts-rules",
690
+ rules: {
691
+ 'import/no-duplicates': 'off',
692
+ 'no-restricted-syntax': 'off'
693
+ }
694
+ },
695
+ {
696
+ files: [
697
+ GLOB_JS,
698
+ '**/*.cjs'
699
+ ],
700
+ name: "heyq02/typescript/cjs-rules",
701
+ rules: {
702
+ "@typescript-eslint/no-require-imports": 'off'
703
+ }
704
+ }
705
+ ];
706
+ };
707
+ const unicorn = ()=>[
708
+ {
709
+ ...unicornPlugin.configs.recommended,
710
+ files: [
711
+ GLOB_SRC
712
+ ],
713
+ name: 'heyq02/unicorn/recommended'
714
+ },
715
+ {
716
+ files: [
717
+ GLOB_SRC
718
+ ],
719
+ name: 'heyq02/unicorn',
720
+ rules: {
721
+ 'unicorn/filename-case': [
722
+ 'error',
723
+ {
724
+ cases: {
725
+ kebabCase: true,
726
+ pascalCase: true
727
+ },
728
+ ignore: [
729
+ String.raw`^[A-Z]+\..*$`,
730
+ String.raw`^[a-z]{2}-[A-Z]{2}$`,
731
+ String.raw`import_map\.json`
732
+ ]
733
+ }
734
+ ],
735
+ 'unicorn/no-null': 'off',
736
+ 'unicorn/no-this-assignment': 'off',
737
+ 'unicorn/prefer-ternary': 'off',
738
+ 'unicorn/no-process-exit': 'off'
739
+ }
740
+ }
741
+ ];
742
+ const unusedVarsOptions = {
743
+ args: 'after-used',
744
+ argsIgnorePattern: '^_',
745
+ ignoreRestSiblings: true,
746
+ varsIgnorePattern: '^_'
747
+ };
748
+ const unusedImports = ()=>[
749
+ {
750
+ files: [
751
+ GLOB_SRC
752
+ ],
753
+ name: 'heyq02/unused-imports',
754
+ plugins: {
755
+ 'unused-imports': asESLintPlugin(eslint_plugin_unused_imports)
756
+ },
757
+ rules: {
758
+ 'no-unused-vars': 'off',
759
+ "@typescript-eslint/no-unused-vars": 'off',
760
+ 'unused-imports/no-unused-imports': 'error',
761
+ 'unused-imports/no-unused-vars': [
762
+ 'error',
763
+ {
764
+ ...unusedVarsOptions
765
+ }
766
+ ]
767
+ }
768
+ }
769
+ ];
770
+ const hasTypeScript = ()=>isPackageExists("typescript");
771
+ const hasReact = ()=>isPackageExists('react') || isPackageExists('react-dom') || isPackageExists('next') || isPackageExists('preact') || isPackageExists('@remix-run/react');
772
+ const hasJest = ()=>isPackageExists('jest') || isPackageExists('@jest/globals');
773
+ const hasRstest = ()=>isPackageExists('rstest') || isPackageExists('@rstest/core') || isPackageExists('@rstest/adapter');
774
+ function isInEditorEnv() {
775
+ if (node_process.env.CI) return false;
776
+ if (isInGitHooksOrLintStaged()) return false;
777
+ return !!(node_process.env.VSCODE_PID || node_process.env.VSCODE_CWD || node_process.env.JETBRAINS_IDE || node_process.env.VIM || node_process.env.NVIM);
778
+ }
779
+ function isInGitHooksOrLintStaged() {
780
+ return !!(node_process.env.GIT_PARAMS || node_process.env.VSCODE_GIT_COMMAND || node_process.env.npm_lifecycle_script?.startsWith('lint-staged'));
781
+ }
782
+ function flattenConfigs(...configs) {
783
+ const result = [];
784
+ for (const config of configs)if (config) {
785
+ if (Array.isArray(config)) {
786
+ result.push(...flattenConfigs(...config));
787
+ continue;
788
+ }
789
+ result.push(config);
790
+ }
791
+ return result;
792
+ }
793
+ function toArray(value) {
794
+ return Array.isArray(value) ? value : [
795
+ value
796
+ ];
797
+ }
798
+ const presetJavaScript = ()=>[
799
+ ...ignores(),
800
+ ...javascript(),
801
+ ...imports({
802
+ typescript: false,
803
+ sortImports: true
804
+ }),
805
+ ...unicorn(),
806
+ ...node(),
807
+ ...promise(),
808
+ ...unusedImports(),
809
+ ...regexp(),
810
+ ...deMorgan(),
811
+ ...eslintComments()
812
+ ];
813
+ const presetBasic = (typescriptOptions = true)=>[
814
+ ...ignores(),
815
+ ...javascript(),
816
+ ...typescript_typescript(typescriptOptions),
817
+ ...imports({
818
+ typescript: true,
819
+ sortImports: true
820
+ }),
821
+ ...unicorn(),
822
+ ...node(),
823
+ ...promise(),
824
+ ...unusedImports(),
825
+ ...regexp(),
826
+ ...deMorgan(),
827
+ ...eslintComments()
828
+ ];
829
+ const presetAll = ()=>heyq02({
830
+ typescript: true,
831
+ react: true,
832
+ jest: true,
833
+ rstest: true,
834
+ jsxA11y: true
835
+ });
836
+ function heyq02(options = {}, ...userConfigs) {
837
+ const { ignores: extraIgnores = [], javascript: enableJavaScript = true, typescript: enableTypeScript = hasTypeScript(), unicorn: enableUnicorn = true, imports: enableImports = true, sortImports: sortImportsOption = true, node: enableNode = true, promise: enablePromise = true, react: enableReact = hasReact(), jsxA11y: enableJsxA11y, jest: enableJest = hasJest(), rstest: enableRstest = hasRstest(), unusedImports: enableUnusedImports = true, regexp: enableRegexp = true, deMorgan: enableDeMorgan = true, eslintComments: enableEslintComments = true } = options;
838
+ const configs = [
839
+ ...ignores(extraIgnores)
840
+ ];
841
+ if (enableJavaScript) configs.push(...javascript());
842
+ if (enableTypeScript) configs.push(...typescript_typescript(true === enableTypeScript ? true : enableTypeScript));
843
+ if (enableImports) configs.push(...imports({
844
+ typescript: Boolean(enableTypeScript),
845
+ sortImports: sortImportsOption
846
+ }));
847
+ if (enableUnicorn) configs.push(...unicorn());
848
+ if (enableNode) configs.push(...node(true === enableNode ? 'module' : enableNode));
849
+ if (enablePromise) configs.push(...promise());
850
+ if (enableReact) configs.push(...react({
851
+ jsxA11y: enableJsxA11y ?? true
852
+ }));
853
+ else if (enableJsxA11y) configs.push(...jsxA11y());
854
+ if (enableJest) configs.push(...jest());
855
+ if (enableRstest) configs.push(...rstest());
856
+ if (enableUnusedImports) configs.push(...unusedImports());
857
+ if (enableRegexp) configs.push(...regexp());
858
+ if (enableDeMorgan) configs.push(...deMorgan());
859
+ if (enableEslintComments) configs.push(...eslintComments());
860
+ configs.push(...specialCases());
861
+ configs.push(...flattenConfigs(...userConfigs));
862
+ return configs;
863
+ }
864
+ const rslintConfig = heyq02;
865
+ export { DEFAULT_INTERNAL_PATTERN, DEFAULT_SORT_IMPORT_GROUPS, GLOB_DIST, GLOB_EXCLUDE, GLOB_JS, GLOB_JSX, GLOB_LOCKFILE, GLOB_NODE_MODULES, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TS, GLOB_TSX, customGroupsToPathGroups, deMorgan, eslintComments, flattenConfigs, hasJest, hasReact, hasRstest, hasTypeScript, heyq02, ignores, imports, internalPatternToRegex, isInEditorEnv, isInGitHooksOrLintStaged, javascript, jest, jsxA11y, node, presetAll, presetBasic, presetJavaScript, promise, react, regexp, resolveSortImports, restrictedSyntaxJs, rslintConfig, rstest, specialCases, toArray, typescript_typescript as typescript, unicorn, unusedImports };