@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.
@@ -1,236 +1,13 @@
1
- import {
2
- __commonJS,
3
- __toESM,
4
- init_esm_shims
5
- } from "../chunk-HPR44PFE.js";
6
-
7
- // node_modules/eslint-config-prettier/index.js
8
- var require_eslint_config_prettier = __commonJS({
9
- "node_modules/eslint-config-prettier/index.js"(exports, module) {
10
- "use strict";
11
- init_esm_shims();
12
- var includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;
13
- var specialRule = 0;
14
- module.exports = {
15
- rules: {
16
- // The following rules can be used in some cases. See the README for more
17
- // information. These are marked with `0` instead of `"off"` so that a
18
- // script can distinguish them. Note that there are a few more of these
19
- // in the deprecated section below.
20
- "curly": specialRule,
21
- "no-unexpected-multiline": specialRule,
22
- "@typescript-eslint/lines-around-comment": specialRule,
23
- "@typescript-eslint/quotes": specialRule,
24
- "babel/quotes": specialRule,
25
- "unicorn/template-indent": specialRule,
26
- "vue/html-self-closing": specialRule,
27
- "vue/max-len": specialRule,
28
- // The rest are rules that you never need to enable when using Prettier.
29
- "@babel/object-curly-spacing": "off",
30
- "@babel/semi": "off",
31
- "@typescript-eslint/block-spacing": "off",
32
- "@typescript-eslint/brace-style": "off",
33
- "@typescript-eslint/comma-dangle": "off",
34
- "@typescript-eslint/comma-spacing": "off",
35
- "@typescript-eslint/func-call-spacing": "off",
36
- "@typescript-eslint/indent": "off",
37
- "@typescript-eslint/key-spacing": "off",
38
- "@typescript-eslint/keyword-spacing": "off",
39
- "@typescript-eslint/member-delimiter-style": "off",
40
- "@typescript-eslint/no-extra-parens": "off",
41
- "@typescript-eslint/no-extra-semi": "off",
42
- "@typescript-eslint/object-curly-spacing": "off",
43
- "@typescript-eslint/semi": "off",
44
- "@typescript-eslint/space-before-blocks": "off",
45
- "@typescript-eslint/space-before-function-paren": "off",
46
- "@typescript-eslint/space-infix-ops": "off",
47
- "@typescript-eslint/type-annotation-spacing": "off",
48
- "babel/object-curly-spacing": "off",
49
- "babel/semi": "off",
50
- "flowtype/boolean-style": "off",
51
- "flowtype/delimiter-dangle": "off",
52
- "flowtype/generic-spacing": "off",
53
- "flowtype/object-type-curly-spacing": "off",
54
- "flowtype/object-type-delimiter": "off",
55
- "flowtype/quotes": "off",
56
- "flowtype/semi": "off",
57
- "flowtype/space-after-type-colon": "off",
58
- "flowtype/space-before-generic-bracket": "off",
59
- "flowtype/space-before-type-colon": "off",
60
- "flowtype/union-intersection-spacing": "off",
61
- "react/jsx-child-element-spacing": "off",
62
- "react/jsx-closing-bracket-location": "off",
63
- "react/jsx-closing-tag-location": "off",
64
- "react/jsx-curly-newline": "off",
65
- "react/jsx-curly-spacing": "off",
66
- "react/jsx-equals-spacing": "off",
67
- "react/jsx-first-prop-new-line": "off",
68
- "react/jsx-indent": "off",
69
- "react/jsx-indent-props": "off",
70
- "react/jsx-max-props-per-line": "off",
71
- "react/jsx-newline": "off",
72
- "react/jsx-one-expression-per-line": "off",
73
- "react/jsx-props-no-multi-spaces": "off",
74
- "react/jsx-tag-spacing": "off",
75
- "react/jsx-wrap-multilines": "off",
76
- "standard/array-bracket-even-spacing": "off",
77
- "standard/computed-property-even-spacing": "off",
78
- "standard/object-curly-even-spacing": "off",
79
- "unicorn/empty-brace-spaces": "off",
80
- "unicorn/no-nested-ternary": "off",
81
- "unicorn/number-literal-case": "off",
82
- "vue/array-bracket-newline": "off",
83
- "vue/array-bracket-spacing": "off",
84
- "vue/array-element-newline": "off",
85
- "vue/arrow-spacing": "off",
86
- "vue/block-spacing": "off",
87
- "vue/block-tag-newline": "off",
88
- "vue/brace-style": "off",
89
- "vue/comma-dangle": "off",
90
- "vue/comma-spacing": "off",
91
- "vue/comma-style": "off",
92
- "vue/dot-location": "off",
93
- "vue/func-call-spacing": "off",
94
- "vue/html-closing-bracket-newline": "off",
95
- "vue/html-closing-bracket-spacing": "off",
96
- "vue/html-end-tags": "off",
97
- "vue/html-indent": "off",
98
- "vue/html-quotes": "off",
99
- "vue/key-spacing": "off",
100
- "vue/keyword-spacing": "off",
101
- "vue/max-attributes-per-line": "off",
102
- "vue/multiline-html-element-content-newline": "off",
103
- "vue/multiline-ternary": "off",
104
- "vue/mustache-interpolation-spacing": "off",
105
- "vue/no-extra-parens": "off",
106
- "vue/no-multi-spaces": "off",
107
- "vue/no-spaces-around-equal-signs-in-attribute": "off",
108
- "vue/object-curly-newline": "off",
109
- "vue/object-curly-spacing": "off",
110
- "vue/object-property-newline": "off",
111
- "vue/operator-linebreak": "off",
112
- "vue/quote-props": "off",
113
- "vue/script-indent": "off",
114
- "vue/singleline-html-element-content-newline": "off",
115
- "vue/space-in-parens": "off",
116
- "vue/space-infix-ops": "off",
117
- "vue/space-unary-ops": "off",
118
- "vue/template-curly-spacing": "off",
119
- ...includeDeprecated && {
120
- // Removed in version 0.10.0.
121
- // https://eslint.org/docs/latest/rules/space-unary-word-ops
122
- "space-unary-word-ops": "off",
123
- // Removed in version 1.0.0.
124
- // https://github.com/eslint/eslint/issues/1898
125
- "generator-star": "off",
126
- "no-comma-dangle": "off",
127
- "no-reserved-keys": "off",
128
- "no-space-before-semi": "off",
129
- "no-wrap-func": "off",
130
- "space-after-function-name": "off",
131
- "space-before-function-parentheses": "off",
132
- "space-in-brackets": "off",
133
- // Removed in version 2.0.0.
134
- // https://github.com/eslint/eslint/issues/5032
135
- "no-arrow-condition": "off",
136
- "space-after-keywords": "off",
137
- "space-before-keywords": "off",
138
- "space-return-throw-case": "off",
139
- // Deprecated since version 3.3.0.
140
- // https://eslint.org/docs/rules/no-spaced-func
141
- "no-spaced-func": "off",
142
- // Deprecated since version 4.0.0.
143
- // https://github.com/eslint/eslint/pull/8286
144
- "indent-legacy": "off",
145
- // Deprecated since version 8.53.0.
146
- // https://eslint.org/blog/2023/10/deprecating-formatting-rules/
147
- "array-bracket-newline": "off",
148
- "array-bracket-spacing": "off",
149
- "array-element-newline": "off",
150
- "arrow-parens": "off",
151
- "arrow-spacing": "off",
152
- "block-spacing": "off",
153
- "brace-style": "off",
154
- "comma-dangle": "off",
155
- "comma-spacing": "off",
156
- "comma-style": "off",
157
- "computed-property-spacing": "off",
158
- "dot-location": "off",
159
- "eol-last": "off",
160
- "func-call-spacing": "off",
161
- "function-call-argument-newline": "off",
162
- "function-paren-newline": "off",
163
- "generator-star-spacing": "off",
164
- "implicit-arrow-linebreak": "off",
165
- "indent": "off",
166
- "jsx-quotes": "off",
167
- "key-spacing": "off",
168
- "keyword-spacing": "off",
169
- "linebreak-style": "off",
170
- "lines-around-comment": specialRule,
171
- "max-len": specialRule,
172
- "max-statements-per-line": "off",
173
- "multiline-ternary": "off",
174
- "new-parens": "off",
175
- "newline-per-chained-call": "off",
176
- "no-confusing-arrow": specialRule,
177
- "no-extra-parens": "off",
178
- "no-extra-semi": "off",
179
- "no-floating-decimal": "off",
180
- "no-mixed-operators": specialRule,
181
- "no-mixed-spaces-and-tabs": "off",
182
- "no-multi-spaces": "off",
183
- "no-multiple-empty-lines": "off",
184
- "no-tabs": specialRule,
185
- "no-trailing-spaces": "off",
186
- "no-whitespace-before-property": "off",
187
- "nonblock-statement-body-position": "off",
188
- "object-curly-newline": "off",
189
- "object-curly-spacing": "off",
190
- "object-property-newline": "off",
191
- "one-var-declaration-per-line": "off",
192
- "operator-linebreak": "off",
193
- "padded-blocks": "off",
194
- "quote-props": "off",
195
- "quotes": specialRule,
196
- "rest-spread-spacing": "off",
197
- "semi": "off",
198
- "semi-spacing": "off",
199
- "semi-style": "off",
200
- "space-before-blocks": "off",
201
- "space-before-function-paren": "off",
202
- "space-in-parens": "off",
203
- "space-infix-ops": "off",
204
- "space-unary-ops": "off",
205
- "switch-colon-spacing": "off",
206
- "template-curly-spacing": "off",
207
- "template-tag-spacing": "off",
208
- "wrap-iife": "off",
209
- "wrap-regex": "off",
210
- "yield-star-spacing": "off",
211
- // Deprecated since version 7.0.0.
212
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
213
- "react/jsx-space-before-closing": "off"
214
- }
215
- }
216
- };
217
- }
218
- });
219
-
220
1
  // eslint-config/index.ts
