@solvro/config 1.2.0 → 1.3.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,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,245 +27,21 @@ 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 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
-
256
30
  // eslint-config/index.ts
257
31
  var eslint_config_exports = {};
258
32
  __export(eslint_config_exports, {
259
33
  solvro: () => solvro
260
34
  });
261
35
  module.exports = __toCommonJS(eslint_config_exports);
262
- init_cjs_shims();
36
+ var import_eslint_config = require("@adonisjs/eslint-config");
37
+ var import_local_pkg2 = require("local-pkg");
263
38
  var import_typescript_eslint2 = __toESM(require("typescript-eslint"), 1);
264
39
 
265
- // eslint-config/configs/comments.ts
266
- init_cjs_shims();
267
-
268
40
  // eslint-config/plugins.ts
269
- init_cjs_shims();
270
41
  var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
271
42
  var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
272
- var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
43
+ var import_eslint_plugin_import = __toESM(require("eslint-plugin-import"), 1);
273
44
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
274
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
275
45
  var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
276
46
  var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
277
47
 
@@ -294,11 +64,7 @@ function comments() {
294
64
  ];
295
65
  }
296
66
 
297
- // eslint-config/configs/disables.ts
298
- init_cjs_shims();
299
-
300
67
  // eslint-config/globs.ts
301
- init_cjs_shims();
302
68
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
303
69
  var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
304
70
  var GLOB_MARKDOWN = "**/*.md";
@@ -402,8 +168,7 @@ function disables() {
402
168
  }
403
169
 
404
170
  // eslint-config/configs/formatters.ts
