@solvro/config 1.0.5 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,225 @@
1
1
  import {
2
+ __commonJS,
3
+ __toESM,
2
4
  init_esm_shims
3
- } from "../chunk-62DEEFN2.js";
5
+ } from "../chunk-HPR44PFE.js";
4
6
 
5
- // eslint-config/index.ts
6
- init_esm_shims();
7
-
8
- // eslint-config/factory.ts
9
- init_esm_shims();
10
- import { FlatConfigComposer } from "eslint-flat-config-utils";
11
- import { isPackageExists as isPackageExists3 } from "local-pkg";
12
-
13
- // eslint-config/configs/index.ts
14
- init_esm_shims();
7
+ // node_modules/eslint-config-prettier/index.js
8
+ var require_eslint_config_prettier = __commonJS({
9
+ "node_modules/eslint-config-prettier/index.js"(exports, module) {
10
+ "use strict";
11
+ init_esm_shims();
12
+ var includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;
13
+ var specialRule = 0;
14
+ module.exports = {
15
+ rules: {
16
+ // The following rules can be used in some cases. See the README for more
17
+ // information. These are marked with `0` instead of `"off"` so that a
18
+ // script can distinguish them. Note that there are a few more of these
19
+ // in the deprecated section below.
20
+ "curly": specialRule,
21
+ "no-unexpected-multiline": specialRule,
22
+ "@typescript-eslint/lines-around-comment": specialRule,
23
+ "@typescript-eslint/quotes": specialRule,
24
+ "babel/quotes": specialRule,
25
+ "unicorn/template-indent": specialRule,
26
+ "vue/html-self-closing": specialRule,
27
+ "vue/max-len": specialRule,
28
+ // The rest are rules that you never need to enable when using Prettier.
29
+ "@babel/object-curly-spacing": "off",
30
+ "@babel/semi": "off",
31
+ "@typescript-eslint/block-spacing": "off",
32
+ "@typescript-eslint/brace-style": "off",
33
+ "@typescript-eslint/comma-dangle": "off",
34
+ "@typescript-eslint/comma-spacing": "off",
35
+ "@typescript-eslint/func-call-spacing": "off",
36
+ "@typescript-eslint/indent": "off",
37
+ "@typescript-eslint/key-spacing": "off",
38
+ "@typescript-eslint/keyword-spacing": "off",
39
+ "@typescript-eslint/member-delimiter-style": "off",
40
+ "@typescript-eslint/no-extra-parens": "off",
41
+ "@typescript-eslint/no-extra-semi": "off",
42
+ "@typescript-eslint/object-curly-spacing": "off",
43
+ "@typescript-eslint/semi": "off",
44
+ "@typescript-eslint/space-before-blocks": "off",
45
+ "@typescript-eslint/space-before-function-paren": "off",
46
+ "@typescript-eslint/space-infix-ops": "off",
47
+ "@typescript-eslint/type-annotation-spacing": "off",
48
+ "babel/object-curly-spacing": "off",
49
+ "babel/semi": "off",
50
+ "flowtype/boolean-style": "off",
51
+ "flowtype/delimiter-dangle": "off",
52
+ "flowtype/generic-spacing": "off",
53
+ "flowtype/object-type-curly-spacing": "off",
54
+ "flowtype/object-type-delimiter": "off",
55
+ "flowtype/quotes": "off",
56
+ "flowtype/semi": "off",
57
+ "flowtype/space-after-type-colon": "off",
58
+ "flowtype/space-before-generic-bracket": "off",
59
+ "flowtype/space-before-type-colon": "off",
60
+ "flowtype/union-intersection-spacing": "off",
61
+ "react/jsx-child-element-spacing": "off",
62
+ "react/jsx-closing-bracket-location": "off",
63
+ "react/jsx-closing-tag-location": "off",
64
+ "react/jsx-curly-newline": "off",
65
+ "react/jsx-curly-spacing": "off",
66
+ "react/jsx-equals-spacing": "off",
67
+ "react/jsx-first-prop-new-line": "off",
68
+ "react/jsx-indent": "off",
69
+ "react/jsx-indent-props": "off",
70
+ "react/jsx-max-props-per-line": "off",
71
+ "react/jsx-newline": "off",
72
+ "react/jsx-one-expression-per-line": "off",
73
+ "react/jsx-props-no-multi-spaces": "off",
74
+ "react/jsx-tag-spacing": "off",
75
+ "react/jsx-wrap-multilines": "off",
76
+ "standard/array-bracket-even-spacing": "off",
77
+ "standard/computed-property-even-spacing": "off",
78
+ "standard/object-curly-even-spacing": "off",
79
+ "unicorn/empty-brace-spaces": "off",
80
+ "unicorn/no-nested-ternary": "off",
81
+ "unicorn/number-literal-case": "off",
82
+ "vue/array-bracket-newline": "off",
83
+ "vue/array-bracket-spacing": "off",
84
+ "vue/array-element-newline": "off",
85
+ "vue/arrow-spacing": "off",
86
+ "vue/block-spacing": "off",
87
+ "vue/block-tag-newline": "off",
88
+ "vue/brace-style": "off",
89
+ "vue/comma-dangle": "off",
90
+ "vue/comma-spacing": "off",
91
+ "vue/comma-style": "off",
92
+ "vue/dot-location": "off",
93
+ "vue/func-call-spacing": "off",
94
+ "vue/html-closing-bracket-newline": "off",
95
+ "vue/html-closing-bracket-spacing": "off",
96
+ "vue/html-end-tags": "off",
97
+ "vue/html-indent": "off",
98
+ "vue/html-quotes": "off",
99
+ "vue/key-spacing": "off",
100
+ "vue/keyword-spacing": "off",
101
+ "vue/max-attributes-per-line": "off",
102
+ "vue/multiline-html-element-content-newline": "off",
103
+ "vue/multiline-ternary": "off",
104
+ "vue/mustache-interpolation-spacing": "off",
105
+ "vue/no-extra-parens": "off",
106
+ "vue/no-multi-spaces": "off",
107
+ "vue/no-spaces-around-equal-signs-in-attribute": "off",
108
+ "vue/object-curly-newline": "off",
109
+ "vue/object-curly-spacing": "off",
110
+ "vue/object-property-newline": "off",
111
+ "vue/operator-linebreak": "off",
112
+ "vue/quote-props": "off",
113
+ "vue/script-indent": "off",
114
+ "vue/singleline-html-element-content-newline": "off",
115
+ "vue/space-in-parens": "off",
116
+ "vue/space-infix-ops": "off",
117
+ "vue/space-unary-ops": "off",
118
+ "vue/template-curly-spacing": "off",
119
+ ...includeDeprecated && {
120
+ // Removed in version 0.10.0.
121
+ // https://eslint.org/docs/latest/rules/space-unary-word-ops
122
+ "space-unary-word-ops": "off",
123
+ // Removed in version 1.0.0.
124
+ // https://github.com/eslint/eslint/issues/1898
125
+ "generator-star": "off",
126
+ "no-comma-dangle": "off",
127
+ "no-reserved-keys": "off",
128
+ "no-space-before-semi": "off",
129
+ "no-wrap-func": "off",
130
+ "space-after-function-name": "off",
131
+ "space-before-function-parentheses": "off",
132
+ "space-in-brackets": "off",
133
+ // Removed in version 2.0.0.
134
+ // https://github.com/eslint/eslint/issues/5032
135
+ "no-arrow-condition": "off",
136
+ "space-after-keywords": "off",
137
+ "space-before-keywords": "off",
138
+ "space-return-throw-case": "off",
139
+ // Deprecated since version 3.3.0.
140
+ // https://eslint.org/docs/rules/no-spaced-func
141
+ "no-spaced-func": "off",
142
+ // Deprecated since version 4.0.0.
143
+ // https://github.com/eslint/eslint/pull/8286
144
+ "indent-legacy": "off",
145
+ // Deprecated since version 8.53.0.
146
+ // https://eslint.org/blog/2023/10/deprecating-formatting-rules/
147
+ "array-bracket-newline": "off",
148
+ "array-bracket-spacing": "off",
149
+ "array-element-newline": "off",
150
+ "arrow-parens": "off",
151
+ "arrow-spacing": "off",
152
+ "block-spacing": "off",
153
+ "brace-style": "off",
154
+ "comma-dangle": "off",
155
+ "comma-spacing": "off",
156
+ "comma-style": "off",
157
+ "computed-property-spacing": "off",
158
+ "dot-location": "off",
159
+ "eol-last": "off",
160
+ "func-call-spacing": "off",
161
+ "function-call-argument-newline": "off",
162
+ "function-paren-newline": "off",
163
+ "generator-star-spacing": "off",
164
+ "implicit-arrow-linebreak": "off",
165
+ "indent": "off",
166
+ "jsx-quotes": "off",
167
+ "key-spacing": "off",
168
+ "keyword-spacing": "off",
169
+ "linebreak-style": "off",
170
+ "lines-around-comment": specialRule,
171
+ "max-len": specialRule,
172
+ "max-statements-per-line": "off",
173
+ "multiline-ternary": "off",
174
+ "new-parens": "off",
175
+ "newline-per-chained-call": "off",
176
+ "no-confusing-arrow": specialRule,
177
+ "no-extra-parens": "off",
178
+ "no-extra-semi": "off",
179
+ "no-floating-decimal": "off",
180
+ "no-mixed-operators": specialRule,
181
+ "no-mixed-spaces-and-tabs": "off",
182
+ "no-multi-spaces": "off",
183
+ "no-multiple-empty-lines": "off",
184
+ "no-tabs": specialRule,
185
+ "no-trailing-spaces": "off",
186
+ "no-whitespace-before-property": "off",
187
+ "nonblock-statement-body-position": "off",
188
+ "object-curly-newline": "off",
189
+ "object-curly-spacing": "off",
190
+ "object-property-newline": "off",
191
+ "one-var-declaration-per-line": "off",
192
+ "operator-linebreak": "off",
193
+ "padded-blocks": "off",
194
+ "quote-props": "off",
195
+ "quotes": specialRule,
196
+ "rest-spread-spacing": "off",
197
+ "semi": "off",
198
+ "semi-spacing": "off",
199
+ "semi-style": "off",
200
+ "space-before-blocks": "off",
201
+ "space-before-function-paren": "off",
202
+ "space-in-parens": "off",
203
+ "space-infix-ops": "off",
204
+ "space-unary-ops": "off",
205
+ "switch-colon-spacing": "off",
206
+ "template-curly-spacing": "off",
207
+ "template-tag-spacing": "off",
208
+ "wrap-iife": "off",
209
+ "wrap-regex": "off",
210
+ "yield-star-spacing": "off",
211
+ // Deprecated since version 7.0.0.
212
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
213
+ "react/jsx-space-before-closing": "off"
214
+ }
215
+ }
216
+ };
217
+ }
218
+ });
15
219
 
