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