@solvro/config 1.8.3 → 1.10.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,977 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/eslint/index.ts
31
- var eslint_exports = {};
32
- __export(eslint_exports, {
33
- solvro: () => solvro
34
- });
35
- module.exports = __toCommonJS(eslint_exports);
36
- var import_find_up_simple = require("find-up-simple");
37
- var import_local_pkg2 = require("local-pkg");
38
- var import_node_path = __toESM(require("path"), 1);
39
- var import_typescript_eslint4 = __toESM(require("typescript-eslint"), 1);
40
- var import_eslint_config = require("@adonisjs/eslint-config");
41
-
42
- // src/eslint/configs/a11y.ts
43
- var import_eslint_plugin_jsx_a11y = __toESM(require("eslint-plugin-jsx-a11y"), 1);
44
- var import_globals = __toESM(require("globals"), 1);
45
- function a11y() {
46
- return [
47
- {
48
- files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
49
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
50
- ...import_eslint_plugin_jsx_a11y.default.flatConfigs.recommended,
51
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
52
- languageOptions: {
53
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
54
- ...import_eslint_plugin_jsx_a11y.default.flatConfigs.recommended.languageOptions,
55
- globals: {
56
- ...import_globals.default.serviceworker,
57
- ...import_globals.default.browser
58
- }
59
- },
60
- settings: {
61
- "jsx-a11y": {
62
- components: {
63
- Input: "input",
64
- Button: "button",
65
- Link: "a",
66
- Label: "label",
67
- Select: "select",
68
- Textarea: "textarea"
69
- },
70
- attributes: {
71
- for: ["htmlFor", "for"]
72
- }
73
- }
74
- }
75
- }
76
- ];
77
- }
78
-
79
- // src/eslint/plugins.ts
80
- var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
81
- var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
82
- var import_eslint_plugin_import = __toESM(require("eslint-plugin-import"), 1);
83
- var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
84
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
85
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
86
-
87
- // src/eslint/configs/comments.ts
88
- function comments() {
89
- return [
90
- {
91
- name: "solvro/eslint-comments/rules",
92
- plugins: {
93
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
94
- "eslint-comments": import_eslint_plugin_eslint_comments.default
95
- },
96
- rules: {
97
- "eslint-comments/no-aggregating-enable": "error",
98
- "eslint-comments/no-duplicate-disable": "error",
99
- "eslint-comments/no-unlimited-disable": "error",
100
- "eslint-comments/no-unused-enable": "error"
101
- }
102
- }
103
- ];
104
- }
105
-
106
- // src/eslint/configs/disables.ts
107
- var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
108
-
109
- // src/eslint/globs.ts
110
- var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
111
- var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
112
- var GLOB_EXCLUDE = [
113
- "**/node_modules",
114
- "**/dist",
115
- "**/package-lock.json",
116
- "**/yarn.lock",
117
- "**/pnpm-lock.yaml",
118
- "**/bun.lockb",
119
- "**/build",
120
- "**/output",
121
- "**/coverage",
122
- "**/temp",
123
- "**/.temp",
124
- "**/tmp",
125
- "**/.tmp",
126
- "**/.history",
127
- "**/.vitepress/cache",
128
- "**/.nuxt",
129
- "**/.next",
130
- "**/.svelte-kit",
131
- "**/.vercel",
132
- "**/.changeset",
133
- "**/.idea",
134
- "**/.cache",
135
- "**/.output",
136
- "**/.vite-inspect",
137
- "**/.yarn",
138
- "**/vite.config.*.timestamp-*",
139
- "**/CHANGELOG*.md",
140
- "**/*.min.*",
141
- "**/LICENSE*",
142
- "**/__snapshots__",
143
- "**/auto-import?(s).d.ts",
144
- "**/components.d.ts"
145
- ];
146
-
147
- // src/eslint/configs/disables.ts
148
- function disables() {
149
- return [
150
- {
151
- files: [`**/scripts/${GLOB_SRC}`],
152
- name: "solvro/disables/scripts",
153
- rules: {
154
- "antfu/no-top-level-await": "off",
155
- "no-console": "off",
156
- "@typescript-eslint/explicit-function-return-type": "off"
157
- }
158
- },
159
- {
160
- rules: {
161
- "prettier/prettier": "off"
162
- }
163
- },
164
- {
165
- files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
166
- name: "solvro/disables/cli",
167
- rules: {
168
- "antfu/no-top-level-await": "off",
169
- "no-console": "off"
170
- }
171
- },
172
- {
173
- files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
174
- name: "solvro/disables/bin",
175
- rules: {
176
- "antfu/no-import-dist": "off",
177
- "antfu/no-import-node-modules-by-path": "off"
178
- }
179
- },
180
- {
181
- files: ["**/*.d.?([cm])ts"],
182
- name: "solvro/disables/dts",
183
- rules: {
184
- "eslint-comments/no-unlimited-disable": "off",
185
- "import-x/no-duplicates": "off",
186
- "no-restricted-syntax": "off",
187
- "unused-imports/no-unused-vars": "off"
188
- }
189
- },
190
- {
191
- files: ["**/*.js", "**/*.cjs"],
192
- name: "solvro/disables/cjs",
193
- rules: {
194
- "@typescript-eslint/no-require-imports": "off"
195
- }
196
- },
197
- {
198
- files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
199
- name: "solvro/disables/config-files",
200
- rules: {
201
- "antfu/no-top-level-await": "off",
202
- "no-console": "off",
203
- "@typescript-eslint/explicit-function-return-type": "off"
204
- }
205
- },
206
- {
207
- files: ["**/*.js"],
208
- extends: [import_typescript_eslint.default.configs.disableTypeChecked]
209
- }
210
- ];
211
- }
212
-
213
- // src/eslint/configs/formatters.ts
214
- var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
215
- function formatters() {
216
- return [
217
- {
218
- name: "solvro/prettier",
219
- rules: {
220
- ...import_eslint_config_prettier.default.rules,
221
- curly: "error"
222
- }
223
- }
224
- ];
225
- }
226
-
227
- // src/eslint/configs/ignores.ts
228
- function ignores() {
229
- return [
230
- {
231
- ignores: [...GLOB_EXCLUDE],
232
- name: "solvro/ignores"
233
- }
234
- ];
235
- }
236
-
237
- // src/eslint/configs/imports.ts
238
- function imports(options = { forbidDefaultExport: false }) {
239
- const config = [
240
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
241
- import_eslint_plugin_import.default.flatConfigs.typescript,
242
- {
243
- name: "solvro/imports/rules",
244
- plugins: {
245
- antfu: import_eslint_plugin_antfu.default,
246
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
247
- import: import_eslint_plugin_import.default
248
- },
249
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
250
- rules: {
251
- "antfu/import-dedupe": "error",
252
- "antfu/no-import-dist": "error",
253
- "antfu/no-import-node-modules-by-path": "error",
254
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
255
- ...import_eslint_plugin_import.default.flatConfigs.recommended.rules,
256
- "import/no-dynamic-require": "warn",
257
- "import/no-unresolved": "off",
258
- "import/consistent-type-specifier-style": "warn",
259
- "@typescript-eslint/no-restricted-imports": [
260
- "error",
261
- {
262
- paths: [
263
- {
264
- name: "axios",
265
- message: "Please use fetch instead"
266
- }
267
- ]
268
- }
269
- ]
270
- }
271
- }
272
- ];
273
- if (options.forbidDefaultExport) {
274
- config.push(
275
- {
276
- "import/no-default-export": "error"
277
- },
278
- {
279
- files: [
280
- "tsup.config.*",
281
- "eslint.config.*",
282
- ".commitlintrc.*",
283
- "knip.*",
284
- "next.config.*",
285
- "commitlint.config.*",
286
- ".releaserc.*"
287
- ],
288
- rules: {
289
- "import/no-default-export": "off"
290
- }
291
- }
292
- );
293
- }
294
- return config;
295
- }
296
-
297
- // src/eslint/configs/javascript.ts
298
- var import_js = __toESM(require("@eslint/js"), 1);
299
- var import_globals2 = __toESM(require("globals"), 1);
300
- function javascript() {
301
- return [
302
- {
303
- languageOptions: {
304
- ecmaVersion: 2022,
305
- globals: {
306
- ...import_globals2.default.browser,
307
- ...import_globals2.default.es2021,
308
- ...import_globals2.default.node,
309
- document: "readonly",
310
- navigator: "readonly",
311
- window: "readonly"
312
- },
313
- parserOptions: {
314
- ecmaFeatures: {
315
- jsx: true
316
- },
317
- ecmaVersion: 2022,
318
- sourceType: "module"
319
- },
320
- sourceType: "module"
321
- },
322
- linterOptions: {
323
- reportUnusedDisableDirectives: true
324
- },
325
- name: "solvro/javascript/setup"
326
- },
327
- {
328
- name: "solvro/javascript/rules",
329
- plugins: {
330
- antfu: import_eslint_plugin_antfu.default,
331
- "unused-imports": import_eslint_plugin_unused_imports.default
332
- },
333
- rules: {
334
- ...import_js.default.configs.recommended.rules,
335
- "accessor-pairs": [
336
- "error",
337
- { enforceForClassMembers: true, setWithoutGet: true }
338
- ],
339
- curly: "error",
340
- "array-callback-return": "error",
341
- "block-scoped-var": "error",
342
- "constructor-super": "error",
343
- "default-case-last": "error",
344
- "dot-notation": ["error", { allowKeywords: true }],
345
- eqeqeq: ["error", "smart"],
346
- "new-cap": [
347
- "error",
348
- { capIsNew: false, newIsCap: true, properties: true }
349
- ],
350
- "no-alert": "error",
351
- "no-array-constructor": "error",
352
- "no-async-promise-executor": "error",
353
- "no-caller": "error",
354
- "no-case-declarations": "error",
355
- "no-class-assign": "error",
356
- "no-compare-neg-zero": "error",
357
- "no-cond-assign": ["error", "always"],
358
- "no-console": ["error", { allow: ["warn", "error"] }],
359
- "no-const-assign": "error",
360
- "no-control-regex": "error",
361
- "no-debugger": "error",
362
- "no-delete-var": "error",
363
- "no-dupe-args": "error",
364
- "no-dupe-class-members": "error",
365
- "no-dupe-keys": "error",
366
- "no-duplicate-case": "error",
367
- "no-empty": ["error", { allowEmptyCatch: true }],
368
- "no-empty-character-class": "error",
369
- "no-empty-pattern": "error",
370
- "no-eval": "error",
371
- "no-ex-assign": "error",
372
- "no-extend-native": "error",
373
- "no-extra-bind": "error",
374
- "no-extra-boolean-cast": "error",
375
- "no-fallthrough": "error",
376
- "no-func-assign": "error",
377
- "no-global-assign": "error",
378
- "no-implied-eval": "error",
379
- "no-import-assign": "error",
380
- "no-invalid-regexp": "error",
381
- "no-irregular-whitespace": "error",
382
- "no-iterator": "error",
383
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
384
- "no-lone-blocks": "error",
385
- "no-loss-of-precision": "error",
386
- "no-misleading-character-class": "error",
387
- "no-multi-str": "error",
388
- "no-new": "error",
389
- "no-new-func": "error",
390
- "no-new-native-nonconstructor": "error",
391
- "no-new-wrappers": "error",
392
- "no-obj-calls": "error",
393
- "no-octal": "error",
394
- "no-octal-escape": "error",
395
- "no-proto": "error",
396
- "no-prototype-builtins": "error",
397
- "no-redeclare": ["error", { builtinGlobals: false }],
398
- "no-regex-spaces": "error",
399
- "no-restricted-globals": [
400
- "error",
401
- { message: "Use `globalThis` instead.", name: "global" },
402
- { message: "Use `globalThis` instead.", name: "self" }
403
- ],
404
- "no-restricted-properties": [
405
- "error",
406
- {
407
- message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
408
- property: "__proto__"
409
- },
410
- {
411
- message: "Use `Object.defineProperty` instead.",
412
- property: "__defineGetter__"
413
- },
414
- {
415
- message: "Use `Object.defineProperty` instead.",
416
- property: "__defineSetter__"
417
- },
418
- {
419
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
420
- property: "__lookupGetter__"
421
- },
422
- {
423
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
424
- property: "__lookupSetter__"
425
- }
426
- ],
427
- "no-restricted-syntax": [
428
- "error",
429
- "TSEnumDeclaration[const=true]",
430
- "TSExportAssignment"
431
- ],
432
- "no-self-assign": ["error", { props: true }],
433
- "no-self-compare": "error",
434
- "no-sequences": "error",
435
- "no-shadow-restricted-names": "error",
436
- "no-sparse-arrays": "error",
437
- "no-template-curly-in-string": "error",
438
- "no-this-before-super": "error",
439
- "no-throw-literal": "error",
440
- "no-undef-init": "error",
441
- "no-unexpected-multiline": "error",
442
- "no-unmodified-loop-condition": "error",
443
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
444
- "no-unreachable": "error",
445
- "no-unreachable-loop": "error",
446
- "no-unsafe-finally": "error",
447
- "no-unsafe-negation": "error",
448
- "no-unused-expressions": [
449
- "error",
450
- {
451
- allowShortCircuit: true,
452
- allowTaggedTemplates: true,
453
- allowTernary: true
454
- }
455
- ],
456
- "no-useless-backreference": "error",
457
- "no-useless-call": "error",
458
- "no-useless-catch": "error",
459
- "no-useless-computed-key": "error",
460
- "no-useless-constructor": "error",
461
- "no-useless-rename": "error",
462
- "no-useless-return": "error",
463
- "no-var": "error",
464
- "no-with": "error",
465
- "object-shorthand": [
466
- "error",
467
- "always",
468
- {
469
- avoidQuotes: true,
470
- ignoreConstructors: false
471
- }
472
- ],
473
- "one-var": ["error", { initialized: "never" }],
474
- "prefer-arrow-callback": [
475
- "error",
476
- {
477
- allowNamedFunctions: false,
478
- allowUnboundThis: true
479
- }
480
- ],
481
- "prefer-const": [
482
- "error",
483
- {
484
- destructuring: "all",
485
- ignoreReadBeforeAssign: true
486
- }
487
- ],
488
- "prefer-exponentiation-operator": "error",
489
- "prefer-promise-reject-errors": "error",
490
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
491
- "prefer-rest-params": "error",
492
- "prefer-spread": "error",
493
- "prefer-template": "error",
494
- "symbol-description": "error",
495
- "unicode-bom": ["error", "never"],
496
- "unused-imports/no-unused-imports": "error",
497
- "unused-imports/no-unused-vars": [
498
- "error",
499
- {
500
- args: "after-used",
501
- argsIgnorePattern: "^_",
502
- ignoreRestSiblings: true,
503
- vars: "all",
504
- varsIgnorePattern: "^_"
505
- }
506
- ],
507
- "use-isnan": [
508
- "error",
509
- { enforceForIndexOf: true, enforceForSwitchCase: true }
510
- ],
511
- "valid-typeof": ["error", { requireStringLiterals: true }],
512
- "vars-on-top": "error",
513
- yoda: ["error", "never"]
514
- }
515
- }
516
- ];
517
- }
518
-
519
- // src/eslint/configs/jsdoc.ts
520
- var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
521
- function jsdoc() {
522
- return [
523
- {
524
- name: "solvro/jsdoc/rules",
525
- plugins: {
526
- jsdoc: import_eslint_plugin_jsdoc.default
527
- },
528
- rules: {
529
- "jsdoc/check-access": "warn",
530
- "jsdoc/check-param-names": "warn",
531
- "jsdoc/check-property-names": "warn",
532
- "jsdoc/check-types": "warn",
533
- "jsdoc/empty-tags": "warn",
534
- "jsdoc/implements-on-classes": "warn",
535
- "jsdoc/no-defaults": "warn",
536
- "jsdoc/no-multi-asterisks": "warn",
537
- "jsdoc/require-param-name": "warn",
538
- "jsdoc/require-property": "warn",
539
- "jsdoc/require-property-description": "warn",
540
- "jsdoc/require-property-name": "warn",
541
- "jsdoc/require-returns-check": "warn",
542
- "jsdoc/require-returns-description": "warn",
543
- "jsdoc/require-yields-check": "warn"
544
- }
545
- }
546
- ];
547
- }
548
-
549
- // src/eslint/configs/node.ts
550
- function node() {
551
- return [
552
- {
553
- name: "solvro/node/rules",
554
- plugins: {
555
- node: import_eslint_plugin_n.default
556
- },
557
- rules: {
558
- "node/handle-callback-err": ["error", "^(err|error)$"],
559
- "node/no-deprecated-api": "error",
560
- "node/no-exports-assign": "error",
561
- "node/no-new-require": "error",
562
- "node/no-path-concat": "error",
563
- "node/prefer-global/buffer": ["error"],
564
- "node/prefer-global/process": ["error"],
565
- "node/process-exit-as-throw": "error"
566
- }
567
- }
568
- ];
569
- }
570
-
571
- // src/eslint/configs/react.ts
572
- var import_eslint_plugin_next = __toESM(require("@next/eslint-plugin-next"), 1);
573
- var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
574
- var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
575
- var import_local_pkg = require("local-pkg");
576
- var nextJsPackages = ["next"];
577
- var forbiddenLibraries = [
578
- "@headlessui/react",
579
- "@mui/material",
580
- "@chakra-ui/react",
581
- "@chakra-ui/core",
582
- "@nextui-org/react",
583
- "react-bootstrap",
584
- "antd"
585
- ];
586
- function react() {
587
- const isUsingNext = nextJsPackages.some((index) => (0, import_local_pkg.isPackageExists)(index));
588
- const nextjsConfig2 = [];
589
- if (isUsingNext) {
590
- nextjsConfig2.push(
591
- {
592
- name: "solvro/next/setup",
593
- plugins: {
594
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
595
- "@next/next": import_eslint_plugin_next.default
596
- },
597
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
598
- rules: import_eslint_plugin_next.default.configs.recommended.rules
599
- },
600
- {
601
- files: [
602
- "**/app/**/{page,loading,layout}.{js,jsx,ts,tsx}",
603
- "**/pages/**/*.{js,jsx,ts,tsx}"
604
- ],
605
- name: "solvro/next/pages",
606
- rules: {
607
- "import/no-default-export": "off"
608
- }
609
- }
610
- );
611
- }
612
- return [
613
- {
614
- name: "solvro/react/setup",
615
- plugins: {
616
- // @ts-expect-error ???
617
- react: import_eslint_plugin_react.default,
618
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
619
- "react-hooks": import_eslint_plugin_react_hooks.default
620
- }
621
- },
622
- ...nextjsConfig2,
623
- {
624
- files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
625
- languageOptions: {
626
- parserOptions: {
627
- ecmaFeatures: {
628
- jsx: true
629
- }
630
- },
631
- sourceType: "module"
632
- },
633
- settings: {
634
- react: {
635
- version: "detect"
636
- }
637
- },
638
- name: "solvro/react/rules",
639
- rules: {
640
- ...import_eslint_plugin_react.default.configs.flat?.recommended.rules,
641
- ...import_eslint_plugin_react.default.configs.flat?.["jsx-runtime"].rules,
642
- "react/no-danger": "warn",
643
- "react/jsx-no-leaked-render": "warn",
644
- // recommended rules react-hooks
645
- "react-hooks/exhaustive-deps": "warn",
646
- "react-hooks/rules-of-hooks": "error",
647
- "react/jsx-no-useless-fragment": "error",
648
- "react/function-component-definition": [
649
- "error",
650
- {
651
- unnamedComponents: "arrow-function",
652
- namedComponents: "function-declaration"
653
- }
654
- ],
655
- "react/hook-use-state": [
656
- "error",
657
- {
658
- allowDestructuredState: true
659
- }
660
- ],
661
- "react/no-array-index-key": "warn",
662
- "@typescript-eslint/no-restricted-imports": [
663
- "error",
664
- {
665
- paths: forbiddenLibraries.map((library) => ({
666
- name: library,
667
- message: `Please use ui.shadcn.com components instead.`
668
- }))
669
- }
670
- ]
671
- }
672
- },
673
- {
674
- name: "solvro/react/disables",
675
- files: ["**/components/ui/*.{jsx,tsx}"],
676
- rules: {
677
- "react/prop-types": "off",
678
- "no-shadow": "off",
679
- "@typescript-eslint/no-shadow": "off",
680
- "@typescript-eslint/restrict-template-expressions": "off",
681
- "unicorn/no-document-cookie": "off",
682
- "@typescript-eslint/no-redeclare": "off",
683
- "@typescript-eslint/no-deprecated": "off"
684
- }
685
- }
686
- ];
687
- }
688
-
689
- // src/eslint/configs/typescript-relaxed.ts
690
- var import_typescript_eslint2 = __toESM(require("typescript-eslint"), 1);
691
- function typescriptRelaxed() {
692
- return [
693
- ...import_typescript_eslint2.default.configs.recommendedTypeChecked,
694
- ...import_typescript_eslint2.default.configs.stylisticTypeChecked,
695
- {
696
- name: "solvro/typescript-relaxed/rules",
697
- rules: {
698
- "@typescript-eslint/no-unsafe-return": "off",
699
- "@typescript-eslint/require-await": "off",
700
- "@typescript-eslint/no-misused-promises": [
701
- "error",
702
- {
703
- checksVoidReturn: false
704
- }
705
- ],
706
- "unused-imports/no-unused-vars": "off",
707
- "@typescript-eslint/no-unused-vars": [
708
- "error",
709
- {
710
- args: "all",
711
- argsIgnorePattern: "^_",
712
- destructuredArrayIgnorePattern: "^_",
713
- varsIgnorePattern: "^_",
714
- ignoreRestSiblings: true
715
- }
716
- ],
717
- "@typescript-eslint/no-empty-object-type": "off",
718
- "@typescript-eslint/no-unnecessary-condition": "warn"
719
- }
720
- }
721
- ];
722
- }
723
-
724
- // src/eslint/configs/typescript-strict.ts
725
- var import_typescript_eslint3 = __toESM(require("typescript-eslint"), 1);
726
- function typescriptStrict() {
727
- return [
728
- ...import_typescript_eslint3.default.configs.strictTypeChecked,
729
- ...import_typescript_eslint3.default.configs.stylisticTypeChecked,
730
- {
731
- name: "solvro/typescript-strict/setup",
732
- plugins: {
733
- antfu: import_eslint_plugin_antfu.default
734
- }
735
- },
736
- {
737
- files: ["**/*.{ts,tsx}"],
738
- name: "solvro/typescript-strict/rules",
739
- rules: {
740
- "@typescript-eslint/ban-ts-comment": [
741
- "error",
742
- { "ts-expect-error": "allow-with-description" }
743
- ],
744
- "@typescript-eslint/consistent-type-definitions": [
745
- "error",
746
- "interface"
747
- ],
748
- "@typescript-eslint/consistent-type-imports": [
749
- "error",
750
- {
751
- disallowTypeAnnotations: false,
752
- prefer: "type-imports"
753
- }
754
- ],
755
- "@typescript-eslint/method-signature-style": ["error", "property"],
756
- // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
757
- "@typescript-eslint/no-dupe-class-members": "error",
758
- "@typescript-eslint/no-empty-object-type": [
759
- "error",
760
- { allowInterfaces: "always" }
761
- ],
762
- "@typescript-eslint/no-import-type-side-effects": "error",
763
- "@typescript-eslint/no-redeclare": ["error", { builtinGlobals: false }],
764
- "@typescript-eslint/no-require-imports": "error",
765
- "@typescript-eslint/no-unused-expressions": [
766
- "error",
767
- {
768
- allowShortCircuit: true,
769
- allowTaggedTemplates: true,
770
- allowTernary: true
771
- }
772
- ],
773
- "@typescript-eslint/no-use-before-define": [
774
- "error",
775
- { classes: false, functions: false, variables: true }
776
- ],
777
- "@typescript-eslint/no-wrapper-object-types": "error",
778
- // prevent unnecessary use of void operator
779
- "@typescript-eslint/no-meaningless-void-operator": "error",
780
- // "using non-null assertions cancels the benefits of the strict
781
- // null-checking mode."
782
- // warn when one of the types in union / intersection overrides others
783
- "@typescript-eslint/no-redundant-type-constituents": "warn",
784
- // prevent variables shadowing
785
- "no-shadow": "error",
786
- "@typescript-eslint/no-shadow": "error",
787
- // prevent assignment of this, signals a wrong usage of it
788
- "@typescript-eslint/no-this-alias": "error",
789
- // prevent throwing non-error
790
- "no-throw-literal": "off",
791
- // prevent unnecessary explicitly adding a default type argument
792
- "@typescript-eslint/no-unnecessary-type-arguments": "error",
793
- // prevent unnecessary assertions that won't change the outcome
794
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
795
- // prevent extending default types
796
- "@typescript-eslint/no-unnecessary-type-constraint": "error",
797
- // force typing out function arguments
798
- "@typescript-eslint/no-unsafe-argument": "error",
799
- // prevent usage of any via reassigning
800
- "@typescript-eslint/no-unsafe-assignment": "error",
801
- // prevent usage of any via calling it
802
- "@typescript-eslint/no-unsafe-call": "error",
803
- // prevent usage of any via using it's members
804
- "@typescript-eslint/no-unsafe-member-access": "error",
805
- // prevent reverting any from functions
806
- "@typescript-eslint/no-unsafe-return": "error",
807
- // prevent unused expressions
808
- "no-unused-expressions": "off",
809
- // var<'string'> = 'string' -> var = 'string' as const
810
- "@typescript-eslint/prefer-as-const": "error",
811
- // force initializing enums
812
- "@typescript-eslint/prefer-enum-initializers": "error",
813
- // prefer for x of obj to for let i = 0...
814
- "@typescript-eslint/prefer-for-of": "error",
815
- // prefer includes() to indexOf()
816
- "@typescript-eslint/prefer-includes": "error",
817
- // use literals for enum initialization
818
- "@typescript-eslint/prefer-literal-enum-member": "error",
819
- // prefer safe cascade of a value when dealing with undefined or null
820
- "@typescript-eslint/prefer-nullish-coalescing": "error",
821
- // prefer optional chaining (a?.b)
822
- "@typescript-eslint/prefer-optional-chain": "error",
823
- // prefer using type parameter for Array.reduce
824
- "@typescript-eslint/prefer-reduce-type-parameter": "error",
825
- // prefer RegExp#exec when no /g flag in regex
826
- "@typescript-eslint/prefer-regexp-exec": "error",
827
- // enforce `this` as a type when stating type for a method
828
- "@typescript-eslint/prefer-return-this-type": "error",
829
- // enforce startsWith to indexOf === 0
830
- "@typescript-eslint/prefer-string-starts-ends-with": "error",
831
- // prevents default behavior of .sort() - which is confusing
832
- "@typescript-eslint/require-array-sort-compare": "error",
833
- // no async functions without awaits in body
834
- "require-await": "off",
835
- "@typescript-eslint/require-await": "error",
836
- // prevent number + string
837
- "@typescript-eslint/restrict-plus-operands": "error",
838
- // only allow string in templates
839
- "@typescript-eslint/restrict-template-expressions": "error",
840
- // prevent returning await
841
- "no-return-await": "off",
842
- "@typescript-eslint/return-await": "error",
843
- // only booleans in ifs and whiles
844
- "@typescript-eslint/strict-boolean-expressions": "error",
845
- // check if all paths are followed in code
846
- "@typescript-eslint/switch-exhaustiveness-check": "error",
847
- "dot-notation": "off",
848
- "no-implied-eval": "off",
849
- "@typescript-eslint/await-thenable": "error",
850
- "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
851
- "@typescript-eslint/no-floating-promises": "error",
852
- "@typescript-eslint/no-for-in-array": "error",
853
- "@typescript-eslint/no-implied-eval": "error",
854
- "@typescript-eslint/no-misused-promises": "error",
855
- "@typescript-eslint/promise-function-async": "error",
856
- "@typescript-eslint/unbound-method": "error",
857
- "no-restricted-imports": "off"
858
- }
859
- }
860
- ];
861
- }
862
-
863
- // src/eslint/configs/unicorn.ts
864
- function unicorn() {
865
- return [
866
- {
867
- name: "solvro/unicorn/rules",
868
- plugins: {
869
- unicorn: import_eslint_plugin_unicorn.default
870
- },
871
- rules: {
872
- ...import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules,
873
- "unicorn/no-array-reduce": "off",
874
- "unicorn/no-null": "off",
875
- "unicorn/no-useless-switch-case": "off",
876
- "unicorn/prefer-global-this": "off",
877
- "unicorn/prevent-abbreviations": [
878
- "error",
879
- {
880
- replacements: {
881
- env: false,
882
- envs: false,
883
- props: false,
884
- prop: false,
885
- ref: false
886
- }
887
- }
888
- ]
889
- }
890
- }
891
- ];
892
- }
893
-
894
- // src/eslint/index.ts
895
- var builtinAdonisConfig = (0, import_eslint_config.configApp)();
896
- var adonisConfig = [
897
- ...builtinAdonisConfig,
898
- ...node(),
899
- ...imports(),
900
- {
901
- rules: {
902
- "@typescript-eslint/naming-convention": [
903
- "error",
904
- {
905
- selector: ["enum", "enumMember", "class", "interface", "typeLike"],
906
- format: ["PascalCase"]
907
- },
908
- {
909
- selector: ["classProperty", "classMethod", "method", "variableLike"],
910
- format: ["camelCase"]
911
- },
912
- {
913
- selector: "variable",
914
- format: ["camelCase", "UPPER_CASE", "PascalCase"],
915
- leadingUnderscore: "allow",
916
- trailingUnderscore: "allow"
917
- }
918
- ]
919
- }
920
- }
921
- ];
922
- var nextjsConfig = [
923
- ...a11y(),
924
- ...unicorn(),
925
- ...typescriptStrict(),
926
- ...react(),
927
- ...imports({ forbidDefaultExport: true })
928
- ];
929
- var configs = [
930
- ...javascript(),
931
- ...jsdoc(),
932
- ...comments(),
933
- ...typescriptRelaxed()
934
- ];
935
- var defaultOverrides = [...ignores(), ...formatters(), ...disables()];
936
- var solvro = (...overrides) => {
937
- const isAdonis = (0, import_local_pkg2.isPackageExists)("@adonisjs/core");
938
- const isNext = (0, import_local_pkg2.isPackageExists)("next");
939
- if (isNext && isAdonis) {
940
- throw new Error(
941
- "You can't use both Adonis and Next.js in the same project"
942
- );
943
- }
944
- const newConfig = [];
945
- if (isAdonis) {
946
- newConfig.push(...adonisConfig);
947
- }
948
- if (isNext) {
949
- newConfig.push(...nextjsConfig);
950
- }
951
- const tsConfigPath = (0, import_find_up_simple.findUpSync)("tsconfig.json", {
952
- cwd: process.cwd()
953
- });
954
- if (tsConfigPath == null) {
955
- throw new Error("No tsconfig.json found");
956
- }
957
- const rootDirectory = import_node_path.default.dirname(tsConfigPath);
958
- configs.push({
959
- languageOptions: {
960
- parserOptions: {
961
- projectService: true,
962
- tsconfigRootDir: rootDirectory
963
- }
964
- }
965
- });
966
- return import_typescript_eslint4.default.config(
967
- ...configs,
968
- ...newConfig,
969
- ...defaultOverrides,
970
- ...overrides
971
- );
972
- };
973
- // Annotate the CommonJS export names for ESM import in node:
974
- 0 && (module.exports = {
975
- solvro
976
- });
977
- //# sourceMappingURL=index.cjs.map