@solvro/config 1.1.0 → 1.2.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.
@@ -5,12 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function __init() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
- };
11
- var __commonJS = (cb, mod) => function __require() {
12
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
- };
14
8
  var __export = (target, all) => {
15
9
  for (var name in all)
16
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -33,308 +27,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
27
  ));
34
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
29
 
36
- // node_modules/tsup/assets/cjs_shims.js
37
- var getImportMetaUrl, importMetaUrl;
38
- var init_cjs_shims = __esm({
39
- "node_modules/tsup/assets/cjs_shims.js"() {
40
- "use strict";
41
- getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
42
- importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
43
- }
44
- });
45
-
46
- // node_modules/eslint-config-prettier/index.js
47
- var require_eslint_config_prettier = __commonJS({
48
- "node_modules/eslint-config-prettier/index.js"(exports2, module2) {
49
- "use strict";
50
- init_cjs_shims();
51
- var includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;
52
- var specialRule = 0;
53
- module2.exports = {
54
- rules: {
55
- // The following rules can be used in some cases. See the README for more
56
- // information. These are marked with `0` instead of `"off"` so that a
57
- // script can distinguish them. Note that there are a few more of these
58
- // in the deprecated section below.
59
- "curly": specialRule,
60
- "no-unexpected-multiline": specialRule,
61
- "@typescript-eslint/lines-around-comment": specialRule,
62
- "@typescript-eslint/quotes": specialRule,
63
- "babel/quotes": specialRule,
64
- "unicorn/template-indent": specialRule,
65
- "vue/html-self-closing": specialRule,
66
- "vue/max-len": specialRule,
67
- // The rest are rules that you never need to enable when using Prettier.
68
- "@babel/object-curly-spacing": "off",
69
- "@babel/semi": "off",
70
- "@typescript-eslint/block-spacing": "off",
71
- "@typescript-eslint/brace-style": "off",
72
- "@typescript-eslint/comma-dangle": "off",
73
- "@typescript-eslint/comma-spacing": "off",
74
- "@typescript-eslint/func-call-spacing": "off",
75
- "@typescript-eslint/indent": "off",
76
- "@typescript-eslint/key-spacing": "off",
77
- "@typescript-eslint/keyword-spacing": "off",
78
- "@typescript-eslint/member-delimiter-style": "off",
79
- "@typescript-eslint/no-extra-parens": "off",
80
- "@typescript-eslint/no-extra-semi": "off",
81
- "@typescript-eslint/object-curly-spacing": "off",
82
- "@typescript-eslint/semi": "off",
83
- "@typescript-eslint/space-before-blocks": "off",
84
- "@typescript-eslint/space-before-function-paren": "off",
85
- "@typescript-eslint/space-infix-ops": "off",
86
- "@typescript-eslint/type-annotation-spacing": "off",
87
- "babel/object-curly-spacing": "off",
88
- "babel/semi": "off",
89
- "flowtype/boolean-style": "off",
90
- "flowtype/delimiter-dangle": "off",
91
- "flowtype/generic-spacing": "off",
92
- "flowtype/object-type-curly-spacing": "off",
93
- "flowtype/object-type-delimiter": "off",
94
- "flowtype/quotes": "off",
95
- "flowtype/semi": "off",
96
- "flowtype/space-after-type-colon": "off",
97
- "flowtype/space-before-generic-bracket": "off",
98
- "flowtype/space-before-type-colon": "off",
99
- "flowtype/union-intersection-spacing": "off",
100
- "react/jsx-child-element-spacing": "off",
101
- "react/jsx-closing-bracket-location": "off",
102
- "react/jsx-closing-tag-location": "off",
103
- "react/jsx-curly-newline": "off",
104
- "react/jsx-curly-spacing": "off",
105
- "react/jsx-equals-spacing": "off",
106
- "react/jsx-first-prop-new-line": "off",
107
- "react/jsx-indent": "off",
108
- "react/jsx-indent-props": "off",
109
- "react/jsx-max-props-per-line": "off",
110
- "react/jsx-newline": "off",
111
- "react/jsx-one-expression-per-line": "off",
112
- "react/jsx-props-no-multi-spaces": "off",
113
- "react/jsx-tag-spacing": "off",
114
- "react/jsx-wrap-multilines": "off",
115
- "standard/array-bracket-even-spacing": "off",
116
- "standard/computed-property-even-spacing": "off",
117
- "standard/object-curly-even-spacing": "off",
118
- "unicorn/empty-brace-spaces": "off",
119
- "unicorn/no-nested-ternary": "off",
120
- "unicorn/number-literal-case": "off",
121
- "vue/array-bracket-newline": "off",
122
- "vue/array-bracket-spacing": "off",
123
- "vue/array-element-newline": "off",
124
- "vue/arrow-spacing": "off",
125
- "vue/block-spacing": "off",
126
- "vue/block-tag-newline": "off",
127
- "vue/brace-style": "off",
128
- "vue/comma-dangle": "off",
129
- "vue/comma-spacing": "off",
130
- "vue/comma-style": "off",
131
- "vue/dot-location": "off",
132
- "vue/func-call-spacing": "off",
133
- "vue/html-closing-bracket-newline": "off",
134
- "vue/html-closing-bracket-spacing": "off",
135
- "vue/html-end-tags": "off",
136
- "vue/html-indent": "off",
137
- "vue/html-quotes": "off",
138
- "vue/key-spacing": "off",
139
- "vue/keyword-spacing": "off",
140
- "vue/max-attributes-per-line": "off",
141
- "vue/multiline-html-element-content-newline": "off",
142
- "vue/multiline-ternary": "off",
143
- "vue/mustache-interpolation-spacing": "off",
144
- "vue/no-extra-parens": "off",
145
- "vue/no-multi-spaces": "off",
146
- "vue/no-spaces-around-equal-signs-in-attribute": "off",
147
- "vue/object-curly-newline": "off",
148
- "vue/object-curly-spacing": "off",
149
- "vue/object-property-newline": "off",
150
- "vue/operator-linebreak": "off",
151
- "vue/quote-props": "off",
152
- "vue/script-indent": "off",
153
- "vue/singleline-html-element-content-newline": "off",
154
- "vue/space-in-parens": "off",
155
- "vue/space-infix-ops": "off",
156
- "vue/space-unary-ops": "off",
157
- "vue/template-curly-spacing": "off",
158
- ...includeDeprecated && {
159
- // Removed in version 0.10.0.
160
- // https://eslint.org/docs/latest/rules/space-unary-word-ops
161
- "space-unary-word-ops": "off",
162
- // Removed in version 1.0.0.
163
- // https://github.com/eslint/eslint/issues/1898
164
- "generator-star": "off",
165
- "no-comma-dangle": "off",
166
- "no-reserved-keys": "off",
167
- "no-space-before-semi": "off",
168
- "no-wrap-func": "off",
169
- "space-after-function-name": "off",
170
- "space-before-function-parentheses": "off",
171
- "space-in-brackets": "off",
172
- // Removed in version 2.0.0.
173
- // https://github.com/eslint/eslint/issues/5032
174
- "no-arrow-condition": "off",
175
- "space-after-keywords": "off",
176
- "space-before-keywords": "off",
177
- "space-return-throw-case": "off",
178
- // Deprecated since version 3.3.0.
179
- // https://eslint.org/docs/rules/no-spaced-func
180
- "no-spaced-func": "off",
181
- // Deprecated since version 4.0.0.
182
- // https://github.com/eslint/eslint/pull/8286
183
- "indent-legacy": "off",
184
- // Deprecated since version 8.53.0.
185
- // https://eslint.org/blog/2023/10/deprecating-formatting-rules/
186
- "array-bracket-newline": "off",
187
- "array-bracket-spacing": "off",
188
- "array-element-newline": "off",
189
- "arrow-parens": "off",
190
- "arrow-spacing": "off",
191
- "block-spacing": "off",
192
- "brace-style": "off",
193
- "comma-dangle": "off",
194
- "comma-spacing": "off",
195
- "comma-style": "off",
196
- "computed-property-spacing": "off",
197
- "dot-location": "off",
198
- "eol-last": "off",
199
- "func-call-spacing": "off",
200
- "function-call-argument-newline": "off",
201
- "function-paren-newline": "off",
202
- "generator-star-spacing": "off",
203
- "implicit-arrow-linebreak": "off",
204
- "indent": "off",
205
- "jsx-quotes": "off",
206
- "key-spacing": "off",
207
- "keyword-spacing": "off",
208
- "linebreak-style": "off",
209
- "lines-around-comment": specialRule,
210
- "max-len": specialRule,
211
- "max-statements-per-line": "off",
212
- "multiline-ternary": "off",
213
- "new-parens": "off",
214
- "newline-per-chained-call": "off",
215
- "no-confusing-arrow": specialRule,
216
- "no-extra-parens": "off",
217
- "no-extra-semi": "off",
218
- "no-floating-decimal": "off",
219
- "no-mixed-operators": specialRule,
220
- "no-mixed-spaces-and-tabs": "off",
221
- "no-multi-spaces": "off",
222
- "no-multiple-empty-lines": "off",
223
- "no-tabs": specialRule,
224
- "no-trailing-spaces": "off",
225
- "no-whitespace-before-property": "off",
226
- "nonblock-statement-body-position": "off",
227
- "object-curly-newline": "off",
228
- "object-curly-spacing": "off",
229
- "object-property-newline": "off",
230
- "one-var-declaration-per-line": "off",
231
- "operator-linebreak": "off",
232
- "padded-blocks": "off",
233
- "quote-props": "off",
234
- "quotes": specialRule,
235
- "rest-spread-spacing": "off",
236
- "semi": "off",
237
- "semi-spacing": "off",
238
- "semi-style": "off",
239
- "space-before-blocks": "off",
240
- "space-before-function-paren": "off",
241
- "space-in-parens": "off",
242
- "space-infix-ops": "off",
243
- "space-unary-ops": "off",
244
- "switch-colon-spacing": "off",
245
- "template-curly-spacing": "off",
246
- "template-tag-spacing": "off",
247
- "wrap-iife": "off",
248
- "wrap-regex": "off",
249
- "yield-star-spacing": "off",
250
- // Deprecated since version 7.0.0.
251
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
252
- "react/jsx-space-before-closing": "off"
253
- }
254
- }
255
- };
256
- }
257
- });
258
-
259
30
  // eslint-config/index.ts