405
- init_cjs_shims();
406
- var import_eslint_config_prettier = __toESM(require_eslint_config_prettier(), 1);
171
+ var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
407
172
  function formatters() {
408
173
  return [
409
174
  {
@@ -414,7 +179,6 @@ function formatters() {
414
179
  }
415
180
 
416
181
  // eslint-config/configs/ignores.ts
417
- init_cjs_shims();
418
182
  function ignores() {
419
183
  return [
420
184
  {
@@ -425,33 +189,48 @@ function ignores() {
425
189
  }
426
190
 
427
191
  // eslint-config/configs/imports.ts
428
- init_cjs_shims();
429
192
  function imports() {
430
193
  return [
194
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
195
+ import_eslint_plugin_import.default.flatConfigs.typescript,
431
196
  {
432
197
  name: "solvro/imports/rules",
433
198
  plugins: {
434
199
  antfu: import_eslint_plugin_antfu.default,
435
- // @ts-expect-error ???
436
- "import-x": pluginImport
200
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
201
+ import: import_eslint_plugin_import.default
437
202
  },
203
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
438
204
  rules: {
439
205
  "antfu/import-dedupe": "error",
440
206
  "antfu/no-import-dist": "error",
441
207
  "antfu/no-import-node-modules-by-path": "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"
208
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
209
+ ...import_eslint_plugin_import.default.flatConfigs.recommended.rules,
210
+ "import/no-default-export": "error",
211
+ "import/no-dynamic-require": "warn",
212
+ "import/no-unresolved": "off",
213
+ "import/consistent-type-specifier-style": "warn"
214
+ }
215
+ },
216
+ {
217
+ files: [
218
+ "tsup.config.*",
219
+ "eslint.config.*",
220
+ ".commitlintrc.*",
221
+ "knip.*",
222
+ "next.config.*",
223
+ "commitlint.config.*",
224
+ ".releaserc.*"
225
+ ],
226
+ rules: {
227
+ "import/no-default-export": "off"
448
228
  }
449
229
  }
450
230
  ];
451
231
  }
452
232
 
453
233
  // eslint-config/configs/javascript.ts
454
- init_cjs_shims();
455
234
  var import_js = __toESM(require("@eslint/js"), 1);
456
235
  var import_globals = __toESM(require("globals"), 1);
457
236
  function javascript() {
@@ -688,7 +467,6 @@ function javascript() {
688
467
  }
689
468
 
690
469
  // eslint-config/configs/jsdoc.ts
691
- init_cjs_shims();
692
470
  var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
693
471
  function jsdoc() {
694
472
  return [
@@ -719,7 +497,6 @@ function jsdoc() {
719
497
  }
720
498
 
721
499
  // eslint-config/configs/node.ts
722
- init_cjs_shims();
723
500
  function node() {
724
501
  return [
725
502
  {
@@ -742,7 +519,6 @@ function node() {
742
519
  }
743
520
 
744
521
  // eslint-config/configs/react.ts
745
- init_cjs_shims();
746
522
  var import_eslint_plugin_next = __toESM(require("@next/eslint-plugin-next"), 1);
747
523
  var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
748
524
  var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
@@ -751,17 +527,29 @@ var import_local_pkg = require("local-pkg");
751
527
  var NextJsPackages = ["next"];
752
528
  function react() {
753
529
  const isUsingNext = NextJsPackages.some((index) => (0, import_local_pkg.isPackageExists)(index));
754
- const nextjsConfig = [];
530
+ const nextjsConfig2 = [];
755
531
  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
532
+ nextjsConfig2.push(
533
+ {
534
+ name: "solvro/next/setup",
535
+ plugins: {
536
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
537
+ "@next/next": import_eslint_plugin_next.default
538
+ },
539
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
540
+ rules: import_eslint_plugin_next.default.configs.recommended.rules
761
541
  },
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
- });
542
+ {
543
+ files: [
544
+ "**/app/**/{page,loading,layout}.{js,jsx,ts,tsx}",
545
+ "**/pages/**/*.{js,jsx,ts,tsx}"
546
+ ],
547
+ name: "solvro/next/pages",
548
+ rules: {
549
+ "import/no-default-export": "off"
550
+ }
551
+ }
552
+ );
765
553
  }
766
554
  return [
767
555
  {
@@ -775,7 +563,7 @@ function react() {
775
563
  "react-refresh": import_eslint_plugin_react_refresh.default
776
564
  }
777
565
  },
778
- ...nextjsConfig,
566
+ ...nextjsConfig2,
779
567
  {
780
568
  files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
781
569
  languageOptions: {
@@ -795,6 +583,7 @@ function react() {
795
583
  rules: {
796
584
  ...import_eslint_plugin_react.default.configs.flat?.recommended.rules,
797
585
  ...import_eslint_plugin_react.default.configs.flat?.["jsx-runtime"].rules,
586
+ "react/no-danger": "warn",
798
587
  "react/jsx-no-leaked-render": "warn",
799
588
  // recommended rules react-hooks
800
589
  "react-hooks/exhaustive-deps": "warn",
@@ -816,6 +605,10 @@ function react() {
816
605
  "maxDuration",
817
606
  "config",
818
607
  "generateStaticParams",
608
+ "getStaticProps",
609
+ "getServerSideProps",
610
+ "getInitialProps",
611
+ "getStaticPaths",
819
612
  "metadata",
820
613
  "generateMetadata",
821
614
  "viewport",
@@ -830,7 +623,6 @@ function react() {
830
623
  }
831
624
 
832
625
  // eslint-config/configs/typescript.ts
833
- init_cjs_shims();
834
626
  var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
835
627
  function typescript() {
836
628
  return [
@@ -845,6 +637,7 @@ function typescript() {
845
637
  }
846
638
  },
847
639
  {
640
+ files: ["**/*.{ts,tsx}"],
848
641
  name: "solvro/typescript/rules",
849
642
  rules: {
850
643
  "@typescript-eslint/ban-ts-comment": [
@@ -979,7 +772,6 @@ function typescript() {
979
772
  }
980
773
 
981
774
  // eslint-config/configs/unicorn.ts
982
- init_cjs_shims();
983
775
  function unicorn() {
984
776
  return [
985
777
  {
@@ -987,26 +779,46 @@ function unicorn() {
987
779
  plugins: {
988
780
  unicorn: import_eslint_plugin_unicorn.default
989
781
  },
990
- rules: import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules
782
+ rules: {
783
+ ...import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules,
784
+ "unicorn/no-array-reduce": "off",
785
+ "unicorn/no-null": "off"
786
+ }
991
787
  }
992
788
  ];
993
789
  }
994
790
 
995
791
  // eslint-config/index.ts
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
- );
792
+ var adonisConfig = [...(0, import_eslint_config.configApp)(), ...node()];
793
+ var nextjsConfig = [...react()];
794
+ var solvro = (...overrides) => {
795
+ const isAdonis = (0, import_local_pkg2.isPackageExists)("@adonisjs/core");
796
+ const isNext = (0, import_local_pkg2.isPackageExists)("next");
797
+ const configs = [
798
+ ...typescript(),
799
+ ...javascript(),
800
+ ...jsdoc(),
801
+ ...unicorn(),
802
+ ...disables(),
803
+ ...imports(),
804
+ ...comments(),
805
+ ...ignores(),
806
+ ...formatters(),
807
+ ...overrides
808
+ ];
809
+ if (isNext && isAdonis) {
810
+ throw new Error(
811
+ "You can't use both Adonis and Next.js in the same project"
812
+ );
813
+ }
814
+ if (isAdonis) {
815
+ configs.push(...adonisConfig);
816
+ }
817
+ if (isNext) {
818
+ configs.push(...nextjsConfig);
819
+ }
820
+ return import_typescript_eslint2.default.config(configs);
821
+ };
1010
822
  // Annotate the CommonJS export names for ESM import in node:
1011
823
  0 && (module.exports = {
1012
824
  solvro