221
- init_esm_shims();
2
+ import { configApp } from "@adonisjs/eslint-config";
3
+ import { isPackageExists as isPackageExists2 } from "local-pkg";
222
4
  import tseslint2 from "typescript-eslint";
223
5
 
224
- // eslint-config/configs/comments.ts
225
- init_esm_shims();
226
-
227
6
  // eslint-config/plugins.ts
228
- init_esm_shims();
229
7
  import { default as default2 } from "@eslint-community/eslint-plugin-eslint-comments";
230
8
  import { default as default3 } from "eslint-plugin-antfu";
231
- import * as pluginImport from "eslint-plugin-import-x";
232
- import { default as default4 } from "eslint-plugin-n";
233
- import { default as default5 } from "eslint-plugin-perfectionist";
9
+ import { default as default4 } from "eslint-plugin-import";
10
+ import { default as default5 } from "eslint-plugin-n";
234
11
  import { default as default6 } from "eslint-plugin-unicorn";
235
12
  import { default as default7 } from "eslint-plugin-unused-imports";
236
13
 
@@ -253,11 +30,7 @@ function comments() {
253
30
  ];
254
31
  }
255
32
 
256
- // eslint-config/configs/disables.ts
257
- init_esm_shims();
258
-
259
33
  // eslint-config/globs.ts