260
31
  var eslint_config_exports = {};
261
32
  __export(eslint_config_exports, {
262
- GLOB_ALL_SRC: () => GLOB_ALL_SRC,
263
- GLOB_EXCLUDE: () => GLOB_EXCLUDE,
264
- GLOB_HTML: () => GLOB_HTML,
265
- GLOB_JS: () => GLOB_JS,
266
- GLOB_JSON: () => GLOB_JSON,
267
- GLOB_JSON5: () => GLOB_JSON5,
268
- GLOB_JSX: () => GLOB_JSX,
269
- GLOB_MARKDOWN: () => GLOB_MARKDOWN,
270
- GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
271
- GLOB_MARKDOWN_IN_MARKDOWN: () => GLOB_MARKDOWN_IN_MARKDOWN,
272
- GLOB_SRC: () => GLOB_SRC,
273
- GLOB_SRC_EXT: () => GLOB_SRC_EXT,
274
- GLOB_STYLE: () => GLOB_STYLE,
275
- GLOB_SVG: () => GLOB_SVG,
276
- GLOB_TESTS: () => GLOB_TESTS,
277
- GLOB_TOML: () => GLOB_TOML,
278
- GLOB_TS: () => GLOB_TS,
279
- GLOB_TSX: () => GLOB_TSX,
280
- GLOB_XML: () => GLOB_XML,
281
- combine: () => combine,
282
- command: () => command,
283
- comments: () => comments,
284
- default: () => eslint_config_default,
285
- disables: () => disables,
286
- ensurePackages: () => ensurePackages,
287
- formatters: () => formatters,
288
- getOverrides: () => getOverrides,
289
- ignores: () => ignores,
290
- imports: () => imports,
291
- interopDefault: () => interopDefault,
292
- isInEditorEnv: () => isInEditorEnv,
293
- isInGitHooksOrLintStaged: () => isInGitHooksOrLintStaged,
294
- isPackageInScope: () => isPackageInScope,
295
- javascript: () => javascript,
296
- jsdoc: () => jsdoc,
297
- jsx: () => jsx,
298
- markdown: () => markdown,
299
- node: () => node,
300
- parserPlain: () => parserPlain,
301
- react: () => react,
302
- regexp: () => regexp,
303
- resolveSubOptions: () => resolveSubOptions,
304
- solvro: () => solvro,
305
- test: () => test,
306
- toArray: () => toArray,
307
- typescript: () => typescript,
308
- unicorn: () => unicorn
33
+ solvro: () => solvro
309
34
  });
