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