260
- init_esm_shims();
261
34
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
262
35
  var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
263
36
  var GLOB_MARKDOWN = "**/*.md";
@@ -361,19 +134,17 @@ function disables() {
361
134
  }
362
135
 
363
136
  // eslint-config/configs/formatters.ts
364
- init_esm_shims();
365
- var import_eslint_config_prettier = __toESM(require_eslint_config_prettier(), 1);
137
+ import prettierConfig from "eslint-config-prettier";
366
138
  function formatters() {
367
139
  return [
368
140
  {
369
141
  name: "solvro/prettier",
370
- ...import_eslint_config_prettier.default
142
+ ...prettierConfig
371
143
  }
372
144
  ];
373
145
  }
374
146
 
375
147
  // eslint-config/configs/ignores.ts
376
- init_esm_shims();
377
148
  function ignores() {
378
149
  return [
379
150
  {
@@ -384,33 +155,48 @@ function ignores() {
384
155
  }
385
156
 
386
157
  // eslint-config/configs/imports.ts
387
- init_esm_shims();
388
158
  function imports() {
389
159
  return [
160
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
161
+ default4.flatConfigs.typescript,
390
162
  {
391
163
  name: "solvro/imports/rules",
392
164
  plugins: {
393
165
  antfu: default3,
394
- // @ts-expect-error ???
395
- "import-x": pluginImport
166
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
167
+ import: default4
396
168
  },
169
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
397
170
  rules: {
398
171
  "antfu/import-dedupe": "error",
399
172
  "antfu/no-import-dist": "error",
400
173
  "antfu/no-import-node-modules-by-path": "error",
401
- "import-x/first": "error",
402
- "import-x/no-duplicates": "error",
403
- "import-x/no-mutable-exports": "error",
404
- "import-x/no-named-default": "error",
405
- "import-x/no-self-import": "error",
406
- "import-x/no-webpack-loader-syntax": "error"
174
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
175
+ ...default4.flatConfigs.recommended.rules,
176
+ "import/no-default-export": "error",
177
+ "import/no-dynamic-require": "warn",
178
+ "import/no-unresolved": "off",
179
+ "import/consistent-type-specifier-style": "warn"
180
+ }
181
+ },
182
+ {
183
+ files: [
184
+ "tsup.config.*",
185
+ "eslint.config.*",
186
+ ".commitlintrc.*",
187
+ "knip.*",
188
+ "next.config.*",
189
+ "commitlint.config.*",
190
+ ".releaserc.*"
191
+ ],
192
+ rules: {
193
+ "import/no-default-export": "off"
407
194
  }
408
195
  }
409
196
  ];
410
197
  }
411
198
 
412
199
  // eslint-config/configs/javascript.ts
413
- init_esm_shims();
414
200
  import eslint from "@eslint/js";
415
201
  import globals from "globals";
416
202
  function javascript() {
@@ -647,7 +433,6 @@ function javascript() {
647
433
  }
648
434
 
649
435
  // eslint-config/configs/jsdoc.ts
650
- init_esm_shims();
651
436
  import jsdocPlugin from "eslint-plugin-jsdoc";
652
437
  function jsdoc() {
653
438
  return [
@@ -678,13 +463,12 @@ function jsdoc() {
678
463
  }
679
464
 
680
465
  // eslint-config/configs/node.ts
681
- init_esm_shims();
682
466
  function node() {
683
467
  return [
684
468
  {
685
469
  name: "solvro/node/rules",
686
470
  plugins: {
687
- node: default4
471
+ node: default5
688
472
  },
689
473
  rules: {
690
474
  "node/handle-callback-err": ["error", "^(err|error)$"],
@@ -701,7 +485,6 @@ function node() {
701
485
  }
702
486
 
703
487
  // eslint-config/configs/react.ts
704
- init_esm_shims();
705
488
  import nextPlugin from "@next/eslint-plugin-next";
706
489
  import pluginReact from "eslint-plugin-react";
707
490
  import pluginReactHooks from "eslint-plugin-react-hooks";
@@ -710,17 +493,29 @@ import { isPackageExists } from "local-pkg";
710
493
  var NextJsPackages = ["next"];
711
494
  function react() {
712
495
  const isUsingNext = NextJsPackages.some((index) => isPackageExists(index));
713
- const nextjsConfig = [];
496
+ const nextjsConfig2 = [];
714
497
  if (isUsingNext) {
715
- nextjsConfig.push({
716
- name: "solvro/next/setup",
717
- plugins: {
718
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
719
- "@next/next": nextPlugin
498
+ nextjsConfig2.push(
499
+ {
500
+ name: "solvro/next/setup",
501
+ plugins: {
502
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
503
+ "@next/next": nextPlugin
504
+ },
505
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
506
+ rules: nextPlugin.configs.recommended.rules
720
507
  },
721
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
722
- rules: nextPlugin.configs.recommended.rules
723
- });
508
+ {
509
+ files: [
510
+ "**/app/**/{page,loading,layout}.{js,jsx,ts,tsx}",
511
+ "**/pages/**/*.{js,jsx,ts,tsx}"
512
+ ],
513
+ name: "solvro/next/pages",
514
+ rules: {
515
+ "import/no-default-export": "off"
516
+ }
517
+ }
518
+ );
724
519
  }
725
520
  return [
726
521
  {
@@ -734,7 +529,7 @@ function react() {
734
529
  "react-refresh": pluginReactRefresh
735
530
  }
736
531
  },
737
- ...nextjsConfig,
532
+ ...nextjsConfig2,
738
533
  {
739
534
  files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
740
535
  languageOptions: {
@@ -754,6 +549,7 @@ function react() {
754
549
  rules: {
755
550
  ...pluginReact.configs.flat?.recommended.rules,
756
551
  ...pluginReact.configs.flat?.["jsx-runtime"].rules,
552
+ "react/no-danger": "warn",
757
553
  "react/jsx-no-leaked-render": "warn",
758
554
  // recommended rules react-hooks
759
555
  "react-hooks/exhaustive-deps": "warn",
@@ -775,6 +571,10 @@ function react() {
775
571
  "maxDuration",
776
572
  "config",
777
573
  "generateStaticParams",
574
+ "getStaticProps",
575
+ "getServerSideProps",
576
+ "getInitialProps",
577
+ "getStaticPaths",
778
578
  "metadata",
779
579
  "generateMetadata",
780
580
  "viewport",
@@ -789,7 +589,6 @@ function react() {
789
589
  }
790
590
 
791
591
  // eslint-config/configs/typescript.ts
792
- init_esm_shims();
793
592
  import tseslint from "typescript-eslint";
794
593
  function typescript() {
795
594
  return [
@@ -804,6 +603,7 @@ function typescript() {
804
603
  }
805
604
  },
806
605
  {
606
+ files: ["**/*.{ts,tsx}"],
807
607
  name: "solvro/typescript/rules",
808
608
  rules: {
809
609
  "@typescript-eslint/ban-ts-comment": [
@@ -938,7 +738,6 @@ function typescript() {
938
738
  }
939
739
 
940
740
  // eslint-config/configs/unicorn.ts
941
- init_esm_shims();
942
741
  function unicorn() {
943
742
  return [
944
743
  {
@@ -946,26 +745,46 @@ function unicorn() {
946
745
  plugins: {
947
746
  unicorn: default6
948
747
  },
949
- rules: default6.configs["flat/recommended"].rules
748
+ rules: {
749
+ ...default6.configs["flat/recommended"].rules,
750
+ "unicorn/no-array-reduce": "off",
751
+ "unicorn/no-null": "off"
752
+ }
950
753
  }
951
754
  ];
952
755
  }
953
756
 
954
757
  // eslint-config/index.ts
955
- var solvro = (...configs) => tseslint2.config(
956
- ...react(),
957
- ...typescript(),
958
- ...javascript(),
959
- ...jsdoc(),
960
- ...unicorn(),
961
- ...disables(),
962
- ...imports(),
963
- ...comments(),
964
- ...ignores(),
965
- ...formatters(),
966
- ...node(),
967
- ...configs
968
- );
758
+ var adonisConfig = [...configApp(), ...node()];
759
+ var nextjsConfig = [...react()];
760
+ var solvro = (...overrides) => {
761
+ const isAdonis = isPackageExists2("@adonisjs/core");
762
+ const isNext = isPackageExists2("next");
763
+ const configs = [
764
+ ...typescript(),
765
+ ...javascript(),
766
+ ...jsdoc(),
767
+ ...unicorn(),
768
+ ...disables(),
769
+ ...imports(),
770
+ ...comments(),
771
+ ...ignores(),
772
+ ...formatters(),
773
+ ...overrides
774
+ ];
775
+ if (isNext && isAdonis) {
776
+ throw new Error(
777
+ "You can't use both Adonis and Next.js in the same project"
778
+ );
779
+ }
780
+ if (isAdonis) {
781
+ configs.push(...adonisConfig);
782
+ }
783
+ if (isNext) {
784
+ configs.push(...nextjsConfig);
785
+ }
786
+ return tseslint2.config(configs);
787
+ };
969
788
  export {
970
789
  solvro
971
790
  };