16
- // eslint-config/configs/command.ts
220
+ // eslint-config/index.ts
17
221
  init_esm_shims();
18
- import createCommand from "eslint-plugin-command/config";
19
- async function command() {
20
- return [
21
- {
22
- ...createCommand(),
23
- name: "solvro/command/rules"
24
- }
25
- ];
26
- }
222
+ import tseslint2 from "typescript-eslint";
27
223
 
28
224
  // eslint-config/configs/comments.ts
29
225
  init_esm_shims();
@@ -39,11 +235,12 @@ import { default as default6 } from "eslint-plugin-unicorn";
39
235
  import { default as default7 } from "eslint-plugin-unused-imports";
40
236
 
41
237
  // eslint-config/configs/comments.ts
42
- async function comments() {
238
+ function comments() {
43
239
  return [
44
240
  {
45
241
  name: "solvro/eslint-comments/rules",
46
242
  plugins: {
243
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
47
244
  "eslint-comments": default2
48
245
  },
49
246
  rules: {
@@ -63,19 +260,7 @@ init_esm_shims();
63
260
  init_esm_shims();
64
261
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
65
262
  var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
66
- var GLOB_JS = "**/*.?([cm])js";
67
- var GLOB_JSX = "**/*.?([cm])jsx";
68
- var GLOB_TS = "**/*.?([cm])ts";
69
- var GLOB_TSX = "**/*.?([cm])tsx";
70
- var GLOB_STYLE = "**/*.{c,le,sc}ss";
71
- var GLOB_JSON = "**/*.json";
72
- var GLOB_JSON5 = "**/*.json5";
73
263
  var GLOB_MARKDOWN = "**/*.md";
74
- var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
75
- var GLOB_TOML = "**/*.toml";
76
- var GLOB_XML = "**/*.xml";
77
- var GLOB_SVG = "**/*.svg";
78
- var GLOB_HTML = "**/*.htm?(l)";
79
264
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
80
265
  var GLOB_TESTS = [
81
266
  `**/__tests__/**/*.${GLOB_SRC_EXT}`,
@@ -84,15 +269,6 @@ var GLOB_TESTS = [
84
269
  `**/*.bench.${GLOB_SRC_EXT}`,
85
270
  `**/*.benchmark.${GLOB_SRC_EXT}`
86
271
  ];
87
- var GLOB_ALL_SRC = [
88
- GLOB_SRC,
89
- GLOB_STYLE,
90
- GLOB_JSON,
91
- GLOB_JSON5,
92
- GLOB_MARKDOWN,
93
- GLOB_XML,
94
- GLOB_HTML
95
- ];
96
272
  var GLOB_EXCLUDE = [
97
273
  "**/node_modules",
98
274
  "**/dist",
@@ -128,7 +304,7 @@ var GLOB_EXCLUDE = [
128
304
  ];
129
305
 
130
306
  // eslint-config/configs/disables.ts
131
- async function disables() {
307
+ function disables() {
132
308
  return [
133
309
  {
134
310
  files: [`**/scripts/${GLOB_SRC}`],
@@ -136,7 +312,7 @@ async function disables() {
136
312
  rules: {
137
313
  "antfu/no-top-level-await": "off",
138
314
  "no-console": "off",
139
- "ts/explicit-function-return-type": "off"
315
+ "@typescript-eslint/explicit-function-return-type": "off"
140
316
  }
141
317
  },
142
318
  {
@@ -160,7 +336,7 @@ async function disables() {
160
336
  name: "solvro/disables/dts",
161
337
  rules: {
162
338
  "eslint-comments/no-unlimited-disable": "off",
163
- "import/no-duplicates": "off",
339
+ "import-x/no-duplicates": "off",
164
340
  "no-restricted-syntax": "off",
165
341
  "unused-imports/no-unused-vars": "off"
166
342
  }
@@ -169,7 +345,7 @@ async function disables() {
169
345
  files: ["**/*.js", "**/*.cjs"],
170
346
  name: "solvro/disables/cjs",
171
347
  rules: {
172
- "ts/no-require-imports": "off"
348
+ "@typescript-eslint/no-require-imports": "off"
173
349
  }
174
350
  },
175
351
  {
@@ -178,7 +354,7 @@ async function disables() {
178
354
  rules: {
179
355
  "antfu/no-top-level-await": "off",
180
356
  "no-console": "off",
181
- "ts/explicit-function-return-type": "off"
357
+ "@typescript-eslint/explicit-function-return-type": "off"
182
358
  }
183
359
  }
184
360
  ];
@@ -186,16 +362,22 @@ async function disables() {
186
362
 
187
363
  // eslint-config/configs/formatters.ts
188
364
  init_esm_shims();
189
- async function formatters() {
190
- return [];
365
+ var import_eslint_config_prettier = __toESM(require_eslint_config_prettier(), 1);
366
+ function formatters() {
367
+ return [
368
+ {
369
+ name: "solvro/prettier",
370
+ ...import_eslint_config_prettier.default
371
+ }
372
+ ];
191
373
  }
192
374
 
193
375
  // eslint-config/configs/ignores.ts
194
376
  init_esm_shims();
195
- async function ignores(userIgnores = []) {
377
+ function ignores() {
196
378
  return [
197
379
  {
198
- ignores: [...GLOB_EXCLUDE, ...userIgnores],
380
+ ignores: [...GLOB_EXCLUDE],
199
381
  name: "solvro/ignores"
200
382
  }
201
383
  ];
@@ -203,24 +385,25 @@ async function ignores(userIgnores = []) {
203
385
 
204
386
  // eslint-config/configs/imports.ts
205
387
  init_esm_shims();
206
- async function imports() {
388
+ function imports() {
207
389
  return [
208
390
  {
209
391
  name: "solvro/imports/rules",
210
392
  plugins: {
211
393
  antfu: default3,
212
- import: pluginImport
394
+ // @ts-expect-error ???
395
+ "import-x": pluginImport
213
396
  },
214
397
  rules: {
215
398
  "antfu/import-dedupe": "error",
216
399
  "antfu/no-import-dist": "error",
217
400
  "antfu/no-import-node-modules-by-path": "error",
218
- "import/first": "error",
219
- "import/no-duplicates": "error",
220
- "import/no-mutable-exports": "error",
221
- "import/no-named-default": "error",
222
- "import/no-self-import": "error",
223
- "import/no-webpack-loader-syntax": "error"
401
+ "import-x/first": "error",
402
+ "import-x/no-duplicates": "error",
403
+ "import-x/no-mutable-exports": "error",
404
+ "import-x/no-named-default": "error",
405
+ "import-x/no-self-import": "error",
406
+ "import-x/no-webpack-loader-syntax": "error"
224
407
  }
225
408
  }
226
409
  ];
@@ -228,9 +411,9 @@ async function imports() {
228
411
 
229
412
  // eslint-config/configs/javascript.ts
230
413
  init_esm_shims();
414
+ import eslint from "@eslint/js";
231
415
  import globals from "globals";
232
- async function javascript(options = {}) {
233
- const { isInEditor = false, overrides = {} } = options;
416
+ function javascript() {
234
417
  return [
235
418
  {
236
419
  languageOptions: {
@@ -264,6 +447,7 @@ async function javascript(options = {}) {
264
447
  "unused-imports": default7
265
448
  },
266
449
  rules: {
450
+ ...eslint.configs.recommended.rules,
267
451
  "accessor-pairs": [
268
452
  "error",
269
453
  { enforceForClassMembers: true, setWithoutGet: true }
@@ -439,7 +623,7 @@ async function javascript(options = {}) {
439
623
  "prefer-template": "error",
440
624
  "symbol-description": "error",
441
625
  "unicode-bom": ["error", "never"],
442
- "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
626
+ "unused-imports/no-unused-imports": "error",
443
627
  "unused-imports/no-unused-vars": [
444
628
  "error",
445
629
  {
@@ -456,8 +640,7 @@ async function javascript(options = {}) {
456
640
  ],
457
641
  "valid-typeof": ["error", { requireStringLiterals: true }],
458
642
  "vars-on-top": "error",
459
- yoda: ["error", "never"],
460
- ...overrides
643
+ yoda: ["error", "never"]
461
644
  }
462
645
  }
463
646
  ];
@@ -465,106 +648,13 @@ async function javascript(options = {}) {
465
648
 
466
649
  // eslint-config/configs/jsdoc.ts
467
650
  init_esm_shims();
468
-
469
- // eslint-config/utils.ts
470
- init_esm_shims();
471
- import { isPackageExists } from "local-pkg";
472
- import process from "node:process";
473
- import { fileURLToPath } from "node:url";
474
- var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
475
- var isCwdInScope = isPackageExists("@solvro/config");
476
- var parserPlain = {
477
- meta: {
478
- name: "parser-plain"
479
- },
480
- parseForESLint: (code) => ({
481
- ast: {
482
- body: [],
483
- comments: [],
484
- loc: { end: code.length, start: 0 },
485
- range: [0, code.length],
486
- tokens: [],
487
- type: "Program"
488
- },
489
- scopeManager: null,
490
- services: { isPlain: true },
491
- visitorKeys: {
492
- Program: []
493
- }
494
- })
495
- };
496
- async function combine(...configs2) {
497
- const resolved = await Promise.all(configs2);
498
- return resolved.flat();
499
- }
500
- function renameRules(rules, map) {
501
- return Object.fromEntries(
502
- Object.entries(rules).map(([key, value]) => {
503
- for (const [from, to] of Object.entries(map)) {
504
- if (key.startsWith(`${from}/`))
505
- return [to + key.slice(from.length), value];
506
- }
507
- return [key, value];
508
- })
509
- );
510
- }
511
- function renamePluginInConfigs(configs2, map) {
512
- return configs2.map((i) => {
513
- const clone = { ...i };
514
- if (clone.rules) clone.rules = renameRules(clone.rules, map);
515
- if (clone.plugins) {
516
- clone.plugins = Object.fromEntries(
517
- Object.entries(clone.plugins).map(([key, value]) => {
518
- if (key in map) return [map[key], value];
519
- return [key, value];
520
- })
521
- );
522
- }
523
- return clone;
524
- });
525
- }
526
- function toArray(value) {
527
- return Array.isArray(value) ? value : [value];
528
- }
529
- async function interopDefault(m) {
530
- const resolved = await m;
531
- return resolved.default || resolved;
532
- }
533
- function isPackageInScope(name) {
534
- return isPackageExists(name, { paths: [scopeUrl] });
535
- }
536
- async function ensurePackages(packages) {
537
- if (process.env.CI || process.stdout.isTTY === false || isCwdInScope === false)
538
- return;
539
- const nonExistingPackages = packages.filter(
540
- (i) => i && !isPackageInScope(i)
541
- );
542
- if (nonExistingPackages.length === 0) return;
543
- const p = await import("@clack/prompts");
544
- const result = await p.confirm({
545
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
546
- });
547
- if (result)
548
- await import("@antfu/install-pkg").then(
549
- (i) => i.installPackage(nonExistingPackages, { dev: true })
550
- );
551
- }
552
- function isInEditorEnv() {
553
- if (process.env.CI) return false;
554
- if (isInGitHooksOrLintStaged()) return false;
555
- return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
556
- }
557
- function isInGitHooksOrLintStaged() {
558
- return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
559
- }
560
-
561
- // eslint-config/configs/jsdoc.ts
562
- async function jsdoc() {
651
+ import jsdocPlugin from "eslint-plugin-jsdoc";
652
+ function jsdoc() {
563
653
  return [
564
654
  {
565
655
  name: "solvro/jsdoc/rules",
566
656
  plugins: {
567
- jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
657
+ jsdoc: jsdocPlugin
568
658
  },
569
659
  rules: {
570
660
  "jsdoc/check-access": "warn",
@@ -587,108 +677,9 @@ async function jsdoc() {
587
677
  ];
588
678
  }
589
679
 
590
- // eslint-config/configs/jsx.ts
591
- init_esm_shims();
592
- async function jsx() {
593
- return [
594
- {
595
- files: [GLOB_JSX, GLOB_TSX],
596
- languageOptions: {
597
- parserOptions: {
598
- ecmaFeatures: {
599
- jsx: true
600
- }
601
- }
602
- },
603
- name: "solvro/jsx/setup"
604
- }
605
- ];
606
- }
607
-
608
- // eslint-config/configs/markdown.ts
609
- init_esm_shims();
610
- import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
611
- async function markdown(options = {}) {
612
- const {
613
- componentExts = [],
614
- files = [GLOB_MARKDOWN],
615
- overrides = {}
616
- } = options;
617
- const markdown2 = await interopDefault(import("@eslint/markdown"));
618
- return [
619
- {
620
- name: "solvro/markdown/setup",
621
- plugins: {
622
- markdown: markdown2
623
- }
624
- },
625
- {
626
- files,
627
- ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
628
- name: "solvro/markdown/processor",
629
- // `eslint-plugin-markdown` only creates virtual files for code blocks,
630
- // but not the markdown file itself. We use `eslint-merge-processors` to
631
- // add a pass-through processor for the markdown file itself.
632
- processor: mergeProcessors([
633
- markdown2.processors.markdown,
634
- processorPassThrough
635
- ])
636
- },
637
- {
638
- files,
639
- languageOptions: {
640
- parser: parserPlain
641
- },
642
- name: "solvro/markdown/parser"
643
- },
644
- {
645
- files: [
646
- GLOB_MARKDOWN_CODE,
647
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
648
- ],
649
- languageOptions: {
650
- parserOptions: {
651
- ecmaFeatures: {
652
- impliedStrict: true
653
- }
654
- }
655
- },
656
- name: "solvro/markdown/disables",
657
- rules: {
658
- "antfu/no-top-level-await": "off",
659
- "import/newline-after-import": "off",
660
- "no-alert": "off",
661
- "no-console": "off",
662
- "no-labels": "off",
663
- "no-lone-blocks": "off",
664
- "no-restricted-syntax": "off",
665
- "no-undef": "off",
666
- "no-unused-expressions": "off",
667
- "no-unused-labels": "off",
668
- "no-unused-vars": "off",
669
- "node/prefer-global/process": "off",
670
- "style/comma-dangle": "off",
671
- "style/eol-last": "off",
672
- "ts/consistent-type-imports": "off",
673
- "ts/explicit-function-return-type": "off",
674
- "ts/no-namespace": "off",
675
- "ts/no-redeclare": "off",
676
- "ts/no-require-imports": "off",
677
- "ts/no-unused-expressions": "off",
678
- "ts/no-unused-vars": "off",
679
- "ts/no-use-before-define": "off",
680
- "unicode-bom": "off",
681
- "unused-imports/no-unused-imports": "off",
682
- "unused-imports/no-unused-vars": "off",
683
- ...overrides
684
- }
685
- }
686
- ];
687
- }
688
-
689
680
  // eslint-config/configs/node.ts
690
681
  init_esm_shims();
691
- async function node() {
682
+ function node() {
692
683
  return [
693
684
  {
694
685
  name: "solvro/node/rules",
@@ -711,52 +702,41 @@ async function node() {
711
702
 
712
703
  // eslint-config/configs/react.ts
713
704
  init_esm_shims();
714
- import { isPackageExists as isPackageExists2 } from "local-pkg";
715
- var ReactRefreshAllowConstantExportPackages = ["vite"];
705
+ import nextPlugin from "@next/eslint-plugin-next";
706
+ import pluginReact from "eslint-plugin-react";
707
+ import pluginReactHooks from "eslint-plugin-react-hooks";
708
+ import pluginReactRefresh from "eslint-plugin-react-refresh";
709
+ import { isPackageExists } from "local-pkg";
716
710
  var NextJsPackages = ["next"];
717
- async function react(options = {}) {
718
- const {
719
- files = [GLOB_SRC],
720
- filesTypeAware = [GLOB_TS, GLOB_TSX],
721
- ignoresTypeAware = [`${GLOB_MARKDOWN}/**`],
722
- overrides = {},
723
- tsconfigPath
724
- } = options;
725
- await ensurePackages([
726
- "@eslint-react/eslint-plugin",
727
- "eslint-plugin-react-hooks",
728
- "eslint-plugin-react-refresh"
729
- ]);
730
- const isTypeAware = !!tsconfigPath;
731
- const typeAwareRules = {
732
- "react/no-leaked-conditional-rendering": "warn"
733
- };
734
- const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
735
- [
736
- interopDefault(import("@eslint-react/eslint-plugin")),
737
- interopDefault(import("eslint-plugin-react-hooks")),
738
- interopDefault(import("eslint-plugin-react-refresh"))
739
- ]
740
- );
741
- const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
742
- (i) => isPackageExists2(i)
743
- );
744
- const isUsingNext = NextJsPackages.some((i) => isPackageExists2(i));
745
- const plugins = pluginReact.configs.all.plugins;
711
+ function react() {
712
+ const isUsingNext = NextJsPackages.some((index) => isPackageExists(index));
713
+ const nextjsConfig = [];
714
+ if (isUsingNext) {
715
+ nextjsConfig.push({
716
+ name: "solvro/next/setup",
717
+ plugins: {
718
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
719
+ "@next/next": nextPlugin
720
+ },
721
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
722
+ rules: nextPlugin.configs.recommended.rules
723
+ });
724
+ }
746
725
  return [
747
726
  {
748
727
  name: "solvro/react/setup",
749
728
  plugins: {
750
- react: plugins["@eslint-react"],
751
- "react-dom": plugins["@eslint-react/dom"],
729
+ // @ts-expect-error ???
730
+ react: pluginReact,
731
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
752
732
  "react-hooks": pluginReactHooks,
753
- "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
754
- "react-naming-convention": plugins["@eslint-react/naming-convention"],
733
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
755
734
  "react-refresh": pluginReactRefresh
756
735
  }
757
736
  },
737
+ ...nextjsConfig,
758
738
  {
759
- files,
739
+ files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
760
740
  languageOptions: {
761
741
  parserOptions: {
762
742
  ecmaFeatures: {
@@ -765,28 +745,25 @@ async function react(options = {}) {
765
745
  },
766
746
  sourceType: "module"
767
747
  },
748
+ settings: {
749
+ react: {
750
+ version: "detect"
751
+ }
752
+ },
768
753
  name: "solvro/react/rules",
769
754
  rules: {
770
- // recommended rules from @eslint-react/dom
771
- "react-dom/no-children-in-void-dom-elements": "warn",
772
- "react-dom/no-dangerously-set-innerhtml": "warn",
773
- "react-dom/no-dangerously-set-innerhtml-with-children": "error",
774
- "react-dom/no-find-dom-node": "error",
775
- "react-dom/no-missing-button-type": "warn",
776
- "react-dom/no-missing-iframe-sandbox": "warn",
777
- "react-dom/no-namespace": "error",
778
- "react-dom/no-render-return-value": "error",
779
- "react-dom/no-script-url": "warn",
780
- "react-dom/no-unsafe-iframe-sandbox": "warn",
781
- "react-dom/no-unsafe-target-blank": "warn",
755
+ ...pluginReact.configs.flat?.recommended.rules,
756
+ ...pluginReact.configs.flat?.["jsx-runtime"].rules,
757
+ "react/jsx-no-leaked-render": "warn",
782
758
  // recommended rules react-hooks
783
759
  "react-hooks/exhaustive-deps": "warn",
784
760
  "react-hooks/rules-of-hooks": "error",
761
+ "react/jsx-no-useless-fragment": "error",
785
762
  // react refresh
786
763
  "react-refresh/only-export-components": [
787
764
  "warn",
788
765
  {
789
- allowConstantExport: isAllowConstantExport,
766
+ allowConstantExport: false,
790
767
  allowExportNames: [
791
768
  ...isUsingNext ? [
792
769
  "dynamic",
@@ -805,132 +782,7 @@ async function react(options = {}) {
805
782
  ] : []
806
783
  ]
807
784
  }
808
- ],
809
- // recommended rules from @eslint-react
810
- "react/ensure-forward-ref-using-ref": "warn",
811
- "react/no-access-state-in-setstate": "error",
812
- "react/no-array-index-key": "warn",
813
- "react/no-children-count": "warn",
814
- "react/no-children-for-each": "warn",
815
- "react/no-children-map": "warn",
816
- "react/no-children-only": "warn",
817
- "react/no-children-prop": "warn",
818
- "react/no-children-to-array": "warn",
819
- "react/no-clone-element": "warn",
820
- "react/no-comment-textnodes": "warn",
821
- "react/no-component-will-mount": "error",
822
- "react/no-component-will-receive-props": "error",
823
- "react/no-component-will-update": "error",
824
- "react/no-create-ref": "error",
825
- "react/no-direct-mutation-state": "error",
826
- "react/no-duplicate-key": "error",
827
- "react/no-implicit-key": "error",
828
- "react/no-missing-key": "error",
829
- "react/no-nested-components": "warn",
830
- "react/no-redundant-should-component-update": "error",
831
- "react/no-set-state-in-component-did-mount": "warn",
832
- "react/no-set-state-in-component-did-update": "warn",
833
- "react/no-set-state-in-component-will-update": "warn",
834
- "react/no-string-refs": "error",
835
- "react/no-unsafe-component-will-mount": "warn",
836
- "react/no-unsafe-component-will-receive-props": "warn",
837
- "react/no-unsafe-component-will-update": "warn",
838
- "react/no-unstable-context-value": "error",
839
- "react/no-unstable-default-props": "error",
840
- "react/no-unused-class-component-members": "warn",
841
- "react/no-unused-state": "warn",
842
- "react/no-useless-fragment": "warn",
843
- "react/prefer-destructuring-assignment": "warn",
844
- "react/prefer-shorthand-boolean": "warn",
845
- "react/prefer-shorthand-fragment": "warn",
846
- // overrides
847
- ...overrides
848
- }
849
- },
850
- ...isTypeAware ? [
851
- {
852
- files: filesTypeAware,
853
- ignores: ignoresTypeAware,
854
- name: "antfu/react/type-aware-rules",
855
- rules: {
856
- ...typeAwareRules
857
- }
858
- }
859
- ] : []
860
- ];
861
- }
862
-
863
- // eslint-config/configs/regexp.ts
864
- init_esm_shims();
865
- import { configs } from "eslint-plugin-regexp";
866
- async function regexp(options = {}) {
867
- const config = configs["flat/recommended"];
868
- const rules = {
869
- ...config.rules
870
- };
871
- if (options.level === "warn") {
872
- for (const key in rules) {
873
- if (rules[key] === "error") rules[key] = "warn";
874
- }
875
- }
876
- return [
877
- {
878
- ...config,
879
- name: "solvro/regexp/rules",
880
- rules: {
881
- ...rules,
882
- ...options.overrides
883
- }
884
- }
885
- ];
886
- }
887
-
888
- // eslint-config/configs/test.ts
889
- init_esm_shims();
890
- var _pluginTest;
891
- async function test(options = {}) {
892
- const { files = GLOB_TESTS, isInEditor = false, overrides = {} } = options;
893
- const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
894
- interopDefault(import("@vitest/eslint-plugin")),
895
- // @ts-expect-error missing types
896
- interopDefault(import("eslint-plugin-no-only-tests"))
897
- ]);
898
- _pluginTest = _pluginTest || {
899
- ...pluginVitest,
900
- rules: {
901
- ...pluginVitest.rules,
902
- // extend `test/no-only-tests` rule
903
- ...pluginNoOnlyTests.rules
904
- }
905
- };
906
- return [
907
- {
908
- name: "solvro/test/setup",
909
- plugins: {
910
- test: _pluginTest
911
- }
912
- },
913
- {
914
- files,
915
- name: "solvro/test/rules",
916
- rules: {
917
- "test/consistent-test-it": [
918
- "error",
919
- { fn: "it", withinDescribe: "it" }
920
- ],
921
- "test/no-identical-title": "error",
922
- "test/no-import-node-test": "error",
923
- "test/no-only-tests": isInEditor ? "off" : "error",
924
- "test/prefer-hooks-in-order": "error",
925
- "test/prefer-lowercase-title": "error",
926
- // Disables
927
- ...{
928
- "antfu/no-top-level-await": "off",
929
- "no-unused-expressions": "off",
930
- "node/prefer-global/process": "off",
931
- "ts/explicit-function-return-type": "off"
932
- },
933
- ...overrides
785
+ ]
934
786
  }
935
787
  }
936
788
  ];
@@ -938,130 +790,53 @@ async function test(options = {}) {
938
790
 
939
791
  // eslint-config/configs/typescript.ts
940
792
  init_esm_shims();
941
- import process2 from "node:process";
942
- async function typescript(options = {}) {
943
- const {
944
- componentExts = [],
945
- overrides = {},
946
- overridesTypeAware = {},
947
- parserOptions = {},
948
- type = "app"
949
- } = options;
950
- const files = options.files ?? [
951
- GLOB_TS,
952
- GLOB_TSX,
953
- ...componentExts.map((ext) => `**/*.${ext}`)
954
- ];
955
- const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
956
- const ignoresTypeAware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`];
957
- const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
958
- const isTypeAware = !!tsconfigPath;
959
- const typeAwareRules = {
960
- "dot-notation": "off",
961
- "no-implied-eval": "off",
962
- "ts/await-thenable": "error",
963
- "ts/dot-notation": ["error", { allowKeywords: true }],
964
- "ts/no-floating-promises": "error",
965
- "ts/no-for-in-array": "error",
966
- "ts/no-implied-eval": "error",
967
- "ts/no-misused-promises": "error",
968
- "ts/no-unnecessary-type-assertion": "error",
969
- "ts/no-unsafe-argument": "error",
970
- "ts/no-unsafe-assignment": "error",
971
- "ts/no-unsafe-call": "error",
972
- "ts/no-unsafe-member-access": "error",
973
- "ts/no-unsafe-return": "error",
974
- "ts/promise-function-async": "error",
975
- "ts/restrict-plus-operands": "error",
976
- "ts/restrict-template-expressions": "error",
977
- "ts/return-await": ["error", "in-try-catch"],
978
- "ts/strict-boolean-expressions": [
979
- "error",
980
- { allowNullableBoolean: true, allowNullableObject: true }
981
- ],
982
- "ts/switch-exhaustiveness-check": "error",
983
- "ts/unbound-method": "error"
984
- };
985
- const [pluginTs, parserTs] = await Promise.all([
986
- interopDefault(import("@typescript-eslint/eslint-plugin")),
987
- interopDefault(import("@typescript-eslint/parser"))
988
- ]);
989
- function makeParser(typeAware, files2, ignores2) {
990
- return {
991
- files: files2,
992
- ...ignores2 ? { ignores: ignores2 } : {},
993
- languageOptions: {
994
- parser: parserTs,
995
- parserOptions: {
996
- extraFileExtensions: componentExts.map((ext) => `.${ext}`),
997
- sourceType: "module",
998
- ...typeAware ? {
999
- projectService: {
1000
- allowDefaultProject: ["./*.js"],
1001
- defaultProject: tsconfigPath
1002
- },
1003
- tsconfigRootDir: process2.cwd()
1004
- } : {},
1005
- ...parserOptions
1006
- }
1007
- },
1008
- name: `solvro/typescript/${typeAware ? "type-aware-parser" : "parser"}`
1009
- };
1010
- }
793
+ import tseslint from "typescript-eslint";
794
+ function typescript() {
1011
795
  return [
796
+ // @ts-expect-error ???
797
+ tseslint.configs.strictTypeChecked,
798
+ // @ts-expect-error ???
799
+ tseslint.configs.stylisticTypeChecked,
1012
800
  {
1013
- // Install the plugins without globs, so they can be configured separately.
1014
801
  name: "solvro/typescript/setup",
1015
802
  plugins: {
1016
- antfu: default3,
1017
- ts: pluginTs
803
+ antfu: default3
1018
804
  }
1019
805
  },
1020
- // assign type-aware parser for type-aware files and type-unaware parser for the rest
1021
- ...isTypeAware ? [
1022
- makeParser(false, files),
1023
- makeParser(true, filesTypeAware, ignoresTypeAware)
1024
- ] : [makeParser(false, files)],
1025
806
  {
1026
- files,
1027
807
  name: "solvro/typescript/rules",
1028
808
  rules: {
1029
- ...renameRules(
1030
- pluginTs.configs["eslint-recommended"].overrides[0].rules,
1031
- { "@typescript-eslint": "ts" }
1032
- ),
1033
- ...renameRules(pluginTs.configs.strict.rules, {
1034
- "@typescript-eslint": "ts"
1035
- }),
1036
- "no-dupe-class-members": "off",
1037
- "no-redeclare": "off",
1038
- "no-use-before-define": "off",
1039
- "no-useless-constructor": "off",
1040
- "ts/ban-ts-comment": [
809
+ "@typescript-eslint/ban-ts-comment": [
1041
810
  "error",
1042
811
  { "ts-expect-error": "allow-with-description" }
1043
812
  ],
1044
- "ts/consistent-type-definitions": ["error", "interface"],
1045
- "ts/consistent-type-imports": [
813
+ "@typescript-eslint/consistent-type-definitions": [
814
+ "error",
815
+ "interface"
816
+ ],
817
+ "@typescript-eslint/consistent-type-imports": [
1046
818
  "error",
1047
819
  {
1048
820
  disallowTypeAnnotations: false,
1049
821
  prefer: "type-imports"
1050
822
  }
1051
823
  ],
1052
- "ts/method-signature-style": ["error", "property"],
824
+ "@typescript-eslint/method-signature-style": ["error", "property"],
1053
825
  // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
1054
- "ts/no-dupe-class-members": "error",
1055
- "ts/no-dynamic-delete": "off",
1056
- "ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
1057
- "ts/no-explicit-any": "off",
1058
- "ts/no-extraneous-class": "off",
1059
- "ts/no-import-type-side-effects": "error",
1060
- "ts/no-invalid-void-type": "off",
1061
- "ts/no-non-null-assertion": "off",
1062
- "ts/no-redeclare": ["error", { builtinGlobals: false }],
1063
- "ts/no-require-imports": "error",
1064
- "ts/no-unused-expressions": [
826
+ "@typescript-eslint/no-dupe-class-members": "error",
827
+ "@typescript-eslint/no-dynamic-delete": "off",
828
+ "@typescript-eslint/no-empty-object-type": [
829
+ "error",
830
+ { allowInterfaces: "always" }
831
+ ],
832
+ "@typescript-eslint/no-explicit-any": "off",
833
+ "@typescript-eslint/no-extraneous-class": "off",
834
+ "@typescript-eslint/no-import-type-side-effects": "error",
835
+ "@typescript-eslint/no-invalid-void-type": "off",
836
+ "@typescript-eslint/no-non-null-assertion": "off",
837
+ "@typescript-eslint/no-redeclare": ["error", { builtinGlobals: false }],
838
+ "@typescript-eslint/no-require-imports": "error",
839
+ "@typescript-eslint/no-unused-expressions": [
1065
840
  "error",
1066
841
  {
1067
842
  allowShortCircuit: true,
@@ -1069,280 +844,129 @@ async function typescript(options = {}) {
1069
844
  allowTernary: true
1070
845
  }
1071
846
  ],
1072
- "ts/no-unused-vars": "off",
1073
- "ts/no-use-before-define": [
847
+ "@typescript-eslint/no-unused-vars": "off",
848
+ "@typescript-eslint/no-use-before-define": [
1074
849
  "error",
1075
850
  { classes: false, functions: false, variables: true }
1076
851
  ],
1077
- "ts/no-useless-constructor": "off",
1078
- "ts/no-wrapper-object-types": "error",
1079
- "ts/triple-slash-reference": "off",
1080
- "ts/unified-signatures": "off",
1081
- ...type === "lib" ? {
1082
- "ts/explicit-function-return-type": [
1083
- "error",
1084
- {
1085
- allowExpressions: true,
1086
- allowHigherOrderFunctions: true,
1087
- allowIIFEs: true
1088
- }
1089
- ]
1090
- } : {},
1091
- ...overrides
1092
- }
1093
- },
1094
- ...isTypeAware ? [
1095
- {
1096
- files: filesTypeAware,
1097
- ignores: ignoresTypeAware,
1098
- name: "solvro/typescript/rules-type-aware",
1099
- rules: {
1100
- ...typeAwareRules,
1101
- ...overridesTypeAware
1102
- }
852
+ "@typescript-eslint/no-useless-constructor": "off",
853
+ "@typescript-eslint/no-wrapper-object-types": "error",
854
+ "@typescript-eslint/triple-slash-reference": "off",
855
+ "@typescript-eslint/unified-signatures": "off",
856
+ // prevent unnecessary use of void operator
857
+ "@typescript-eslint/no-meaningless-void-operator": "error",
858
+ // "using non-null assertions cancels the benefits of the strict
859
+ // null-checking mode."
860
+ // warn when one of the types in union / intersection overrides others
861
+ "@typescript-eslint/no-redundant-type-constituents": "warn",
862
+ // prevent variables shadowing
863
+ "no-shadow": "error",
864
+ "@typescript-eslint/no-shadow": "error",
865
+ // prevent assignment of this, signals a wrong usage of it
866
+ "@typescript-eslint/no-this-alias": "error",
867
+ // prevent throwing non-error
868
+ "no-throw-literal": "off",
869
+ // prevent unnecessary explicitly adding a default type argument
870
+ "@typescript-eslint/no-unnecessary-type-arguments": "error",
871
+ // prevent unnecessary assertions that won't change the outcome
872
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
873
+ // prevent extending default types
874
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
875
+ // force typing out function arguments
876
+ "@typescript-eslint/no-unsafe-argument": "error",
877
+ // prevent usage of any via reassigning
878
+ "@typescript-eslint/no-unsafe-assignment": "error",
879
+ // prevent usage of any via calling it
880
+ "@typescript-eslint/no-unsafe-call": "error",
881
+ // prevent usage of any via using it's members
882
+ "@typescript-eslint/no-unsafe-member-access": "error",
883
+ // prevent reverting any from functions
884
+ "@typescript-eslint/no-unsafe-return": "error",
885
+ // prevent unused expressions
886
+ "no-unused-expressions": "off",
887
+ // var<'string'> = 'string' -> var = 'string' as const
888
+ "@typescript-eslint/prefer-as-const": "error",
889
+ // force initializing enums
890
+ "@typescript-eslint/prefer-enum-initializers": "error",
891
+ // prefer for x of obj to for let i = 0...
892
+ "@typescript-eslint/prefer-for-of": "error",
893
+ // prefer includes() to indexOf()
894
+ "@typescript-eslint/prefer-includes": "error",
895
+ // use literals for enum initialization
896
+ "@typescript-eslint/prefer-literal-enum-member": "error",
897
+ // prefer safe cascade of a value when dealing with undefined or null
898
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
899
+ // prefer optional chaining (a?.b)
900
+ "@typescript-eslint/prefer-optional-chain": "error",
901
+ // prefer using type parameter for Array.reduce
902
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
903
+ // prefer RegExp#exec when no /g flag in regex
904
+ "@typescript-eslint/prefer-regexp-exec": "error",
905
+ // enforce `this` as a type when stating type for a method
906
+ "@typescript-eslint/prefer-return-this-type": "error",
907
+ // enforce startsWith to indexOf === 0
908
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
909
+ // prevents default behavior of .sort() - which is confusing
910
+ "@typescript-eslint/require-array-sort-compare": "error",
911
+ // no async functions without awaits in body
912
+ "require-await": "off",
913
+ "@typescript-eslint/require-await": "error",
914
+ // prevent number + string
915
+ "@typescript-eslint/restrict-plus-operands": "error",
916
+ // only allow string in templates
917
+ "@typescript-eslint/restrict-template-expressions": "error",
918
+ // prevent returning await
919
+ "no-return-await": "off",
920
+ "@typescript-eslint/return-await": "error",
921
+ // only booleans in ifs and whiles
922
+ "@typescript-eslint/strict-boolean-expressions": "error",
923
+ // check if all paths are followed in code
924
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
925
+ "dot-notation": "off",
926
+ "no-implied-eval": "off",
927
+ "@typescript-eslint/await-thenable": "error",
928
+ "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
929
+ "@typescript-eslint/no-floating-promises": "error",
930
+ "@typescript-eslint/no-for-in-array": "error",
931
+ "@typescript-eslint/no-implied-eval": "error",
932
+ "@typescript-eslint/no-misused-promises": "error",
933
+ "@typescript-eslint/promise-function-async": "error",
934
+ "@typescript-eslint/unbound-method": "error"
1103
935
  }
1104
- ] : []
936
+ }
1105
937
  ];
1106
938
  }
1107
939
 
1108
940
  // eslint-config/configs/unicorn.ts
1109
941
  init_esm_shims();
1110
- async function unicorn(options = {}) {
942
+ function unicorn() {
1111
943
  return [
1112
944
  {
1113
945
  name: "solvro/unicorn/rules",
1114
946
  plugins: {
1115
947
  unicorn: default6
1116
948
  },
1117
- rules: {
1118
- ...options.allRecommended ? default6.configs["flat/recommended"].rules : {
1119
- "unicorn/consistent-empty-array-spread": "error",
1120
- "unicorn/error-message": "error",
1121
- "unicorn/escape-case": "error",
1122
- "unicorn/new-for-builtins": "error",
1123
- "unicorn/no-instanceof-array": "error",
1124
- "unicorn/no-new-array": "error",
1125
- "unicorn/no-new-buffer": "error",
1126
- "unicorn/number-literal-case": "error",
1127
- "unicorn/prefer-dom-node-text-content": "error",
1128
- "unicorn/prefer-includes": "error",
1129
- "unicorn/prefer-node-protocol": "error",
1130
- "unicorn/prefer-number-properties": "error",
1131
- "unicorn/prefer-string-starts-ends-with": "error",
1132
- "unicorn/prefer-type-error": "error",
1133
- "unicorn/throw-new-error": "error"
1134
- }
1135
- }
949
+ rules: default6.configs["flat/recommended"].rules
1136
950
  }
1137
951
  ];
1138
952
  }
1139
953
 
1140
- // eslint-config/factory.ts
1141
- var flatConfigProps = [
1142
- "name",
1143
- "languageOptions",
1144
- "linterOptions",
1145
- "processor",
1146
- "plugins",
1147
- "rules",
1148
- "settings"
1149
- ];
1150
- var defaultPluginRenaming = {
1151
- "@eslint-react": "react",
1152
- "@eslint-react/dom": "react-dom",
1153
- "@eslint-react/hooks-extra": "react-hooks-extra",
1154
- "@eslint-react/naming-convention": "react-naming-convention",
1155
- "@typescript-eslint": "ts",
1156
- "import-x": "import",
1157
- n: "node",
1158
- vitest: "test",
1159
- yml: "yaml"
1160
- };
1161
- function solvro(options = {}, ...userConfigs) {
1162
- const {
1163
- autoRenamePlugins = true,
1164
- componentExts = [],
1165
- gitignore: enableGitignore = true,
1166
- jsx: enableJsx = true,
1167
- react: enableReact = false,
1168
- regexp: enableRegexp = true,
1169
- typescript: enableTypeScript = isPackageExists3("typescript"),
1170
- unicorn: enableUnicorn = true
1171
- } = options;
1172
- let isInEditor = options.isInEditor;
1173
- if (isInEditor == null) {
1174
- isInEditor = isInEditorEnv();
1175
- if (isInEditor)
1176
- console.log(
1177
- "[@solvro/config] Detected running in editor, some rules are disabled."
1178
- );
1179
- }
1180
- const configs2 = [];
1181
- if (enableGitignore) {
1182
- if (typeof enableGitignore !== "boolean") {
1183
- configs2.push(
1184
- interopDefault(import("eslint-config-flat-gitignore")).then((r) => [
1185
- r({
1186
- name: "solvro/gitignore",
1187
- ...enableGitignore
1188
- })
1189
- ])
1190
- );
1191
- } else {
1192
- configs2.push(
1193
- interopDefault(import("eslint-config-flat-gitignore")).then((r) => [
1194
- r({
1195
- name: "solvro/gitignore",
1196
- strict: false
1197
- })
1198
- ])
1199
- );
1200
- }
1201
- }
1202
- const typescriptOptions = resolveSubOptions(options, "typescript");
1203
- const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
1204
- configs2.push(
1205
- ignores(options.ignores),
1206
- javascript({
1207
- isInEditor,
1208
- overrides: getOverrides(options, "javascript")
1209
- }),
1210
- comments(),
1211
- node(),
1212
- jsdoc(),
1213
- imports(),
1214
- command()
1215
- );
1216
- if (enableUnicorn) {
1217
- configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
1218
- }
1219
- if (enableJsx) {
1220
- configs2.push(jsx());
1221
- }
1222
- if (enableTypeScript) {
1223
- configs2.push(
1224
- typescript({
1225
- ...typescriptOptions,
1226
- componentExts,
1227
- overrides: getOverrides(options, "typescript"),
1228
- type: options.type
1229
- })
1230
- );
1231
- }
1232
- if (enableRegexp) {
1233
- configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
1234
- }
1235
- if (options.test ?? true) {
1236
- configs2.push(
1237
- test({
1238
- isInEditor,
1239
- overrides: getOverrides(options, "test")
1240
- })
1241
- );
1242
- }
1243
- if (enableReact) {
1244
- configs2.push(
1245
- react({
1246
- ...typescriptOptions,
1247
- overrides: getOverrides(options, "react"),
1248
- tsconfigPath
1249
- })
1250
- );
1251
- }
1252
- if (options.markdown ?? true) {
1253
- configs2.push(
1254
- markdown({
1255
- componentExts,
1256
- overrides: getOverrides(options, "markdown")
1257
- })
1258
- );
1259
- }
1260
- if (options.formatters) {
1261
- configs2.push(formatters());
1262
- }
1263
- configs2.push(disables());
1264
- if ("files" in options) {
1265
- throw new Error(
1266
- '[@solvro/config] The first argument should not contain the "files" property as the options are supposed to be global. Place it in the second or later config instead.'
1267
- );
1268
- }
1269
- const fusedConfig = flatConfigProps.reduce((acc, key) => {
1270
- if (key in options) acc[key] = options[key];
1271
- return acc;
1272
- }, {});
1273
- if (Object.keys(fusedConfig).length) configs2.push([fusedConfig]);
1274
- let composer = new FlatConfigComposer();
1275
- composer = composer.append(...configs2, ...userConfigs);
1276
- if (autoRenamePlugins) {
1277
- composer = composer.renamePlugins(defaultPluginRenaming);
1278
- }
1279
- return composer;
1280
- }
1281
- function resolveSubOptions(options, key) {
1282
- return typeof options[key] === "boolean" ? {} : options[key] || {};
1283
- }
1284
- function getOverrides(options, key) {
1285
- const sub = resolveSubOptions(options, key);
1286
- return {
1287
- ...options.overrides?.[key],
1288
- ..."overrides" in sub ? sub.overrides : {}
1289
- };
1290
- }
1291
-
1292
- // eslint-config/types.ts
1293
- init_esm_shims();
1294
-
1295
954
  // eslint-config/index.ts
1296
- var eslint_config_default = solvro;
955
+ var solvro = (...configs) => tseslint2.config(
956
+ ...react(),
957
+ ...typescript(),
958
+ ...javascript(),
959
+ ...jsdoc(),
960
+ ...unicorn(),
961
+ ...disables(),
962
+ ...imports(),
963
+ ...comments(),
964
+ ...ignores(),
965
+ ...formatters(),
966
+ ...node(),
967
+ ...configs
968
+ );
1297
969
  export {
1298
- GLOB_ALL_SRC,
1299
- GLOB_EXCLUDE,
1300
- GLOB_HTML,
1301
- GLOB_JS,
1302
- GLOB_JSON,
1303
- GLOB_JSON5,
1304
- GLOB_JSX,
1305
- GLOB_MARKDOWN,
1306
- GLOB_MARKDOWN_CODE,
1307
- GLOB_MARKDOWN_IN_MARKDOWN,
1308
- GLOB_SRC,
1309
- GLOB_SRC_EXT,
1310
- GLOB_STYLE,
1311
- GLOB_SVG,
1312
- GLOB_TESTS,
1313
- GLOB_TOML,
1314
- GLOB_TS,
1315
- GLOB_TSX,
1316
- GLOB_XML,
1317
- combine,
1318
- command,
1319
- comments,
1320
- eslint_config_default as default,
1321
- defaultPluginRenaming,
1322
- disables,
1323
- ensurePackages,
1324
- formatters,
1325
- getOverrides,
1326
- ignores,
1327
- imports,
1328
- interopDefault,
1329
- isInEditorEnv,
1330
- isInGitHooksOrLintStaged,
1331
- isPackageInScope,
1332
- javascript,
1333
- jsdoc,
1334
- jsx,
1335
- markdown,
1336
- node,
1337
- parserPlain,
1338
- react,
1339
- regexp,
1340
- renamePluginInConfigs,
1341
- renameRules,
1342
- resolveSubOptions,
1343
- solvro,
1344
- test,
1345
- toArray,
1346
- typescript,
1347
- unicorn
970
+ solvro
1348
971
  };
972
+ //# sourceMappingURL=index.js.map