@solvro/config 2.0.0-beta.2 → 2.0.0-beta.4
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.
- package/README.md +63 -0
- package/dist/adonis-HMBH6E55.js +56 -0
- package/dist/adonis-HMBH6E55.js.map +1 -0
- package/dist/chunk-AQ5RXFKK.js +34 -0
- package/dist/chunk-AQ5RXFKK.js.map +1 -0
- package/dist/chunk-DHQ2VVRM.js +86 -0
- package/dist/chunk-DHQ2VVRM.js.map +1 -0
- package/dist/chunk-HM3MY7J3.js +22 -0
- package/dist/chunk-HM3MY7J3.js.map +1 -0
- package/dist/chunk-J5OUMHDO.js +44 -0
- package/dist/chunk-J5OUMHDO.js.map +1 -0
- package/dist/chunk-OEFF22F3.js +189 -0
- package/dist/chunk-OEFF22F3.js.map +1 -0
- package/dist/cli/index.js +416 -145
- package/dist/cli/index.js.map +1 -1
- package/dist/commitlint/index.js +5 -0
- package/dist/commitlint/index.js.map +1 -1
- package/dist/eslint/index.js +64 -510
- package/dist/eslint/index.js.map +1 -1
- package/dist/nestjs-JMOHWBQG.js +57 -0
- package/dist/nestjs-JMOHWBQG.js.map +1 -0
- package/dist/node-S7MI3CIK.js +27 -0
- package/dist/node-S7MI3CIK.js.map +1 -0
- package/dist/prettier/index.js +5 -0
- package/dist/prettier/index.js.map +1 -1
- package/dist/react-4BBIFFXI.js +2133 -0
- package/dist/react-4BBIFFXI.js.map +1 -0
- package/package.json +54 -47
package/dist/eslint/index.js
CHANGED
@@ -1,9 +1,30 @@
|
|
1
|
+
import {
|
2
|
+
default as default2,
|
3
|
+
default2 as default3,
|
4
|
+
default6 as default4
|
5
|
+
} from "../chunk-HM3MY7J3.js";
|
6
|
+
import {
|
7
|
+
init_esm_shims
|
8
|
+
} from "../chunk-J5OUMHDO.js";
|
9
|
+
|
10
|
+
// src/eslint/index.ts
|
11
|
+
init_esm_shims();
|
12
|
+
import { findUpSync as findUpSync2 } from "find-up-simple";
|
13
|
+
import { isPackageListed } from "local-pkg";
|
14
|
+
import path3 from "path";
|
15
|
+
import tseslint3 from "typescript-eslint";
|
16
|
+
|
17
|
+
// src/eslint/presets/base.ts
|
18
|
+
init_esm_shims();
|
19
|
+
|
1
20
|
// node_modules/eslint-config-flat-gitignore/dist/index.mjs
|
21
|
+
init_esm_shims();
|
2
22
|
import fs2 from "fs";
|
3
23
|
import path2, { join, resolve, relative, dirname } from "path";
|
4
24
|
import process2 from "process";
|
5
25
|
|
6
26
|
// node_modules/@eslint/compat/dist/esm/index.js
|
27
|
+
init_esm_shims();
|
7
28
|
import fs from "fs";
|
8
29
|
import path from "path";
|
9
30
|
function convertIgnorePatternToMinimatch(pattern) {
|
@@ -126,56 +147,8 @@ function parseGitSubmodules(content) {
|
|
126
147
|
return content.split(/\r?\n/u).map((line) => line.match(/path\s*=\s*(.+)/u)).filter((match) => match !== null).map((match) => match[1].trim());
|
127
148
|
}
|
128
149
|
|
129
|
-
// src/eslint/index.ts
|
130
|
-
import { findUpSync as findUpSync2 } from "find-up-simple";
|
131
|
-
import { isPackageListed } from "local-pkg";
|
132
|
-
import path3 from "path";
|
133
|
-
import tseslint4 from "typescript-eslint";
|
134
|
-
import { configApp } from "@adonisjs/eslint-config";
|
135
|
-
|
136
|
-
// src/eslint/configs/a11y.ts
|
137
|
-
import jsxA11y from "eslint-plugin-jsx-a11y";
|
138
|
-
import globals from "globals";
|
139
|
-
function a11y() {
|
140
|
-
return [
|
141
|
-
{
|
142
|
-
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
|
143
|
-
...jsxA11y.flatConfigs.recommended,
|
144
|
-
languageOptions: {
|
145
|
-
...jsxA11y.flatConfigs.recommended.languageOptions,
|
146
|
-
globals: {
|
147
|
-
...globals.serviceworker,
|
148
|
-
...globals.browser
|
149
|
-
}
|
150
|
-
},
|
151
|
-
settings: {
|
152
|
-
"jsx-a11y": {
|
153
|
-
components: {
|
154
|
-
Input: "input",
|
155
|
-
Button: "button",
|
156
|
-
Link: "a",
|
157
|
-
Label: "label",
|
158
|
-
Select: "select",
|
159
|
-
Textarea: "textarea"
|
160
|
-
},
|
161
|
-
attributes: {
|
162
|
-
for: ["htmlFor", "for"]
|
163
|
-
}
|
164
|
-
}
|
165
|
-
}
|
166
|
-
}
|
167
|
-
];
|
168
|
-
}
|
169
|
-
|
170
|
-
// src/eslint/plugins.ts
|
171
|
-
import { default as default2 } from "@eslint-community/eslint-plugin-eslint-comments";
|
172
|
-
import { default as default3 } from "eslint-plugin-antfu";
|
173
|
-
import { default as default4 } from "eslint-plugin-import";
|
174
|
-
import { default as default5 } from "eslint-plugin-n";
|
175
|
-
import { default as default6 } from "eslint-plugin-unicorn";
|
176
|
-
import { default as default7 } from "eslint-plugin-unused-imports";
|
177
|
-
|
178
150
|
// src/eslint/configs/comments.ts
|
151
|
+
init_esm_shims();
|
179
152
|
function comments() {
|
180
153
|
return [
|
181
154
|
{
|
@@ -195,11 +168,14 @@ function comments() {
|
|
195
168
|
}
|
196
169
|
|
197
170
|
// src/eslint/configs/disables.ts
|
171
|
+
init_esm_shims();
|
198
172
|
import tseslint from "typescript-eslint";
|
199
173
|
|
200
174
|
// src/eslint/globs.ts
|
175
|
+
init_esm_shims();
|
201
176
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
202
177
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
178
|
+
var GLOB_JS = "**/*.?([cm])js";
|
203
179
|
var GLOB_EXCLUDE = [
|
204
180
|
"**/node_modules",
|
205
181
|
"**/dist",
|
@@ -295,13 +271,14 @@ function disables() {
|
|
295
271
|
}
|
296
272
|
},
|
297
273
|
{
|
298
|
-
files: [
|
274
|
+
files: [GLOB_JS],
|
299
275
|
extends: [tseslint.configs.disableTypeChecked]
|
300
276
|
}
|
301
277
|
];
|
302
278
|
}
|
303
279
|
|
304
280
|
// src/eslint/configs/formatters.ts
|
281
|
+
init_esm_shims();
|
305
282
|
import prettierConfig from "eslint-config-prettier";
|
306
283
|
function formatters() {
|
307
284
|
return [
|
@@ -316,6 +293,7 @@ function formatters() {
|
|
316
293
|
}
|
317
294
|
|
318
295
|
// src/eslint/configs/ignores.ts
|
296
|
+
init_esm_shims();
|
319
297
|
function ignores() {
|
320
298
|
return [
|
321
299
|
{
|
@@ -325,90 +303,19 @@ function ignores() {
|
|
325
303
|
];
|
326
304
|
}
|
327
305
|
|
328
|
-
// src/eslint/configs/imports.ts
|
329
|
-
var forbiddenUiLibraries = [
|
330
|
-
"@headlessui/react",
|
331
|
-
"@mui/material",
|
332
|
-
"@chakra-ui/react",
|
333
|
-
"@chakra-ui/core",
|
334
|
-
"@nextui-org/react",
|
335
|
-
"react-bootstrap",
|
336
|
-
"antd"
|
337
|
-
];
|
338
|
-
function imports({
|
339
|
-
forbidDefaultExport = true
|
340
|
-
} = {}) {
|
341
|
-
const config = [
|
342
|
-
default4.flatConfigs.typescript,
|
343
|
-
{
|
344
|
-
name: "solvro/imports/rules",
|
345
|
-
plugins: {
|
346
|
-
antfu: default3
|
347
|
-
},
|
348
|
-
rules: {
|
349
|
-
"antfu/import-dedupe": "error",
|
350
|
-
"antfu/no-import-dist": "error",
|
351
|
-
"antfu/no-import-node-modules-by-path": "error",
|
352
|
-
...default4.flatConfigs.recommended.rules,
|
353
|
-
"import/no-dynamic-require": "warn",
|
354
|
-
"import/no-unresolved": "off",
|
355
|
-
"import/consistent-type-specifier-style": "warn",
|
356
|
-
"@typescript-eslint/no-restricted-imports": [
|
357
|
-
"error",
|
358
|
-
{
|
359
|
-
paths: [
|
360
|
-
{
|
361
|
-
name: "axios",
|
362
|
-
message: "Please use fetch instead"
|
363
|
-
},
|
364
|
-
...forbiddenUiLibraries.map((library) => ({
|
365
|
-
name: library,
|
366
|
-
message: `Please use ui.shadcn.com components instead.`
|
367
|
-
}))
|
368
|
-
]
|
369
|
-
}
|
370
|
-
]
|
371
|
-
}
|
372
|
-
}
|
373
|
-
];
|
374
|
-
if (forbidDefaultExport) {
|
375
|
-
config.push(
|
376
|
-
{
|
377
|
-
rules: { "import/no-default-export": "error" }
|
378
|
-
},
|
379
|
-
{
|
380
|
-
files: [
|
381
|
-
"tsup.config.*",
|
382
|
-
"eslint.config.*",
|
383
|
-
".commitlintrc.*",
|
384
|
-
"knip.*",
|
385
|
-
"next.config.*",
|
386
|
-
"commitlint.config.*",
|
387
|
-
".releaserc.*",
|
388
|
-
"vitest.config.*",
|
389
|
-
"playwright.config.*"
|
390
|
-
],
|
391
|
-
rules: {
|
392
|
-
"import/no-default-export": "off"
|
393
|
-
}
|
394
|
-
}
|
395
|
-
);
|
396
|
-
}
|
397
|
-
return config;
|
398
|
-
}
|
399
|
-
|
400
306
|
// src/eslint/configs/javascript.ts
|
307
|
+
init_esm_shims();
|
401
308
|
import eslint from "@eslint/js";
|
402
|
-
import
|
309
|
+
import globals from "globals";
|
403
310
|
function javascript() {
|
404
311
|
return [
|
405
312
|
{
|
406
313
|
languageOptions: {
|
407
314
|
ecmaVersion: 2022,
|
408
315
|
globals: {
|
409
|
-
...
|
410
|
-
...
|
411
|
-
...
|
316
|
+
...globals.browser,
|
317
|
+
...globals.es2021,
|
318
|
+
...globals.node,
|
412
319
|
document: "readonly",
|
413
320
|
navigator: "readonly",
|
414
321
|
window: "readonly"
|
@@ -431,7 +338,7 @@ function javascript() {
|
|
431
338
|
name: "solvro/javascript/rules",
|
432
339
|
plugins: {
|
433
340
|
antfu: default3,
|
434
|
-
"unused-imports":
|
341
|
+
"unused-imports": default4
|
435
342
|
},
|
436
343
|
rules: {
|
437
344
|
...eslint.configs.recommended.rules,
|
@@ -621,6 +528,7 @@ function javascript() {
|
|
621
528
|
}
|
622
529
|
|
623
530
|
// src/eslint/configs/jsdoc.ts
|
531
|
+
init_esm_shims();
|
624
532
|
import jsdocPlugin from "eslint-plugin-jsdoc";
|
625
533
|
function jsdoc() {
|
626
534
|
return [
|
@@ -650,129 +558,8 @@ function jsdoc() {
|
|
650
558
|
];
|
651
559
|
}
|
652
560
|
|
653
|
-
// src/eslint/configs/node.ts
|
654
|
-
function node() {
|
655
|
-
return [
|
656
|
-
{
|
657
|
-
name: "solvro/node/rules",
|
658
|
-
plugins: {
|
659
|
-
node: default5
|
660
|
-
},
|
661
|
-
rules: {
|
662
|
-
"node/handle-callback-err": ["error", "^(err|error)$"],
|
663
|
-
"node/no-deprecated-api": "error",
|
664
|
-
"node/no-exports-assign": "error",
|
665
|
-
"node/no-new-require": "error",
|
666
|
-
"node/no-path-concat": "error",
|
667
|
-
"node/prefer-global/buffer": ["error"],
|
668
|
-
"node/prefer-global/process": ["error"],
|
669
|
-
"node/process-exit-as-throw": "error"
|
670
|
-
}
|
671
|
-
}
|
672
|
-
];
|
673
|
-
}
|
674
|
-
|
675
|
-
// src/eslint/configs/react.ts
|
676
|
-
import pluginQuery from "@tanstack/eslint-plugin-query";
|
677
|
-
import pluginReact from "eslint-plugin-react";
|
678
|
-
import pluginReactHooks from "eslint-plugin-react-hooks";
|
679
|
-
import { isPackageExists } from "local-pkg";
|
680
|
-
var nextJsPackages = ["next"];
|
681
|
-
async function react() {
|
682
|
-
const isUsingNext = nextJsPackages.some((index) => isPackageExists(index));
|
683
|
-
const nextjsConfig = [];
|
684
|
-
if (isUsingNext) {
|
685
|
-
const nextPlugin = await import("@next/eslint-plugin-next").then(
|
686
|
-
(d) => d.default
|
687
|
-
);
|
688
|
-
nextjsConfig.push(
|
689
|
-
{
|
690
|
-
name: "solvro/next/setup",
|
691
|
-
plugins: {
|
692
|
-
"@next/next": nextPlugin
|
693
|
-
},
|
694
|
-
rules: nextPlugin.configs.recommended.rules
|
695
|
-
},
|
696
|
-
{
|
697
|
-
files: [
|
698
|
-
"**/app/**/{page,loading,layout,template,error,not-found,unauthorized,forbidden,default,robots,sitemap}.{js,jsx,ts,tsx}",
|
699
|
-
"**/pages/**/*.{js,jsx,ts,tsx}"
|
700
|
-
],
|
701
|
-
name: "solvro/next/pages",
|
702
|
-
rules: {
|
703
|
-
"import/no-default-export": "off"
|
704
|
-
}
|
705
|
-
}
|
706
|
-
);
|
707
|
-
}
|
708
|
-
return [
|
709
|
-
{
|
710
|
-
name: "solvro/react/setup",
|
711
|
-
plugins: {
|
712
|
-
react: pluginReact,
|
713
|
-
"react-hooks": pluginReactHooks
|
714
|
-
}
|
715
|
-
},
|
716
|
-
...nextjsConfig,
|
717
|
-
{
|
718
|
-
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
719
|
-
languageOptions: {
|
720
|
-
parserOptions: {
|
721
|
-
ecmaFeatures: {
|
722
|
-
jsx: true
|
723
|
-
}
|
724
|
-
},
|
725
|
-
sourceType: "module"
|
726
|
-
},
|
727
|
-
settings: {
|
728
|
-
react: {
|
729
|
-
version: "detect"
|
730
|
-
}
|
731
|
-
},
|
732
|
-
name: "solvro/react/rules",
|
733
|
-
rules: {
|
734
|
-
...pluginReact.configs.flat.recommended.rules,
|
735
|
-
...pluginReact.configs.flat["jsx-runtime"].rules,
|
736
|
-
"react/no-danger": "warn",
|
737
|
-
"react/jsx-no-leaked-render": "warn",
|
738
|
-
// recommended rules react-hooks
|
739
|
-
"react-hooks/exhaustive-deps": "warn",
|
740
|
-
"react-hooks/rules-of-hooks": "error",
|
741
|
-
"react/jsx-no-useless-fragment": "error",
|
742
|
-
"react/function-component-definition": [
|
743
|
-
"error",
|
744
|
-
{
|
745
|
-
unnamedComponents: "arrow-function",
|
746
|
-
namedComponents: "function-declaration"
|
747
|
-
}
|
748
|
-
],
|
749
|
-
"react/hook-use-state": [
|
750
|
-
"error",
|
751
|
-
{
|
752
|
-
allowDestructuredState: true
|
753
|
-
}
|
754
|
-
],
|
755
|
-
"react/no-array-index-key": "warn"
|
756
|
-
}
|
757
|
-
},
|
758
|
-
...pluginQuery.configs["flat/recommended"],
|
759
|
-
{
|
760
|
-
name: "solvro/react/disables",
|
761
|
-
files: ["**/components/ui/*.{jsx,tsx}"],
|
762
|
-
rules: {
|
763
|
-
"react/prop-types": "off",
|
764
|
-
"no-shadow": "off",
|
765
|
-
"@typescript-eslint/no-shadow": "off",
|
766
|
-
"@typescript-eslint/restrict-template-expressions": "off",
|
767
|
-
"unicorn/no-document-cookie": "off",
|
768
|
-
"@typescript-eslint/no-redeclare": "off",
|
769
|
-
"@typescript-eslint/no-deprecated": "off"
|
770
|
-
}
|
771
|
-
}
|
772
|
-
];
|
773
|
-
}
|
774
|
-
|
775
561
|
// src/eslint/configs/typescript-relaxed.ts
|
562
|
+
init_esm_shims();
|
776
563
|
import tseslint2 from "typescript-eslint";
|
777
564
|
function typescriptRelaxed() {
|
778
565
|
return [
|
@@ -817,261 +604,21 @@ function typescriptRelaxed() {
|
|
817
604
|
];
|
818
605
|
}
|
819
606
|
|
820
|
-
// src/eslint/
|
821
|
-
|
822
|
-
function typescriptStrict() {
|
823
|
-
return [
|
824
|
-
...tseslint3.configs.strictTypeChecked,
|
825
|
-
...tseslint3.configs.stylisticTypeChecked,
|
826
|
-
{
|
827
|
-
name: "solvro/typescript-strict/setup",
|
828
|
-
plugins: {
|
829
|
-
antfu: default3
|
830
|
-
}
|
831
|
-
},
|
832
|
-
{
|
833
|
-
files: ["**/*.{ts,tsx}"],
|
834
|
-
name: "solvro/typescript-strict/rules",
|
835
|
-
rules: {
|
836
|
-
"@typescript-eslint/ban-ts-comment": [
|
837
|
-
"error",
|
838
|
-
{ "ts-expect-error": "allow-with-description" }
|
839
|
-
],
|
840
|
-
"@typescript-eslint/consistent-type-definitions": [
|
841
|
-
"error",
|
842
|
-
"interface"
|
843
|
-
],
|
844
|
-
"@typescript-eslint/consistent-type-imports": [
|
845
|
-
"error",
|
846
|
-
{
|
847
|
-
disallowTypeAnnotations: false,
|
848
|
-
prefer: "type-imports"
|
849
|
-
}
|
850
|
-
],
|
851
|
-
"@typescript-eslint/method-signature-style": ["error", "property"],
|
852
|
-
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
853
|
-
"@typescript-eslint/no-dupe-class-members": "error",
|
854
|
-
"@typescript-eslint/no-empty-object-type": [
|
855
|
-
"error",
|
856
|
-
{ allowInterfaces: "always" }
|
857
|
-
],
|
858
|
-
"@typescript-eslint/no-import-type-side-effects": "error",
|
859
|
-
"@typescript-eslint/no-redeclare": ["error", { builtinGlobals: false }],
|
860
|
-
"@typescript-eslint/no-require-imports": "error",
|
861
|
-
"@typescript-eslint/no-unused-expressions": [
|
862
|
-
"error",
|
863
|
-
{
|
864
|
-
allowShortCircuit: true,
|
865
|
-
allowTaggedTemplates: true,
|
866
|
-
allowTernary: true
|
867
|
-
}
|
868
|
-
],
|
869
|
-
"@typescript-eslint/no-use-before-define": [
|
870
|
-
"error",
|
871
|
-
{ classes: false, functions: false, variables: true }
|
872
|
-
],
|
873
|
-
"@typescript-eslint/no-wrapper-object-types": "error",
|
874
|
-
// prevent unnecessary use of void operator
|
875
|
-
"@typescript-eslint/no-meaningless-void-operator": "error",
|
876
|
-
// "using non-null assertions cancels the benefits of the strict
|
877
|
-
// null-checking mode."
|
878
|
-
// warn when one of the types in union / intersection overrides others
|
879
|
-
"@typescript-eslint/no-redundant-type-constituents": "warn",
|
880
|
-
// prevent variables shadowing
|
881
|
-
"no-shadow": "error",
|
882
|
-
"@typescript-eslint/no-shadow": "error",
|
883
|
-
// prevent assignment of this, signals a wrong usage of it
|
884
|
-
"@typescript-eslint/no-this-alias": "error",
|
885
|
-
// prevent throwing non-error
|
886
|
-
"no-throw-literal": "off",
|
887
|
-
// prevent unnecessary explicitly adding a default type argument
|
888
|
-
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
889
|
-
// prevent unnecessary assertions that won't change the outcome
|
890
|
-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
891
|
-
// prevent extending default types
|
892
|
-
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
893
|
-
// force typing out function arguments
|
894
|
-
"@typescript-eslint/no-unsafe-argument": "error",
|
895
|
-
// prevent usage of any via reassigning
|
896
|
-
"@typescript-eslint/no-unsafe-assignment": "error",
|
897
|
-
// prevent usage of any via calling it
|
898
|
-
"@typescript-eslint/no-unsafe-call": "error",
|
899
|
-
// prevent usage of any via using it's members
|
900
|
-
"@typescript-eslint/no-unsafe-member-access": "error",
|
901
|
-
// prevent reverting any from functions
|
902
|
-
"@typescript-eslint/no-unsafe-return": "error",
|
903
|
-
// prevent unused expressions
|
904
|
-
"no-unused-expressions": "off",
|
905
|
-
// var<'string'> = 'string' -> var = 'string' as const
|
906
|
-
"@typescript-eslint/prefer-as-const": "error",
|
907
|
-
// force initializing enums
|
908
|
-
"@typescript-eslint/prefer-enum-initializers": "error",
|
909
|
-
// prefer for x of obj to for let i = 0...
|
910
|
-
"@typescript-eslint/prefer-for-of": "error",
|
911
|
-
// prefer includes() to indexOf()
|
912
|
-
"@typescript-eslint/prefer-includes": "error",
|
913
|
-
// use literals for enum initialization
|
914
|
-
"@typescript-eslint/prefer-literal-enum-member": "error",
|
915
|
-
// prefer safe cascade of a value when dealing with undefined or null
|
916
|
-
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
917
|
-
// prefer optional chaining (a?.b)
|
918
|
-
"@typescript-eslint/prefer-optional-chain": "error",
|
919
|
-
// prefer using type parameter for Array.reduce
|
920
|
-
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
921
|
-
// prefer RegExp#exec when no /g flag in regex
|
922
|
-
"@typescript-eslint/prefer-regexp-exec": "error",
|
923
|
-
// enforce `this` as a type when stating type for a method
|
924
|
-
"@typescript-eslint/prefer-return-this-type": "error",
|
925
|
-
// enforce startsWith to indexOf === 0
|
926
|
-
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
927
|
-
// prevents default behavior of .sort() - which is confusing
|
928
|
-
"@typescript-eslint/require-array-sort-compare": "error",
|
929
|
-
// no async functions without awaits in body
|
930
|
-
"require-await": "off",
|
931
|
-
"@typescript-eslint/require-await": "error",
|
932
|
-
// prevent number + string
|
933
|
-
"@typescript-eslint/restrict-plus-operands": "error",
|
934
|
-
// only allow string in templates
|
935
|
-
"@typescript-eslint/restrict-template-expressions": "error",
|
936
|
-
// prevent returning await
|
937
|
-
"no-return-await": "off",
|
938
|
-
"@typescript-eslint/return-await": "error",
|
939
|
-
// only booleans in ifs and whiles
|
940
|
-
"@typescript-eslint/strict-boolean-expressions": "error",
|
941
|
-
// check if all paths are followed in code
|
942
|
-
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
943
|
-
"dot-notation": "off",
|
944
|
-
"no-implied-eval": "off",
|
945
|
-
"@typescript-eslint/await-thenable": "error",
|
946
|
-
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
947
|
-
"@typescript-eslint/no-floating-promises": "error",
|
948
|
-
"@typescript-eslint/no-for-in-array": "error",
|
949
|
-
"@typescript-eslint/no-implied-eval": "error",
|
950
|
-
"@typescript-eslint/no-misused-promises": "error",
|
951
|
-
"@typescript-eslint/promise-function-async": "error",
|
952
|
-
"@typescript-eslint/unbound-method": "error",
|
953
|
-
"no-restricted-imports": "off"
|
954
|
-
}
|
955
|
-
}
|
956
|
-
];
|
957
|
-
}
|
958
|
-
|
959
|
-
// src/eslint/configs/unicorn.ts
|
960
|
-
function unicorn() {
|
961
|
-
return [
|
962
|
-
{
|
963
|
-
name: "solvro/unicorn/rules",
|
964
|
-
plugins: {
|
965
|
-
unicorn: default6
|
966
|
-
},
|
967
|
-
rules: {
|
968
|
-
...default6.configs["flat/recommended"].rules,
|
969
|
-
"unicorn/no-array-reduce": "off",
|
970
|
-
"unicorn/no-null": "off",
|
971
|
-
"unicorn/no-useless-switch-case": "off",
|
972
|
-
"unicorn/prefer-global-this": "off",
|
973
|
-
"unicorn/prevent-abbreviations": [
|
974
|
-
"error",
|
975
|
-
{
|
976
|
-
replacements: {
|
977
|
-
env: false,
|
978
|
-
envs: false,
|
979
|
-
props: false,
|
980
|
-
prop: false,
|
981
|
-
ref: false
|
982
|
-
},
|
983
|
-
allowList: {
|
984
|
-
e2e: true
|
985
|
-
},
|
986
|
-
ignore: [String.raw`e2e`]
|
987
|
-
}
|
988
|
-
]
|
989
|
-
}
|
990
|
-
}
|
991
|
-
];
|
992
|
-
}
|
993
|
-
|
994
|
-
// src/eslint/index.ts
|
995
|
-
var builtinAdonisConfig = configApp();
|
996
|
-
var adonisConfig = [
|
997
|
-
...builtinAdonisConfig,
|
998
|
-
...node(),
|
999
|
-
...imports(),
|
1000
|
-
{
|
1001
|
-
rules: {
|
1002
|
-
"@typescript-eslint/naming-convention": [
|
1003
|
-
"error",
|
1004
|
-
{
|
1005
|
-
selector: ["enum", "enumMember", "class", "interface", "typeLike"],
|
1006
|
-
format: ["PascalCase"],
|
1007
|
-
leadingUnderscore: "allow",
|
1008
|
-
trailingUnderscore: "allow"
|
1009
|
-
},
|
1010
|
-
{
|
1011
|
-
selector: ["classProperty", "classMethod", "method", "variableLike"],
|
1012
|
-
format: ["camelCase"],
|
1013
|
-
leadingUnderscore: "allow",
|
1014
|
-
trailingUnderscore: "allow"
|
1015
|
-
},
|
1016
|
-
{
|
1017
|
-
selector: "variable",
|
1018
|
-
format: ["camelCase", "UPPER_CASE", "PascalCase"],
|
1019
|
-
leadingUnderscore: "allow",
|
1020
|
-
trailingUnderscore: "allow"
|
1021
|
-
}
|
1022
|
-
]
|
1023
|
-
}
|
1024
|
-
}
|
1025
|
-
];
|
1026
|
-
var nestjsConfig = [
|
1027
|
-
...node(),
|
1028
|
-
...unicorn(),
|
1029
|
-
...typescriptStrict(),
|
1030
|
-
...imports({ forbidDefaultExport: true }),
|
1031
|
-
{
|
1032
|
-
rules: {
|
1033
|
-
"no-implicit-coercion": [
|
1034
|
-
"error",
|
1035
|
-
{
|
1036
|
-
allow: ["+"]
|
1037
|
-
}
|
1038
|
-
],
|
1039
|
-
"unicorn/prefer-top-level-await": "off"
|
1040
|
-
}
|
1041
|
-
},
|
1042
|
-
{
|
1043
|
-
rules: {
|
1044
|
-
"@typescript-eslint/no-extraneous-class": [
|
1045
|
-
"error",
|
1046
|
-
{
|
1047
|
-
allowEmpty: true
|
1048
|
-
}
|
1049
|
-
]
|
1050
|
-
},
|
1051
|
-
files: ["**/*.module.ts"]
|
1052
|
-
},
|
1053
|
-
{
|
1054
|
-
rules: {
|
1055
|
-
"@typescript-eslint/no-floating-promises": "off"
|
1056
|
-
},
|
1057
|
-
files: ["./src/main.ts"]
|
1058
|
-
}
|
1059
|
-
];
|
1060
|
-
var reactConfig = async () => [
|
1061
|
-
...a11y(),
|
1062
|
-
...unicorn(),
|
1063
|
-
...typescriptStrict(),
|
1064
|
-
...imports({ forbidDefaultExport: true }),
|
1065
|
-
...await react()
|
1066
|
-
];
|
1067
|
-
var configs = [
|
607
|
+
// src/eslint/presets/base.ts
|
608
|
+
var basePreset = () => [
|
1068
609
|
ignore(),
|
1069
610
|
...javascript(),
|
1070
611
|
...jsdoc(),
|
1071
612
|
...comments(),
|
1072
613
|
...typescriptRelaxed()
|
1073
614
|
];
|
1074
|
-
var
|
615
|
+
var defaultOverridesPreset = () => [
|
616
|
+
...ignores(),
|
617
|
+
...formatters(),
|
618
|
+
...disables()
|
619
|
+
];
|
620
|
+
|
621
|
+
// src/eslint/index.ts
|
1075
622
|
var solvro = async (...overrides) => {
|
1076
623
|
const isAdonis = await isPackageListed("@adonisjs/core");
|
1077
624
|
const isReact = await isPackageListed("react");
|
@@ -1079,15 +626,20 @@ var solvro = async (...overrides) => {
|
|
1079
626
|
if (isReact && isAdonis) {
|
1080
627
|
throw new Error("You can't use both Adonis and React in the same project");
|
1081
628
|
}
|
1082
|
-
const
|
629
|
+
const configs = basePreset();
|
630
|
+
const projectConfigs = [];
|
1083
631
|
if (isAdonis) {
|
1084
|
-
|
1085
|
-
|
1086
|
-
if (isNestJs) {
|
1087
|
-
|
1088
|
-
|
1089
|
-
if (isReact) {
|
1090
|
-
|
632
|
+
const { adonisPreset } = await import("../adonis-HMBH6E55.js");
|
633
|
+
projectConfigs.push(...adonisPreset());
|
634
|
+
} else if (isNestJs) {
|
635
|
+
const { nestjsPreset } = await import("../nestjs-JMOHWBQG.js");
|
636
|
+
projectConfigs.push(...nestjsPreset());
|
637
|
+
} else if (isReact) {
|
638
|
+
const { reactPreset } = await import("../react-4BBIFFXI.js");
|
639
|
+
projectConfigs.push(...await reactPreset());
|
640
|
+
} else {
|
641
|
+
const { nodePreset } = await import("../node-S7MI3CIK.js");
|
642
|
+
projectConfigs.push(...nodePreset());
|
1091
643
|
}
|
1092
644
|
const tsConfigPath = findUpSync2("tsconfig.json", {
|
1093
645
|
cwd: process.cwd()
|
@@ -1096,17 +648,19 @@ var solvro = async (...overrides) => {
|
|
1096
648
|
throw new Error("No tsconfig.json found");
|
1097
649
|
}
|
1098
650
|
const rootDirectory = path3.dirname(tsConfigPath);
|
1099
|
-
|
651
|
+
const tsConfig = {
|
1100
652
|
languageOptions: {
|
1101
653
|
parserOptions: {
|
1102
654
|
projectService: true,
|
1103
655
|
tsconfigRootDir: rootDirectory
|
1104
656
|
}
|
1105
657
|
}
|
1106
|
-
}
|
1107
|
-
|
658
|
+
};
|
659
|
+
const defaultOverrides = defaultOverridesPreset();
|
660
|
+
return tseslint3.config(
|
1108
661
|
...configs,
|
1109
|
-
|
662
|
+
tsConfig,
|
663
|
+
...projectConfigs,
|
1110
664
|
...defaultOverrides,
|
1111
665
|
...overrides
|
1112
666
|
);
|