310
35
  module.exports = __toCommonJS(eslint_config_exports);
311
- init_cjs_shims();
312
-
313
- // eslint-config/factory.ts
314
- init_cjs_shims();
315
- var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
316
- var import_local_pkg3 = require("local-pkg");
317
-
318
- // eslint-config/configs/index.ts
319
- init_cjs_shims();
320
-
321
- // eslint-config/configs/command.ts
322
- init_cjs_shims();
323
- var import_config = __toESM(require("eslint-plugin-command/config"), 1);
324
- async function command() {
325
- return [
326
- {
327
- ...(0, import_config.default)(),
328
- name: "solvro/command/rules"
329
- }
330
- ];
331
- }
332
-
333
- // eslint-config/configs/comments.ts
334
- init_cjs_shims();
36
+ var import_typescript_eslint2 = __toESM(require("typescript-eslint"), 1);
335
37
 
336
38
  // eslint-config/plugins.ts
337
- init_cjs_shims();
338
39
  var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
339
40
  var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
340
41
  var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
@@ -344,11 +45,12 @@ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
344
45
  var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
345
46
 
346
47
  // eslint-config/configs/comments.ts
347
- async function comments() {
48
+ function comments() {
348
49
  return [
349
50
  {
350
51
  name: "solvro/eslint-comments/rules",
351
52
  plugins: {
53
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
352
54
  "eslint-comments": import_eslint_plugin_eslint_comments.default
353
55
  },
354
56
  rules: {
@@ -361,26 +63,10 @@ async function comments() {
361
63
  ];
362
64
  }
363
65
 
364
- // eslint-config/configs/disables.ts
365
- init_cjs_shims();
366
-
367
66
  // eslint-config/globs.ts
368
- init_cjs_shims();
369
67
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
370
68
  var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
371
- var GLOB_JS = "**/*.?([cm])js";
372
- var GLOB_JSX = "**/*.?([cm])jsx";
373
- var GLOB_TS = "**/*.?([cm])ts";
374
- var GLOB_TSX = "**/*.?([cm])tsx";
375
- var GLOB_STYLE = "**/*.{c,le,sc}ss";
376
- var GLOB_JSON = "**/*.json";
377
- var GLOB_JSON5 = "**/*.json5";
378
69
  var GLOB_MARKDOWN = "**/*.md";
379
- var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
380
- var GLOB_TOML = "**/*.toml";
381
- var GLOB_XML = "**/*.xml";
382
- var GLOB_SVG = "**/*.svg";
383
- var GLOB_HTML = "**/*.htm?(l)";
384
70
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
385
71
  var GLOB_TESTS = [
386
72
  `**/__tests__/**/*.${GLOB_SRC_EXT}`,
@@ -389,15 +75,6 @@ var GLOB_TESTS = [
389
75
  `**/*.bench.${GLOB_SRC_EXT}`,
390
76
  `**/*.benchmark.${GLOB_SRC_EXT}`
391
77
  ];
392
- var GLOB_ALL_SRC = [
393
- GLOB_SRC,
394
- GLOB_STYLE,
395
- GLOB_JSON,
396
- GLOB_JSON5,
397
- GLOB_MARKDOWN,
398
- GLOB_XML,
399
- GLOB_HTML
400
- ];
401
78
  var GLOB_EXCLUDE = [
402
79
  "**/node_modules",
403
80
  "**/dist",
@@ -433,7 +110,7 @@ var GLOB_EXCLUDE = [
433
110
  ];
434
111
 
435
112
  // eslint-config/configs/disables.ts
436
- async function disables() {
113
+ function disables() {
437
114
  return [
438
115
  {
439
116
  files: [`**/scripts/${GLOB_SRC}`],
@@ -490,100 +167,34 @@ async function disables() {
490
167
  }
491
168
 
492
169
  // eslint-config/configs/formatters.ts
493
- init_cjs_shims();
494
-
495
- // eslint-config/utils.ts
496
- init_cjs_shims();
497
- var import_local_pkg = require("local-pkg");
498
- var import_node_process = __toESM(require("process"), 1);
499
- var import_node_url = require("url");
500
- var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
501
- var isCwdInScope = (0, import_local_pkg.isPackageExists)("@solvro/config");
502
- var parserPlain = {
503
- meta: {
504
- name: "parser-plain"
505
- },
506
- parseForESLint: (code) => ({
507
- ast: {
508
- body: [],
509
- comments: [],
510
- loc: { end: code.length, start: 0 },
511
- range: [0, code.length],
512
- tokens: [],
513
- type: "Program"
514
- },
515
- scopeManager: null,
516
- services: { isPlain: true },
517
- visitorKeys: {
518
- Program: []
170
+ var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
171
+ function formatters() {
172
+ return [
173
+ {
174
+ name: "solvro/prettier",
175
+ ...import_eslint_config_prettier.default
519
176
  }
520
- })
521
- };
522
- async function combine(...configs2) {
523
- const resolved = await Promise.all(configs2);
524
- return resolved.flat();
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 (0, import_local_pkg.isPackageExists)(name, { paths: [scopeUrl] });
535
- }
536
- async function ensurePackages(packages) {
537
- if (import_node_process.default.env.CI || import_node_process.default.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 (import_node_process.default.env.CI) return false;
554
- if (isInGitHooksOrLintStaged()) return false;
555
- return !!(import_node_process.default.env.VSCODE_PID || import_node_process.default.env.VSCODE_CWD || import_node_process.default.env.JETBRAINS_IDE || import_node_process.default.env.VIM || import_node_process.default.env.NVIM);
556
- }
557
- function isInGitHooksOrLintStaged() {
558
- return !!(import_node_process.default.env.GIT_PARAMS || import_node_process.default.env.VSCODE_GIT_COMMAND || import_node_process.default.env.npm_lifecycle_script?.startsWith("lint-staged"));
559
- }
560
-
561
- // eslint-config/configs/formatters.ts
562
- async function formatters() {
563
- await ensurePackages(["eslint-plugin-prettier"]);
564
- const prettierConfig = await interopDefault(Promise.resolve().then(() => __toESM(require_eslint_config_prettier(), 1)));
565
- return [prettierConfig];
177
+ ];
566
178
  }
567
179
 
568
180
  // eslint-config/configs/ignores.ts
569
- init_cjs_shims();
570
- async function ignores(userIgnores = []) {
181
+ function ignores() {
571
182
  return [
572
183
  {
573
- ignores: [...GLOB_EXCLUDE, ...userIgnores],
184
+ ignores: [...GLOB_EXCLUDE],
574
185
  name: "solvro/ignores"
575
186
  }
576
187
  ];
577
188
  }
578
189
 
579
190
  // eslint-config/configs/imports.ts
580
- init_cjs_shims();
581
- async function imports() {
191
+ function imports() {
582
192
  return [
583
193
  {
584
194
  name: "solvro/imports/rules",
585
195
  plugins: {
586
196
  antfu: import_eslint_plugin_antfu.default,
197
+ // @ts-expect-error ???
587
198
  "import-x": pluginImport
588
199
  },
589
200
  rules: {
@@ -602,10 +213,9 @@ async function imports() {
602
213
  }
603
214
 
604
215
  // eslint-config/configs/javascript.ts
605
- init_cjs_shims();
216
+ var import_js = __toESM(require("@eslint/js"), 1);
606
217
  var import_globals = __toESM(require("globals"), 1);
607
- async function javascript(options = {}) {
608
- const { isInEditor = false, overrides = {} } = options;
218
+ function javascript() {
609
219
  return [
610
220
  {
611
221
  languageOptions: {
@@ -639,6 +249,7 @@ async function javascript(options = {}) {
639
249
  "unused-imports": import_eslint_plugin_unused_imports.default
640
250
  },
641
251
  rules: {
252
+ ...import_js.default.configs.recommended.rules,
642
253
  "accessor-pairs": [
643
254
  "error",
644
255
  { enforceForClassMembers: true, setWithoutGet: true }
@@ -814,7 +425,7 @@ async function javascript(options = {}) {
814
425
  "prefer-template": "error",
815
426
  "symbol-description": "error",
816
427
  "unicode-bom": ["error", "never"],
817
- "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
428
+ "unused-imports/no-unused-imports": "error",
818
429
  "unused-imports/no-unused-vars": [
819
430
  "error",
820
431
  {
@@ -831,21 +442,20 @@ async function javascript(options = {}) {
831
442
  ],
832
443
  "valid-typeof": ["error", { requireStringLiterals: true }],
833
444
  "vars-on-top": "error",
834
- yoda: ["error", "never"],
835
- ...overrides
445
+ yoda: ["error", "never"]
836
446
  }
837
447
  }
838
448
  ];
839
449
  }
840
450
 
841
451
  // eslint-config/configs/jsdoc.ts
842
- init_cjs_shims();
843
- async function jsdoc() {
452
+ var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
453
+ function jsdoc() {
844
454
  return [
845
455
  {
846
456
  name: "solvro/jsdoc/rules",
847
457
  plugins: {
848
- jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
458
+ jsdoc: import_eslint_plugin_jsdoc.default
849
459
  },
850
460
  rules: {
851
461
  "jsdoc/check-access": "warn",
@@ -868,105 +478,8 @@ async function jsdoc() {
868
478
  ];
869
479
  }
870
480
 
871
- // eslint-config/configs/jsx.ts
872
- init_cjs_shims();
873
- async function jsx() {
874
- return [
875
- {
876
- files: [GLOB_JSX, GLOB_TSX],
877
- languageOptions: {
878
- parserOptions: {
879
- ecmaFeatures: {
880
- jsx: true
881
- }
882
- }
883
- },
884
- name: "solvro/jsx/setup"
885
- }
886
- ];
887
- }
888
-
889
- // eslint-config/configs/markdown.ts
890
- init_cjs_shims();
891
- var import_eslint_merge_processors = require("eslint-merge-processors");
892
- async function markdown(options = {}) {
893
- const {
894
- componentExts = [],
895
- files = [GLOB_MARKDOWN],
896
- overrides = {}
897
- } = options;
898
- const markdown2 = await interopDefault(import("@eslint/markdown"));
899
- return [
900
- {
901
- name: "solvro/markdown/setup",
902
- plugins: {
903
- markdown: markdown2
904
- }
905
- },
906
- {
907
- files,
908
- ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
909
- name: "solvro/markdown/processor",
910
- // `eslint-plugin-markdown` only creates virtual files for code blocks,
911
- // but not the markdown file itself. We use `eslint-merge-processors` to
912
- // add a pass-through processor for the markdown file itself.
913
- processor: (0, import_eslint_merge_processors.mergeProcessors)([
914
- markdown2.processors.markdown,
915
- import_eslint_merge_processors.processorPassThrough
916
- ])
917
- },
918
- {
919
- files,
920
- languageOptions: {
921
- parser: parserPlain
922
- },
923
- name: "solvro/markdown/parser"
924
- },
925
- {
926
- files: [
927
- GLOB_MARKDOWN_CODE,
928
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
929
- ],
930
- languageOptions: {
931
- parserOptions: {
932
- ecmaFeatures: {
933
- impliedStrict: true
934
- }
935
- }
936
- },
937
- name: "solvro/markdown/disables",
938
- rules: {
939
- "antfu/no-top-level-await": "off",
940
- "no-alert": "off",
941
- "no-console": "off",
942
- "no-labels": "off",
943
- "no-lone-blocks": "off",
944
- "no-restricted-syntax": "off",
945
- "no-undef": "off",
946
- "no-unused-expressions": "off",
947
- "no-unused-labels": "off",
948
- "no-unused-vars": "off",
949
- "node/prefer-global/process": "off",
950
- "@typescript-eslint/consistent-type-imports": "off",
951
- "@typescript-eslint/explicit-function-return-type": "off",
952
- "@typescript-eslint/no-namespace": "off",
953
- "@typescript-eslint/no-redeclare": "off",
954
- "@typescript-eslint/no-require-imports": "off",
955
- "@typescript-eslint/no-unused-expressions": "off",
956
- "@typescript-eslint/no-unused-vars": "off",
957
- "@typescript-eslint/no-use-before-define": "off",
958
- "unicode-bom": "off",
959
- "unused-imports/no-unused-imports": "off",
960
- "unused-imports/no-unused-vars": "off",
961
- ...overrides
962
- }
963
- }
964
- ];
965
- }
966
-
967
481
  // eslint-config/configs/node.ts
968
- init_cjs_shims();
969
- async function node() {
482
+ function node() {
970
483
  return [
971
484
  {
972
485
  name: "solvro/node/rules",
@@ -988,62 +501,41 @@ async function node() {
988
501
  }
989
502
 
990
503
  // eslint-config/configs/react.ts
991
- init_cjs_shims();
992
- var import_local_pkg2 = require("local-pkg");
993
- var ReactRefreshAllowConstantExportPackages = ["vite"];
504
+ var import_eslint_plugin_next = __toESM(require("@next/eslint-plugin-next"), 1);
505
+ var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
506
+ var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
507
+ var import_eslint_plugin_react_refresh = __toESM(require("eslint-plugin-react-refresh"), 1);
508
+ var import_local_pkg = require("local-pkg");
994
509
  var NextJsPackages = ["next"];
995
- async function react(options = {}) {
996
- const {
997
- files = [GLOB_SRC],
998
- filesTypeAware = [GLOB_TS, GLOB_TSX],
999
- ignoresTypeAware = [`${GLOB_MARKDOWN}/**`],
1000
- overrides = {},
1001
- tsconfigPath
1002
- } = options;
1003
- await ensurePackages([
1004
- "eslint-plugin-react",
1005
- "eslint-plugin-react-hooks",
1006
- "eslint-plugin-react-refresh"
1007
- ]);
1008
- const isTypeAware = !!tsconfigPath;
1009
- const typeAwareRules = {
1010
- "react/jsx-no-leaked-render": "warn"
1011
- };
1012
- const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
1013
- [
1014
- interopDefault(import("eslint-plugin-react")),
1015
- interopDefault(import("eslint-plugin-react-hooks")),
1016
- interopDefault(import("eslint-plugin-react-refresh"))
1017
- ]
1018
- );
1019
- const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
1020
- (i) => (0, import_local_pkg2.isPackageExists)(i)
1021
- );
1022
- const isUsingNext = NextJsPackages.some((i) => (0, import_local_pkg2.isPackageExists)(i));
510
+ function react() {
511
+ const isUsingNext = NextJsPackages.some((index) => (0, import_local_pkg.isPackageExists)(index));
1023
512
  const nextjsConfig = [];
1024
513
  if (isUsingNext) {
1025
- await ensurePackages(["@next/eslint-plugin-next"]);
1026
- const nextPlugin = await interopDefault(import("@next/eslint-plugin-next"));
1027
514
  nextjsConfig.push({
1028
515
  name: "solvro/next/setup",
1029
516
  plugins: {
1030
- "@next/next": nextPlugin
517
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
518
+ "@next/next": import_eslint_plugin_next.default
1031
519
  },
1032
- rules: nextPlugin.configs.recommended.rules
520
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
521
+ rules: import_eslint_plugin_next.default.configs.recommended.rules
1033
522
  });
1034
523
  }
1035
524
  return [
1036
525
  {
1037
526
  name: "solvro/react/setup",
1038
527
  plugins: {
1039
- react: pluginReact,
1040
- "react-hooks": pluginReactHooks,
1041
- "react-refresh": pluginReactRefresh
528
+ // @ts-expect-error ???
529
+ react: import_eslint_plugin_react.default,
530
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
531
+ "react-hooks": import_eslint_plugin_react_hooks.default,
532
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
533
+ "react-refresh": import_eslint_plugin_react_refresh.default
1042
534
  }
1043
535
  },
1044
536
  ...nextjsConfig,
1045
537
  {
1046
- files,
538
+ files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
1047
539
  languageOptions: {
1048
540
  parserOptions: {
1049
541
  ecmaFeatures: {
@@ -1059,18 +551,18 @@ async function react(options = {}) {
1059
551
  },
1060
552
  name: "solvro/react/rules",
1061
553
  rules: {
1062
- ...pluginReact.configs.flat?.recommended.rules,
1063
- ...pluginReact.configs.flat?.["jsx-runtime"].rules,
554
+ ...import_eslint_plugin_react.default.configs.flat?.recommended.rules,
555
+ ...import_eslint_plugin_react.default.configs.flat?.["jsx-runtime"].rules,
556
+ "react/jsx-no-leaked-render": "warn",
1064
557
  // recommended rules react-hooks
1065
558
  "react-hooks/exhaustive-deps": "warn",
1066
559
  "react-hooks/rules-of-hooks": "error",
1067
560
  "react/jsx-no-useless-fragment": "error",
1068
- "react/jsx-no-leaked-render": "warn",
1069
561
  // react refresh
1070
562
  "react-refresh/only-export-components": [
1071
563
  "warn",
1072
564
  {
1073
- allowConstantExport: isAllowConstantExport,
565
+ allowConstantExport: false,
1074
566
  allowExportNames: [
1075
567
  ...isUsingNext ? [
1076
568
  "dynamic",
@@ -1089,196 +581,29 @@ async function react(options = {}) {
1089
581
  ] : []
1090
582
  ]
1091
583
  }
1092
- ],
1093
- // overrides
1094
- ...overrides
1095
- }
1096
- },
1097
- ...isTypeAware ? [
1098
- {
1099
- files: filesTypeAware,
1100
- ignores: ignoresTypeAware,
1101
- name: "antfu/react/type-aware-rules",
1102
- rules: {
1103
- ...typeAwareRules
1104
- }
1105
- }
1106
- ] : []
1107
- ];
1108
- }
1109
-
1110
- // eslint-config/configs/regexp.ts
1111
- init_cjs_shims();
1112
- var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
1113
- async function regexp(options = {}) {
1114
- const config = import_eslint_plugin_regexp.configs["flat/recommended"];
1115
- const rules = {
1116
- ...config.rules
1117
- };
1118
- if (options.level === "warn") {
1119
- for (const key in rules) {
1120
- if (rules[key] === "error") rules[key] = "warn";
1121
- }
1122
- }
1123
- return [
1124
- {
1125
- ...config,
1126
- name: "solvro/regexp/rules",
1127
- rules: {
1128
- ...rules,
1129
- ...options.overrides
1130
- }
1131
- }
1132
- ];
1133
- }
1134
-
1135
- // eslint-config/configs/test.ts
1136
- init_cjs_shims();
1137
- var _pluginTest;
1138
- async function test(options = {}) {
1139
- const { files = GLOB_TESTS, isInEditor = false, overrides = {} } = options;
1140
- const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
1141
- interopDefault(import("@vitest/eslint-plugin")),
1142
- // @ts-expect-error missing types
1143
- interopDefault(import("eslint-plugin-no-only-tests"))
1144
- ]);
1145
- _pluginTest = _pluginTest || {
1146
- ...pluginVitest,
1147
- rules: {
1148
- ...pluginVitest.rules,
1149
- // extend `test/no-only-tests` rule
1150
- ...pluginNoOnlyTests.rules
1151
- }
1152
- };
1153
- return [
1154
- {
1155
- name: "solvro/test/setup",
1156
- plugins: {
1157
- "no-only-tests": _pluginTest
1158
- }
1159
- },
1160
- {
1161
- files,
1162
- name: "solvro/test/rules",
1163
- rules: {
1164
- "no-only-tests/consistent-test-it": [
1165
- "error",
1166
- { fn: "it", withinDescribe: "it" }
1167
- ],
1168
- "no-only-tests/no-identical-title": "error",
1169
- "no-only-tests/no-import-node-test": "error",
1170
- "no-only-tests/no-only-tests": isInEditor ? "off" : "error",
1171
- "no-only-tests/prefer-hooks-in-order": "error",
1172
- "no-only-tests/prefer-lowercase-title": "error",
1173
- // Disables
1174
- ...{
1175
- "antfu/no-top-level-await": "off",
1176
- "no-unused-expressions": "off",
1177
- "node/prefer-global/process": "off",
1178
- "@typescript-eslint/explicit-function-return-type": "off"
1179
- },
1180
- ...overrides
584
+ ]
1181
585
  }
1182
586
  }
1183
587
  ];
1184
588
  }
1185
589
 
1186
590
  // eslint-config/configs/typescript.ts
1187
- init_cjs_shims();
1188
- var import_node_process2 = __toESM(require("process"), 1);
1189
- async function typescript(options = {}) {
1190
- const {
1191
- componentExts = [],
1192
- overrides = {},
1193
- overridesTypeAware = {},
1194
- parserOptions = {},
1195
- type = "app"
1196
- } = options;
1197
- const files = options.files ?? [
1198
- GLOB_TS,
1199
- GLOB_TSX,
1200
- ...componentExts.map((ext) => `**/*.${ext}`)
1201
- ];
1202
- const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1203
- const ignoresTypeAware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`];
1204
- const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
1205
- const isTypeAware = !!tsconfigPath;
1206
- const typeAwareRules = {
1207
- "dot-notation": "off",
1208
- "no-implied-eval": "off",
1209
- "@typescript-eslint/await-thenable": "error",
1210
- "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
1211
- "@typescript-eslint/no-floating-promises": "error",
1212
- "@typescript-eslint/no-for-in-array": "error",
1213
- "@typescript-eslint/no-implied-eval": "error",
1214
- "@typescript-eslint/no-misused-promises": "error",
1215
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
1216
- "@typescript-eslint/no-unsafe-argument": "error",
1217
- "@typescript-eslint/no-unsafe-assignment": "error",
1218
- "@typescript-eslint/no-unsafe-call": "error",
1219
- "@typescript-eslint/no-unsafe-member-access": "error",
1220
- "@typescript-eslint/no-unsafe-return": "error",
1221
- "@typescript-eslint/promise-function-async": "error",
1222
- "@typescript-eslint/restrict-plus-operands": "error",
1223
- "@typescript-eslint/restrict-template-expressions": "error",
1224
- "@typescript-eslint/return-await": ["error", "in-try-catch"],
1225
- "@typescript-eslint/strict-boolean-expressions": [
1226
- "error",
1227
- { allowNullableBoolean: true, allowNullableObject: true }
1228
- ],
1229
- "@typescript-eslint/switch-exhaustiveness-check": "error",
1230
- "@typescript-eslint/unbound-method": "error"
1231
- };
1232
- const [pluginTs, parserTs] = await Promise.all([
1233
- interopDefault(import("@typescript-eslint/eslint-plugin")),
1234
- interopDefault(import("@typescript-eslint/parser"))
1235
- ]);
1236
- function makeParser(typeAware, files2, ignores2) {
1237
- return {
1238
- files: files2,
1239
- ...ignores2 ? { ignores: ignores2 } : {},
1240
- languageOptions: {
1241
- parser: parserTs,
1242
- parserOptions: {
1243
- extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1244
- sourceType: "module",
1245
- ...typeAware ? {
1246
- projectService: {
1247
- allowDefaultProject: ["./*.js"],
1248
- defaultProject: tsconfigPath
1249
- },
1250
- tsconfigRootDir: import_node_process2.default.cwd()
1251
- } : {},
1252
- ...parserOptions
1253
- }
1254
- },
1255
- name: `solvro/typescript/${typeAware ? "type-aware-parser" : "parser"}`
1256
- };
1257
- }
591
+ var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
592
+ function typescript() {
1258
593
  return [
594
+ // @ts-expect-error ???
595
+ import_typescript_eslint.default.configs.strictTypeChecked,
596
+ // @ts-expect-error ???
597
+ import_typescript_eslint.default.configs.stylisticTypeChecked,
1259
598
  {
1260
- // Install the plugins without globs, so they can be configured separately.
1261
599
  name: "solvro/typescript/setup",
1262
600
  plugins: {
1263
- antfu: import_eslint_plugin_antfu.default,
1264
- "@typescript-eslint": pluginTs
601
+ antfu: import_eslint_plugin_antfu.default
1265
602
  }
1266
603
  },
1267
- // assign type-aware parser for type-aware files and type-unaware parser for the rest
1268
- ...isTypeAware ? [
1269
- makeParser(false, files),
1270
- makeParser(true, filesTypeAware, ignoresTypeAware)
1271
- ] : [makeParser(false, files)],
1272
604
  {
1273
- files,
1274
605
  name: "solvro/typescript/rules",
1275
606
  rules: {
1276
- ...pluginTs.configs["eslint-recommended"].overrides[0].rules,
1277
- ...pluginTs.configs.strict.rules,
1278
- "no-dupe-class-members": "off",
1279
- "no-redeclare": "off",
1280
- "no-use-before-define": "off",
1281
- "no-useless-constructor": "off",
1282
607
  "@typescript-eslint/ban-ts-comment": [
1283
608
  "error",
1284
609
  { "ts-expect-error": "allow-with-description" }
@@ -1326,253 +651,120 @@ async function typescript(options = {}) {
1326
651
  "@typescript-eslint/no-wrapper-object-types": "error",
1327
652
  "@typescript-eslint/triple-slash-reference": "off",
1328
653
  "@typescript-eslint/unified-signatures": "off",
1329
- ...type === "lib" ? {
1330
- "@typescript-eslint/explicit-function-return-type": [
1331
- "error",
1332
- {
1333
- allowExpressions: true,
1334
- allowHigherOrderFunctions: true,
1335
- allowIIFEs: true
1336
- }
1337
- ]
1338
- } : {},
1339
- ...overrides
1340
- }
1341
- },
1342
- ...isTypeAware ? [
1343
- {
1344
- files: filesTypeAware,
1345
- ignores: ignoresTypeAware,
1346
- name: "solvro/typescript/rules-type-aware",
1347
- rules: {
1348
- ...typeAwareRules,
1349
- ...overridesTypeAware
1350
- }
654
+ // prevent unnecessary use of void operator
655
+ "@typescript-eslint/no-meaningless-void-operator": "error",
656
+ // "using non-null assertions cancels the benefits of the strict
657
+ // null-checking mode."
658
+ // warn when one of the types in union / intersection overrides others
659
+ "@typescript-eslint/no-redundant-type-constituents": "warn",
660
+ // prevent variables shadowing
661
+ "no-shadow": "error",
662
+ "@typescript-eslint/no-shadow": "error",
663
+ // prevent assignment of this, signals a wrong usage of it
664
+ "@typescript-eslint/no-this-alias": "error",
665
+ // prevent throwing non-error
666
+ "no-throw-literal": "off",
667
+ // prevent unnecessary explicitly adding a default type argument
668
+ "@typescript-eslint/no-unnecessary-type-arguments": "error",
669
+ // prevent unnecessary assertions that won't change the outcome
670
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
671
+ // prevent extending default types
672
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
673
+ // force typing out function arguments
674
+ "@typescript-eslint/no-unsafe-argument": "error",
675
+ // prevent usage of any via reassigning
676
+ "@typescript-eslint/no-unsafe-assignment": "error",
677
+ // prevent usage of any via calling it
678
+ "@typescript-eslint/no-unsafe-call": "error",
679
+ // prevent usage of any via using it's members
680
+ "@typescript-eslint/no-unsafe-member-access": "error",
681
+ // prevent reverting any from functions
682
+ "@typescript-eslint/no-unsafe-return": "error",
683
+ // prevent unused expressions
684
+ "no-unused-expressions": "off",
685
+ // var<'string'> = 'string' -> var = 'string' as const
686
+ "@typescript-eslint/prefer-as-const": "error",
687
+ // force initializing enums
688
+ "@typescript-eslint/prefer-enum-initializers": "error",
689
+ // prefer for x of obj to for let i = 0...
690
+ "@typescript-eslint/prefer-for-of": "error",
691
+ // prefer includes() to indexOf()
692
+ "@typescript-eslint/prefer-includes": "error",
693
+ // use literals for enum initialization
694
+ "@typescript-eslint/prefer-literal-enum-member": "error",
695
+ // prefer safe cascade of a value when dealing with undefined or null
696
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
697
+ // prefer optional chaining (a?.b)
698
+ "@typescript-eslint/prefer-optional-chain": "error",
699
+ // prefer using type parameter for Array.reduce
700
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
701
+ // prefer RegExp#exec when no /g flag in regex
702
+ "@typescript-eslint/prefer-regexp-exec": "error",
703
+ // enforce `this` as a type when stating type for a method
704
+ "@typescript-eslint/prefer-return-this-type": "error",
705
+ // enforce startsWith to indexOf === 0
706
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
707
+ // prevents default behavior of .sort() - which is confusing
708
+ "@typescript-eslint/require-array-sort-compare": "error",
709
+ // no async functions without awaits in body
710
+ "require-await": "off",
711
+ "@typescript-eslint/require-await": "error",
712
+ // prevent number + string
713
+ "@typescript-eslint/restrict-plus-operands": "error",
714
+ // only allow string in templates
715
+ "@typescript-eslint/restrict-template-expressions": "error",
716
+ // prevent returning await
717
+ "no-return-await": "off",
718
+ "@typescript-eslint/return-await": "error",
719
+ // only booleans in ifs and whiles
720
+ "@typescript-eslint/strict-boolean-expressions": "error",
721
+ // check if all paths are followed in code
722
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
723
+ "dot-notation": "off",
724
+ "no-implied-eval": "off",
725
+ "@typescript-eslint/await-thenable": "error",
726
+ "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
727
+ "@typescript-eslint/no-floating-promises": "error",
728
+ "@typescript-eslint/no-for-in-array": "error",
729
+ "@typescript-eslint/no-implied-eval": "error",
730
+ "@typescript-eslint/no-misused-promises": "error",
731
+ "@typescript-eslint/promise-function-async": "error",
732
+ "@typescript-eslint/unbound-method": "error"
1351
733
  }
1352
- ] : []
734
+ }
1353
735
  ];
1354
736
  }
1355
737
 
1356
738
  // eslint-config/configs/unicorn.ts
1357
- init_cjs_shims();
1358
- async function unicorn(options = {}) {
739
+ function unicorn() {
1359
740
  return [
1360
741
  {
1361
742
  name: "solvro/unicorn/rules",
1362
743
  plugins: {
1363
744
  unicorn: import_eslint_plugin_unicorn.default
1364
745
  },
1365
- rules: {
1366
- ...options.allRecommended ? import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules : {
1367
- "unicorn/consistent-empty-array-spread": "error",
1368
- "unicorn/error-message": "error",
1369
- "unicorn/escape-case": "error",
1370
- "unicorn/new-for-builtins": "error",
1371
- "unicorn/no-instanceof-array": "error",
1372
- "unicorn/no-new-array": "error",
1373
- "unicorn/no-new-buffer": "error",
1374
- "unicorn/number-literal-case": "error",
1375
- "unicorn/prefer-dom-node-text-content": "error",
1376
- "unicorn/prefer-includes": "error",
1377
- "unicorn/prefer-node-protocol": "error",
1378
- "unicorn/prefer-number-properties": "error",
1379
- "unicorn/prefer-string-starts-ends-with": "error",
1380
- "unicorn/prefer-type-error": "error",
1381
- "unicorn/throw-new-error": "error"
1382
- }
1383
- }
746
+ rules: import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules
1384
747
  }
1385
748
  ];
1386
749
  }
1387
750
 
1388
- // eslint-config/factory.ts
1389
- var flatConfigProps = [
1390
- "name",
1391
- "languageOptions",
1392
- "linterOptions",
1393
- "processor",
1394
- "plugins",
1395
- "rules",
1396
- "settings"
1397
- ];
1398
- function solvro(options = {}, ...userConfigs) {
1399
- const {
1400
- componentExts = [],
1401
- gitignore: enableGitignore = true,
1402
- jsx: enableJsx = true,
1403
- react: enableReact = false,
1404
- regexp: enableRegexp = true,
1405
- typescript: enableTypeScript = (0, import_local_pkg3.isPackageExists)("typescript"),
1406
- unicorn: enableUnicorn = true
1407
- } = options;
1408
- let isInEditor = options.isInEditor;
1409
- if (isInEditor == null) {
1410
- isInEditor = isInEditorEnv();
1411
- if (isInEditor)
1412
- console.log(
1413
- "[@solvro/config] Detected running in editor, some rules are disabled."
1414
- );
1415
- }
1416
- const configs2 = [];
1417
- if (enableGitignore) {
1418
- if (typeof enableGitignore !== "boolean") {
1419
- configs2.push(
1420
- interopDefault(import("eslint-config-flat-gitignore")).then((r) => [
1421
- r({
1422
- name: "solvro/gitignore",
1423
- ...enableGitignore
1424
- })
1425
- ])
1426
- );
1427
- } else {
1428
- configs2.push(
1429
- interopDefault(import("eslint-config-flat-gitignore")).then((r) => [
1430
- r({
1431
- name: "solvro/gitignore",
1432
- strict: false
1433
- })
1434
- ])
1435
- );
1436
- }
1437
- }
1438
- const typescriptOptions = resolveSubOptions(options, "typescript");
1439
- const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
1440
- configs2.push(
1441
- ignores(options.ignores),
1442
- javascript({
1443
- isInEditor,
1444
- overrides: getOverrides(options, "javascript")
1445
- }),
1446
- comments(),
1447
- node(),
1448
- jsdoc(),
1449
- imports(),
1450
- command()
1451
- );
1452
- if (enableUnicorn) {
1453
- configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
1454
- }
1455
- if (enableJsx) {
1456
- configs2.push(jsx());
1457
- }
1458
- if (enableTypeScript) {
1459
- configs2.push(
1460
- typescript({
1461
- ...typescriptOptions,
1462
- componentExts,
1463
- overrides: getOverrides(options, "typescript"),
1464
- type: options.type
1465
- })
1466
- );
1467
- }
1468
- if (enableRegexp) {
1469
- configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
1470
- }
1471
- if (options.test ?? true) {
1472
- configs2.push(
1473
- test({
1474
- isInEditor,
1475
- overrides: getOverrides(options, "test")
1476
- })
1477
- );
1478
- }
1479
- if (enableReact) {
1480
- configs2.push(
1481
- react({
1482
- ...typescriptOptions,
1483
- overrides: getOverrides(options, "react"),
1484
- tsconfigPath
1485
- })
1486
- );
1487
- }
1488
- if (options.markdown ?? true) {
1489
- configs2.push(
1490
- markdown({
1491
- componentExts,
1492
- overrides: getOverrides(options, "markdown")
1493
- })
1494
- );
1495
- }
1496
- if (options.formatters) {
1497
- configs2.push(formatters());
1498
- }
1499
- configs2.push(disables());
1500
- if ("files" in options) {
1501
- throw new Error(
1502
- '[@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.'
1503
- );
1504
- }
1505
- const fusedConfig = flatConfigProps.reduce((acc, key) => {
1506
- if (key in options) acc[key] = options[key];
1507
- return acc;
1508
- }, {});
1509
- if (Object.keys(fusedConfig).length) configs2.push([fusedConfig]);
1510
- let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
1511
- composer = composer.append(...configs2, ...userConfigs);
1512
- return composer;
1513
- }
1514
- function resolveSubOptions(options, key) {
1515
- return typeof options[key] === "boolean" ? {} : options[key] || {};
1516
- }
1517
- function getOverrides(options, key) {
1518
- const sub = resolveSubOptions(options, key);
1519
- return {
1520
- ...options.overrides?.[key],
1521
- ..."overrides" in sub ? sub.overrides : {}
1522
- };
1523
- }
1524
-
1525
- // eslint-config/types.ts
1526
- init_cjs_shims();
1527
-
1528
751
  // eslint-config/index.ts
1529
- var eslint_config_default = solvro;
752
+ var solvro = (...configs) => import_typescript_eslint2.default.config(
753
+ ...react(),
754
+ ...typescript(),
755
+ ...javascript(),
756
+ ...jsdoc(),
757
+ ...unicorn(),
758
+ ...disables(),
759
+ ...imports(),
760
+ ...comments(),
761
+ ...ignores(),
762
+ ...formatters(),
763
+ ...node(),
764
+ ...configs
765
+ );
1530
766
  // Annotate the CommonJS export names for ESM import in node:
1531
767
  0 && (module.exports = {
1532
- GLOB_ALL_SRC,
1533
- GLOB_EXCLUDE,
1534
- GLOB_HTML,
1535
- GLOB_JS,
1536
- GLOB_JSON,
1537
- GLOB_JSON5,
1538
- GLOB_JSX,
1539
- GLOB_MARKDOWN,
1540
- GLOB_MARKDOWN_CODE,
1541
- GLOB_MARKDOWN_IN_MARKDOWN,
1542
- GLOB_SRC,
1543
- GLOB_SRC_EXT,
1544
- GLOB_STYLE,
1545
- GLOB_SVG,
1546
- GLOB_TESTS,
1547
- GLOB_TOML,
1548
- GLOB_TS,
1549
- GLOB_TSX,
1550
- GLOB_XML,
1551
- combine,
1552
- command,
1553
- comments,
1554
- disables,
1555
- ensurePackages,
1556
- formatters,
1557
- getOverrides,
1558
- ignores,
1559
- imports,
1560
- interopDefault,
1561
- isInEditorEnv,
1562
- isInGitHooksOrLintStaged,
1563
- isPackageInScope,
1564
- javascript,
1565
- jsdoc,
1566
- jsx,
1567
- markdown,
1568
- node,
1569
- parserPlain,
1570
- react,
1571
- regexp,
1572
- resolveSubOptions,
1573
- solvro,
1574
- test,
1575
- toArray,
1576
- typescript,
1577
- unicorn
768
+ solvro
1578
769
  });
770
+ //# sourceMappingURL=index.cjs.map