@solvro/config 1.1.0 → 1.2.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.
- package/dist/{chunk-62DEEFN2.js → chunk-HPR44PFE.js} +2 -8
- package/dist/chunk-HPR44PFE.js.map +1 -0
- package/dist/eslint-config/index.cjs +153 -717
- package/dist/eslint-config/index.cjs.map +1 -0
- package/dist/eslint-config/index.d.cts +4 -9886
- package/dist/eslint-config/index.d.ts +4 -9886
- package/dist/eslint-config/index.js +361 -662
- package/dist/eslint-config/index.js.map +1 -0
- package/dist/prettier-config/index.cjs +1 -0
- package/dist/prettier-config/index.cjs.map +1 -0
- package/dist/prettier-config/index.js +2 -1
- package/dist/prettier-config/index.js.map +1 -0
- package/package.json +10 -9
- package/dist/eslint-config/cli.cjs +0 -5583
- package/dist/eslint-config/cli.d.cts +0 -2
- package/dist/eslint-config/cli.d.ts +0 -2
- package/dist/eslint-config/cli.js +0 -5547
- package/dist/eslint-config-prettier-ZT22JTBW.js +0 -217
@@ -1,29 +1,225 @@
|
|
1
1
|
import {
|
2
|
+
__commonJS,
|
3
|
+
__toESM,
|
2
4
|
init_esm_shims
|
3
|
-
} from "../chunk-
|
5
|
+
} from "../chunk-HPR44PFE.js";
|
4
6
|
|
5
|
-
// eslint-config/index.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
init_esm_shims();
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
// node_modules/eslint-config-prettier/index.js
|
8
|
+
var require_eslint_config_prettier = __commonJS({
|
9
|
+
"node_modules/eslint-config-prettier/index.js"(exports, module) {
|
10
|
+
"use strict";
|
11
|
+
init_esm_shims();
|
12
|
+
var includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;
|
13
|
+
var specialRule = 0;
|
14
|
+
module.exports = {
|
15
|
+
rules: {
|
16
|
+
// The following rules can be used in some cases. See the README for more
|
17
|
+
// information. These are marked with `0` instead of `"off"` so that a
|
18
|
+
// script can distinguish them. Note that there are a few more of these
|
19
|
+
// in the deprecated section below.
|
20
|
+
"curly": specialRule,
|
21
|
+
"no-unexpected-multiline": specialRule,
|
22
|
+
"@typescript-eslint/lines-around-comment": specialRule,
|
23
|
+
"@typescript-eslint/quotes": specialRule,
|
24
|
+
"babel/quotes": specialRule,
|
25
|
+
"unicorn/template-indent": specialRule,
|
26
|
+
"vue/html-self-closing": specialRule,
|
27
|
+
"vue/max-len": specialRule,
|
28
|
+
// The rest are rules that you never need to enable when using Prettier.
|
29
|
+
"@babel/object-curly-spacing": "off",
|
30
|
+
"@babel/semi": "off",
|
31
|
+
"@typescript-eslint/block-spacing": "off",
|
32
|
+
"@typescript-eslint/brace-style": "off",
|
33
|
+
"@typescript-eslint/comma-dangle": "off",
|
34
|
+
"@typescript-eslint/comma-spacing": "off",
|
35
|
+
"@typescript-eslint/func-call-spacing": "off",
|
36
|
+
"@typescript-eslint/indent": "off",
|
37
|
+
"@typescript-eslint/key-spacing": "off",
|
38
|
+
"@typescript-eslint/keyword-spacing": "off",
|
39
|
+
"@typescript-eslint/member-delimiter-style": "off",
|
40
|
+
"@typescript-eslint/no-extra-parens": "off",
|
41
|
+
"@typescript-eslint/no-extra-semi": "off",
|
42
|
+
"@typescript-eslint/object-curly-spacing": "off",
|
43
|
+
"@typescript-eslint/semi": "off",
|
44
|
+
"@typescript-eslint/space-before-blocks": "off",
|
45
|
+
"@typescript-eslint/space-before-function-paren": "off",
|
46
|
+
"@typescript-eslint/space-infix-ops": "off",
|
47
|
+
"@typescript-eslint/type-annotation-spacing": "off",
|
48
|
+
"babel/object-curly-spacing": "off",
|
49
|
+
"babel/semi": "off",
|
50
|
+
"flowtype/boolean-style": "off",
|
51
|
+
"flowtype/delimiter-dangle": "off",
|
52
|
+
"flowtype/generic-spacing": "off",
|
53
|
+
"flowtype/object-type-curly-spacing": "off",
|
54
|
+
"flowtype/object-type-delimiter": "off",
|
55
|
+
"flowtype/quotes": "off",
|
56
|
+
"flowtype/semi": "off",
|
57
|
+
"flowtype/space-after-type-colon": "off",
|
58
|
+
"flowtype/space-before-generic-bracket": "off",
|
59
|
+
"flowtype/space-before-type-colon": "off",
|
60
|
+
"flowtype/union-intersection-spacing": "off",
|
61
|
+
"react/jsx-child-element-spacing": "off",
|
62
|
+
"react/jsx-closing-bracket-location": "off",
|
63
|
+
"react/jsx-closing-tag-location": "off",
|
64
|
+
"react/jsx-curly-newline": "off",
|
65
|
+
"react/jsx-curly-spacing": "off",
|
66
|
+
"react/jsx-equals-spacing": "off",
|
67
|
+
"react/jsx-first-prop-new-line": "off",
|
68
|
+
"react/jsx-indent": "off",
|
69
|
+
"react/jsx-indent-props": "off",
|
70
|
+
"react/jsx-max-props-per-line": "off",
|
71
|
+
"react/jsx-newline": "off",
|
72
|
+
"react/jsx-one-expression-per-line": "off",
|
73
|
+
"react/jsx-props-no-multi-spaces": "off",
|
74
|
+
"react/jsx-tag-spacing": "off",
|
75
|
+
"react/jsx-wrap-multilines": "off",
|
76
|
+
"standard/array-bracket-even-spacing": "off",
|
77
|
+
"standard/computed-property-even-spacing": "off",
|
78
|
+
"standard/object-curly-even-spacing": "off",
|
79
|
+
"unicorn/empty-brace-spaces": "off",
|
80
|
+
"unicorn/no-nested-ternary": "off",
|
81
|
+
"unicorn/number-literal-case": "off",
|
82
|
+
"vue/array-bracket-newline": "off",
|
83
|
+
"vue/array-bracket-spacing": "off",
|
84
|
+
"vue/array-element-newline": "off",
|
85
|
+
"vue/arrow-spacing": "off",
|
86
|
+
"vue/block-spacing": "off",
|
87
|
+
"vue/block-tag-newline": "off",
|
88
|
+
"vue/brace-style": "off",
|
89
|
+
"vue/comma-dangle": "off",
|
90
|
+
"vue/comma-spacing": "off",
|
91
|
+
"vue/comma-style": "off",
|
92
|
+
"vue/dot-location": "off",
|
93
|
+
"vue/func-call-spacing": "off",
|
94
|
+
"vue/html-closing-bracket-newline": "off",
|
95
|
+
"vue/html-closing-bracket-spacing": "off",
|
96
|
+
"vue/html-end-tags": "off",
|
97
|
+
"vue/html-indent": "off",
|
98
|
+
"vue/html-quotes": "off",
|
99
|
+
"vue/key-spacing": "off",
|
100
|
+
"vue/keyword-spacing": "off",
|
101
|
+
"vue/max-attributes-per-line": "off",
|
102
|
+
"vue/multiline-html-element-content-newline": "off",
|
103
|
+
"vue/multiline-ternary": "off",
|
104
|
+
"vue/mustache-interpolation-spacing": "off",
|
105
|
+
"vue/no-extra-parens": "off",
|
106
|
+
"vue/no-multi-spaces": "off",
|
107
|
+
"vue/no-spaces-around-equal-signs-in-attribute": "off",
|
108
|
+
"vue/object-curly-newline": "off",
|
109
|
+
"vue/object-curly-spacing": "off",
|
110
|
+
"vue/object-property-newline": "off",
|
111
|
+
"vue/operator-linebreak": "off",
|
112
|
+
"vue/quote-props": "off",
|
113
|
+
"vue/script-indent": "off",
|
114
|
+
"vue/singleline-html-element-content-newline": "off",
|
115
|
+
"vue/space-in-parens": "off",
|
116
|
+
"vue/space-infix-ops": "off",
|
117
|
+
"vue/space-unary-ops": "off",
|
118
|
+
"vue/template-curly-spacing": "off",
|
119
|
+
...includeDeprecated && {
|
120
|
+
// Removed in version 0.10.0.
|
121
|
+
// https://eslint.org/docs/latest/rules/space-unary-word-ops
|
122
|
+
"space-unary-word-ops": "off",
|
123
|
+
// Removed in version 1.0.0.
|
124
|
+
// https://github.com/eslint/eslint/issues/1898
|
125
|
+
"generator-star": "off",
|
126
|
+
"no-comma-dangle": "off",
|
127
|
+
"no-reserved-keys": "off",
|
128
|
+
"no-space-before-semi": "off",
|
129
|
+
"no-wrap-func": "off",
|
130
|
+
"space-after-function-name": "off",
|
131
|
+
"space-before-function-parentheses": "off",
|
132
|
+
"space-in-brackets": "off",
|
133
|
+
// Removed in version 2.0.0.
|
134
|
+
// https://github.com/eslint/eslint/issues/5032
|
135
|
+
"no-arrow-condition": "off",
|
136
|
+
"space-after-keywords": "off",
|
137
|
+
"space-before-keywords": "off",
|
138
|
+
"space-return-throw-case": "off",
|
139
|
+
// Deprecated since version 3.3.0.
|
140
|
+
// https://eslint.org/docs/rules/no-spaced-func
|
141
|
+
"no-spaced-func": "off",
|
142
|
+
// Deprecated since version 4.0.0.
|
143
|
+
// https://github.com/eslint/eslint/pull/8286
|
144
|
+
"indent-legacy": "off",
|
145
|
+
// Deprecated since version 8.53.0.
|
146
|
+
// https://eslint.org/blog/2023/10/deprecating-formatting-rules/
|
147
|
+
"array-bracket-newline": "off",
|
148
|
+
"array-bracket-spacing": "off",
|
149
|
+
"array-element-newline": "off",
|
150
|
+
"arrow-parens": "off",
|
151
|
+
"arrow-spacing": "off",
|
152
|
+
"block-spacing": "off",
|
153
|
+
"brace-style": "off",
|
154
|
+
"comma-dangle": "off",
|
155
|
+
"comma-spacing": "off",
|
156
|
+
"comma-style": "off",
|
157
|
+
"computed-property-spacing": "off",
|
158
|
+
"dot-location": "off",
|
159
|
+
"eol-last": "off",
|
160
|
+
"func-call-spacing": "off",
|
161
|
+
"function-call-argument-newline": "off",
|
162
|
+
"function-paren-newline": "off",
|
163
|
+
"generator-star-spacing": "off",
|
164
|
+
"implicit-arrow-linebreak": "off",
|
165
|
+
"indent": "off",
|
166
|
+
"jsx-quotes": "off",
|
167
|
+
"key-spacing": "off",
|
168
|
+
"keyword-spacing": "off",
|
169
|
+
"linebreak-style": "off",
|
170
|
+
"lines-around-comment": specialRule,
|
171
|
+
"max-len": specialRule,
|
172
|
+
"max-statements-per-line": "off",
|
173
|
+
"multiline-ternary": "off",
|
174
|
+
"new-parens": "off",
|
175
|
+
"newline-per-chained-call": "off",
|
176
|
+
"no-confusing-arrow": specialRule,
|
177
|
+
"no-extra-parens": "off",
|
178
|
+
"no-extra-semi": "off",
|
179
|
+
"no-floating-decimal": "off",
|
180
|
+
"no-mixed-operators": specialRule,
|
181
|
+
"no-mixed-spaces-and-tabs": "off",
|
182
|
+
"no-multi-spaces": "off",
|
183
|
+
"no-multiple-empty-lines": "off",
|
184
|
+
"no-tabs": specialRule,
|
185
|
+
"no-trailing-spaces": "off",
|
186
|
+
"no-whitespace-before-property": "off",
|
187
|
+
"nonblock-statement-body-position": "off",
|
188
|
+
"object-curly-newline": "off",
|
189
|
+
"object-curly-spacing": "off",
|
190
|
+
"object-property-newline": "off",
|
191
|
+
"one-var-declaration-per-line": "off",
|
192
|
+
"operator-linebreak": "off",
|
193
|
+
"padded-blocks": "off",
|
194
|
+
"quote-props": "off",
|
195
|
+
"quotes": specialRule,
|
196
|
+
"rest-spread-spacing": "off",
|
197
|
+
"semi": "off",
|
198
|
+
"semi-spacing": "off",
|
199
|
+
"semi-style": "off",
|
200
|
+
"space-before-blocks": "off",
|
201
|
+
"space-before-function-paren": "off",
|
202
|
+
"space-in-parens": "off",
|
203
|
+
"space-infix-ops": "off",
|
204
|
+
"space-unary-ops": "off",
|
205
|
+
"switch-colon-spacing": "off",
|
206
|
+
"template-curly-spacing": "off",
|
207
|
+
"template-tag-spacing": "off",
|
208
|
+
"wrap-iife": "off",
|
209
|
+
"wrap-regex": "off",
|
210
|
+
"yield-star-spacing": "off",
|
211
|
+
// Deprecated since version 7.0.0.
|
212
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
|
213
|
+
"react/jsx-space-before-closing": "off"
|
214
|
+
}
|
215
|
+
}
|
216
|
+
};
|
217
|
+
}
|
218
|
+
});
|
15
219
|
|
16
|
-
// eslint-config/
|
220
|
+
// eslint-config/index.ts
|
17
221
|
init_esm_shims();
|
18
|
-
import
|
19
|
-
async function command() {
|
20
|
-
return [
|
21
|
-
{
|
22
|
-
...createCommand(),
|
23
|
-
name: "solvro/command/rules"
|
24
|
-
}
|
25
|
-
];
|
26
|
-
}
|
222
|
+
import tseslint2 from "typescript-eslint";
|
27
223
|
|
28
224
|
// eslint-config/configs/comments.ts
|
29
225
|
init_esm_shims();
|
@@ -39,11 +235,12 @@ import { default as default6 } from "eslint-plugin-unicorn";
|
|
39
235
|
import { default as default7 } from "eslint-plugin-unused-imports";
|
40
236
|
|
41
237
|
// eslint-config/configs/comments.ts
|
42
|
-
|
238
|
+
function comments() {
|
43
239
|
return [
|
44
240
|
{
|
45
241
|
name: "solvro/eslint-comments/rules",
|
46
242
|
plugins: {
|
243
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
47
244
|
"eslint-comments": default2
|
48
245
|
},
|
49
246
|
rules: {
|
@@ -63,19 +260,7 @@ init_esm_shims();
|
|
63
260
|
init_esm_shims();
|
64
261
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
65
262
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
66
|
-
var GLOB_JS = "**/*.?([cm])js";
|
67
|
-
var GLOB_JSX = "**/*.?([cm])jsx";
|
68
|
-
var GLOB_TS = "**/*.?([cm])ts";
|
69
|
-
var GLOB_TSX = "**/*.?([cm])tsx";
|
70
|
-
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
71
|
-
var GLOB_JSON = "**/*.json";
|
72
|
-
var GLOB_JSON5 = "**/*.json5";
|
73
263
|
var GLOB_MARKDOWN = "**/*.md";
|
74
|
-
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
75
|
-
var GLOB_TOML = "**/*.toml";
|
76
|
-
var GLOB_XML = "**/*.xml";
|
77
|
-
var GLOB_SVG = "**/*.svg";
|
78
|
-
var GLOB_HTML = "**/*.htm?(l)";
|
79
264
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
80
265
|
var GLOB_TESTS = [
|
81
266
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
@@ -84,15 +269,6 @@ var GLOB_TESTS = [
|
|
84
269
|
`**/*.bench.${GLOB_SRC_EXT}`,
|
85
270
|
`**/*.benchmark.${GLOB_SRC_EXT}`
|
86
271
|
];
|
87
|
-
var GLOB_ALL_SRC = [
|
88
|
-
GLOB_SRC,
|
89
|
-
GLOB_STYLE,
|
90
|
-
GLOB_JSON,
|
91
|
-
GLOB_JSON5,
|
92
|
-
GLOB_MARKDOWN,
|
93
|
-
GLOB_XML,
|
94
|
-
GLOB_HTML
|
95
|
-
];
|
96
272
|
var GLOB_EXCLUDE = [
|
97
273
|
"**/node_modules",
|
98
274
|
"**/dist",
|
@@ -128,7 +304,7 @@ var GLOB_EXCLUDE = [
|
|
128
304
|
];
|
129
305
|
|
130
306
|
// eslint-config/configs/disables.ts
|
131
|
-
|
307
|
+
function disables() {
|
132
308
|
return [
|
133
309
|
{
|
134
310
|
files: [`**/scripts/${GLOB_SRC}`],
|
@@ -186,86 +362,22 @@ async function disables() {
|
|
186
362
|
|
187
363
|
// eslint-config/configs/formatters.ts
|
188
364
|
init_esm_shims();
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
196
|
-
var isCwdInScope = isPackageExists("@solvro/config");
|
197
|
-
var parserPlain = {
|
198
|
-
meta: {
|
199
|
-
name: "parser-plain"
|
200
|
-
},
|
201
|
-
parseForESLint: (code) => ({
|
202
|
-
ast: {
|
203
|
-
body: [],
|
204
|
-
comments: [],
|
205
|
-
loc: { end: code.length, start: 0 },
|
206
|
-
range: [0, code.length],
|
207
|
-
tokens: [],
|
208
|
-
type: "Program"
|
209
|
-
},
|
210
|
-
scopeManager: null,
|
211
|
-
services: { isPlain: true },
|
212
|
-
visitorKeys: {
|
213
|
-
Program: []
|
365
|
+
var import_eslint_config_prettier = __toESM(require_eslint_config_prettier(), 1);
|
366
|
+
function formatters() {
|
367
|
+
return [
|
368
|
+
{
|
369
|
+
name: "solvro/prettier",
|
370
|
+
...import_eslint_config_prettier.default
|
214
371
|
}
|
215
|
-
|
216
|
-
};
|
217
|
-
async function combine(...configs2) {
|
218
|
-
const resolved = await Promise.all(configs2);
|
219
|
-
return resolved.flat();
|
220
|
-
}
|
221
|
-
function toArray(value) {
|
222
|
-
return Array.isArray(value) ? value : [value];
|
223
|
-
}
|
224
|
-
async function interopDefault(m) {
|
225
|
-
const resolved = await m;
|
226
|
-
return resolved.default || resolved;
|
227
|
-
}
|
228
|
-
function isPackageInScope(name) {
|
229
|
-
return isPackageExists(name, { paths: [scopeUrl] });
|
230
|
-
}
|
231
|
-
async function ensurePackages(packages) {
|
232
|
-
if (process.env.CI || process.stdout.isTTY === false || isCwdInScope === false)
|
233
|
-
return;
|
234
|
-
const nonExistingPackages = packages.filter(
|
235
|
-
(i) => i && !isPackageInScope(i)
|
236
|
-
);
|
237
|
-
if (nonExistingPackages.length === 0) return;
|
238
|
-
const p = await import("@clack/prompts");
|
239
|
-
const result = await p.confirm({
|
240
|
-
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
|
241
|
-
});
|
242
|
-
if (result)
|
243
|
-
await import("@antfu/install-pkg").then(
|
244
|
-
(i) => i.installPackage(nonExistingPackages, { dev: true })
|
245
|
-
);
|
246
|
-
}
|
247
|
-
function isInEditorEnv() {
|
248
|
-
if (process.env.CI) return false;
|
249
|
-
if (isInGitHooksOrLintStaged()) return false;
|
250
|
-
return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
|
251
|
-
}
|
252
|
-
function isInGitHooksOrLintStaged() {
|
253
|
-
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
254
|
-
}
|
255
|
-
|
256
|
-
// eslint-config/configs/formatters.ts
|
257
|
-
async function formatters() {
|
258
|
-
await ensurePackages(["eslint-plugin-prettier"]);
|
259
|
-
const prettierConfig = await interopDefault(import("../eslint-config-prettier-ZT22JTBW.js"));
|
260
|
-
return [prettierConfig];
|
372
|
+
];
|
261
373
|
}
|
262
374
|
|
263
375
|
// eslint-config/configs/ignores.ts
|
264
376
|
init_esm_shims();
|
265
|
-
|
377
|
+
function ignores() {
|
266
378
|
return [
|
267
379
|
{
|
268
|
-
ignores: [...GLOB_EXCLUDE
|
380
|
+
ignores: [...GLOB_EXCLUDE],
|
269
381
|
name: "solvro/ignores"
|
270
382
|
}
|
271
383
|
];
|
@@ -273,12 +385,13 @@ async function ignores(userIgnores = []) {
|
|
273
385
|
|
274
386
|
// eslint-config/configs/imports.ts
|
275
387
|
init_esm_shims();
|
276
|
-
|
388
|
+
function imports() {
|
277
389
|
return [
|
278
390
|
{
|
279
391
|
name: "solvro/imports/rules",
|
280
392
|
plugins: {
|
281
393
|
antfu: default3,
|
394
|
+
// @ts-expect-error ???
|
282
395
|
"import-x": pluginImport
|
283
396
|
},
|
284
397
|
rules: {
|
@@ -298,9 +411,9 @@ async function imports() {
|
|
298
411
|
|
299
412
|
// eslint-config/configs/javascript.ts
|
300
413
|
init_esm_shims();
|
414
|
+
import eslint from "@eslint/js";
|
301
415
|
import globals from "globals";
|
302
|
-
|
303
|
-
const { isInEditor = false, overrides = {} } = options;
|
416
|
+
function javascript() {
|
304
417
|
return [
|
305
418
|
{
|
306
419
|
languageOptions: {
|
@@ -334,6 +447,7 @@ async function javascript(options = {}) {
|
|
334
447
|
"unused-imports": default7
|
335
448
|
},
|
336
449
|
rules: {
|
450
|
+
...eslint.configs.recommended.rules,
|
337
451
|
"accessor-pairs": [
|
338
452
|
"error",
|
339
453
|
{ enforceForClassMembers: true, setWithoutGet: true }
|
@@ -509,7 +623,7 @@ async function javascript(options = {}) {
|
|
509
623
|
"prefer-template": "error",
|
510
624
|
"symbol-description": "error",
|
511
625
|
"unicode-bom": ["error", "never"],
|
512
|
-
"unused-imports/no-unused-imports":
|
626
|
+
"unused-imports/no-unused-imports": "error",
|
513
627
|
"unused-imports/no-unused-vars": [
|
514
628
|
"error",
|
515
629
|
{
|
@@ -526,8 +640,7 @@ async function javascript(options = {}) {
|
|
526
640
|
],
|
527
641
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
528
642
|
"vars-on-top": "error",
|
529
|
-
yoda: ["error", "never"]
|
530
|
-
...overrides
|
643
|
+
yoda: ["error", "never"]
|
531
644
|
}
|
532
645
|
}
|
533
646
|
];
|
@@ -535,12 +648,13 @@ async function javascript(options = {}) {
|
|
535
648
|
|
536
649
|
// eslint-config/configs/jsdoc.ts
|
537
650
|
init_esm_shims();
|
538
|
-
|
651
|
+
import jsdocPlugin from "eslint-plugin-jsdoc";
|
652
|
+
function jsdoc() {
|
539
653
|
return [
|
540
654
|
{
|
541
655
|
name: "solvro/jsdoc/rules",
|
542
656
|
plugins: {
|
543
|
-
jsdoc:
|
657
|
+
jsdoc: jsdocPlugin
|
544
658
|
},
|
545
659
|
rules: {
|
546
660
|
"jsdoc/check-access": "warn",
|
@@ -563,105 +677,9 @@ async function jsdoc() {
|
|
563
677
|
];
|
564
678
|
}
|
565
679
|
|
566
|
-
// eslint-config/configs/jsx.ts
|
567
|
-
init_esm_shims();
|
568
|
-
async function jsx() {
|
569
|
-
return [
|
570
|
-
{
|
571
|
-
files: [GLOB_JSX, GLOB_TSX],
|
572
|
-
languageOptions: {
|
573
|
-
parserOptions: {
|
574
|
-
ecmaFeatures: {
|
575
|
-
jsx: true
|
576
|
-
}
|
577
|
-
}
|
578
|
-
},
|
579
|
-
name: "solvro/jsx/setup"
|
580
|
-
}
|
581
|
-
];
|
582
|
-
}
|
583
|
-
|
584
|
-
// eslint-config/configs/markdown.ts
|
585
|
-
init_esm_shims();
|
586
|
-
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
587
|
-
async function markdown(options = {}) {
|
588
|
-
const {
|
589
|
-
componentExts = [],
|
590
|
-
files = [GLOB_MARKDOWN],
|
591
|
-
overrides = {}
|
592
|
-
} = options;
|
593
|
-
const markdown2 = await interopDefault(import("@eslint/markdown"));
|
594
|
-
return [
|
595
|
-
{
|
596
|
-
name: "solvro/markdown/setup",
|
597
|
-
plugins: {
|
598
|
-
markdown: markdown2
|
599
|
-
}
|
600
|
-
},
|
601
|
-
{
|
602
|
-
files,
|
603
|
-
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
604
|
-
name: "solvro/markdown/processor",
|
605
|
-
// `eslint-plugin-markdown` only creates virtual files for code blocks,
|
606
|
-
// but not the markdown file itself. We use `eslint-merge-processors` to
|
607
|
-
// add a pass-through processor for the markdown file itself.
|
608
|
-
processor: mergeProcessors([
|
609
|
-
markdown2.processors.markdown,
|
610
|
-
processorPassThrough
|
611
|
-
])
|
612
|
-
},
|
613
|
-
{
|
614
|
-
files,
|
615
|
-
languageOptions: {
|
616
|
-
parser: parserPlain
|
617
|
-
},
|
618
|
-
name: "solvro/markdown/parser"
|
619
|
-
},
|
620
|
-
{
|
621
|
-
files: [
|
622
|
-
GLOB_MARKDOWN_CODE,
|
623
|
-
...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
624
|
-
],
|
625
|
-
languageOptions: {
|
626
|
-
parserOptions: {
|
627
|
-
ecmaFeatures: {
|
628
|
-
impliedStrict: true
|
629
|
-
}
|
630
|
-
}
|
631
|
-
},
|
632
|
-
name: "solvro/markdown/disables",
|
633
|
-
rules: {
|
634
|
-
"antfu/no-top-level-await": "off",
|
635
|
-
"no-alert": "off",
|
636
|
-
"no-console": "off",
|
637
|
-
"no-labels": "off",
|
638
|
-
"no-lone-blocks": "off",
|
639
|
-
"no-restricted-syntax": "off",
|
640
|
-
"no-undef": "off",
|
641
|
-
"no-unused-expressions": "off",
|
642
|
-
"no-unused-labels": "off",
|
643
|
-
"no-unused-vars": "off",
|
644
|
-
"node/prefer-global/process": "off",
|
645
|
-
"@typescript-eslint/consistent-type-imports": "off",
|
646
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
647
|
-
"@typescript-eslint/no-namespace": "off",
|
648
|
-
"@typescript-eslint/no-redeclare": "off",
|
649
|
-
"@typescript-eslint/no-require-imports": "off",
|
650
|
-
"@typescript-eslint/no-unused-expressions": "off",
|
651
|
-
"@typescript-eslint/no-unused-vars": "off",
|
652
|
-
"@typescript-eslint/no-use-before-define": "off",
|
653
|
-
"unicode-bom": "off",
|
654
|
-
"unused-imports/no-unused-imports": "off",
|
655
|
-
"unused-imports/no-unused-vars": "off",
|
656
|
-
...overrides
|
657
|
-
}
|
658
|
-
}
|
659
|
-
];
|
660
|
-
}
|
661
|
-
|
662
680
|
// eslint-config/configs/node.ts
|
663
681
|
init_esm_shims();
|
664
|
-
|
682
|
+
function node() {
|
665
683
|
return [
|
666
684
|
{
|
667
685
|
name: "solvro/node/rules",
|
@@ -684,46 +702,23 @@ async function node() {
|
|
684
702
|
|
685
703
|
// eslint-config/configs/react.ts
|
686
704
|
init_esm_shims();
|
687
|
-
import
|
688
|
-
|
705
|
+
import nextPlugin from "@next/eslint-plugin-next";
|
706
|
+
import pluginReact from "eslint-plugin-react";
|
707
|
+
import pluginReactHooks from "eslint-plugin-react-hooks";
|
708
|
+
import pluginReactRefresh from "eslint-plugin-react-refresh";
|
709
|
+
import { isPackageExists } from "local-pkg";
|
689
710
|
var NextJsPackages = ["next"];
|
690
|
-
|
691
|
-
const
|
692
|
-
files = [GLOB_SRC],
|
693
|
-
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
694
|
-
ignoresTypeAware = [`${GLOB_MARKDOWN}/**`],
|
695
|
-
overrides = {},
|
696
|
-
tsconfigPath
|
697
|
-
} = options;
|
698
|
-
await ensurePackages([
|
699
|
-
"eslint-plugin-react",
|
700
|
-
"eslint-plugin-react-hooks",
|
701
|
-
"eslint-plugin-react-refresh"
|
702
|
-
]);
|
703
|
-
const isTypeAware = !!tsconfigPath;
|
704
|
-
const typeAwareRules = {
|
705
|
-
"react/jsx-no-leaked-render": "warn"
|
706
|
-
};
|
707
|
-
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
|
708
|
-
[
|
709
|
-
interopDefault(import("eslint-plugin-react")),
|
710
|
-
interopDefault(import("eslint-plugin-react-hooks")),
|
711
|
-
interopDefault(import("eslint-plugin-react-refresh"))
|
712
|
-
]
|
713
|
-
);
|
714
|
-
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
715
|
-
(i) => isPackageExists2(i)
|
716
|
-
);
|
717
|
-
const isUsingNext = NextJsPackages.some((i) => isPackageExists2(i));
|
711
|
+
function react() {
|
712
|
+
const isUsingNext = NextJsPackages.some((index) => isPackageExists(index));
|
718
713
|
const nextjsConfig = [];
|
719
714
|
if (isUsingNext) {
|
720
|
-
await ensurePackages(["@next/eslint-plugin-next"]);
|
721
|
-
const nextPlugin = await interopDefault(import("@next/eslint-plugin-next"));
|
722
715
|
nextjsConfig.push({
|
723
716
|
name: "solvro/next/setup",
|
724
717
|
plugins: {
|
718
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
725
719
|
"@next/next": nextPlugin
|
726
720
|
},
|
721
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
727
722
|
rules: nextPlugin.configs.recommended.rules
|
728
723
|
});
|
729
724
|
}
|
@@ -731,14 +726,17 @@ async function react(options = {}) {
|
|
731
726
|
{
|
732
727
|
name: "solvro/react/setup",
|
733
728
|
plugins: {
|
729
|
+
// @ts-expect-error ???
|
734
730
|
react: pluginReact,
|
731
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
735
732
|
"react-hooks": pluginReactHooks,
|
733
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
736
734
|
"react-refresh": pluginReactRefresh
|
737
735
|
}
|
738
736
|
},
|
739
737
|
...nextjsConfig,
|
740
738
|
{
|
741
|
-
files,
|
739
|
+
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
742
740
|
languageOptions: {
|
743
741
|
parserOptions: {
|
744
742
|
ecmaFeatures: {
|
@@ -756,16 +754,16 @@ async function react(options = {}) {
|
|
756
754
|
rules: {
|
757
755
|
...pluginReact.configs.flat?.recommended.rules,
|
758
756
|
...pluginReact.configs.flat?.["jsx-runtime"].rules,
|
757
|
+
"react/jsx-no-leaked-render": "warn",
|
759
758
|
// recommended rules react-hooks
|
760
759
|
"react-hooks/exhaustive-deps": "warn",
|
761
760
|
"react-hooks/rules-of-hooks": "error",
|
762
761
|
"react/jsx-no-useless-fragment": "error",
|
763
|
-
"react/jsx-no-leaked-render": "warn",
|
764
762
|
// react refresh
|
765
763
|
"react-refresh/only-export-components": [
|
766
764
|
"warn",
|
767
765
|
{
|
768
|
-
allowConstantExport:
|
766
|
+
allowConstantExport: false,
|
769
767
|
allowExportNames: [
|
770
768
|
...isUsingNext ? [
|
771
769
|
"dynamic",
|
@@ -784,95 +782,7 @@ async function react(options = {}) {
|
|
784
782
|
] : []
|
785
783
|
]
|
786
784
|
}
|
787
|
-
]
|
788
|
-
// overrides
|
789
|
-
...overrides
|
790
|
-
}
|
791
|
-
},
|
792
|
-
...isTypeAware ? [
|
793
|
-
{
|
794
|
-
files: filesTypeAware,
|
795
|
-
ignores: ignoresTypeAware,
|
796
|
-
name: "antfu/react/type-aware-rules",
|
797
|
-
rules: {
|
798
|
-
...typeAwareRules
|
799
|
-
}
|
800
|
-
}
|
801
|
-
] : []
|
802
|
-
];
|
803
|
-
}
|
804
|
-
|
805
|
-
// eslint-config/configs/regexp.ts
|
806
|
-
init_esm_shims();
|
807
|
-
import { configs } from "eslint-plugin-regexp";
|
808
|
-
async function regexp(options = {}) {
|
809
|
-
const config = configs["flat/recommended"];
|
810
|
-
const rules = {
|
811
|
-
...config.rules
|
812
|
-
};
|
813
|
-
if (options.level === "warn") {
|
814
|
-
for (const key in rules) {
|
815
|
-
if (rules[key] === "error") rules[key] = "warn";
|
816
|
-
}
|
817
|
-
}
|
818
|
-
return [
|
819
|
-
{
|
820
|
-
...config,
|
821
|
-
name: "solvro/regexp/rules",
|
822
|
-
rules: {
|
823
|
-
...rules,
|
824
|
-
...options.overrides
|
825
|
-
}
|
826
|
-
}
|
827
|
-
];
|
828
|
-
}
|
829
|
-
|
830
|
-
// eslint-config/configs/test.ts
|
831
|
-
init_esm_shims();
|
832
|
-
var _pluginTest;
|
833
|
-
async function test(options = {}) {
|
834
|
-
const { files = GLOB_TESTS, isInEditor = false, overrides = {} } = options;
|
835
|
-
const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
|
836
|
-
interopDefault(import("@vitest/eslint-plugin")),
|
837
|
-
// @ts-expect-error missing types
|
838
|
-
interopDefault(import("eslint-plugin-no-only-tests"))
|
839
|
-
]);
|
840
|
-
_pluginTest = _pluginTest || {
|
841
|
-
...pluginVitest,
|
842
|
-
rules: {
|
843
|
-
...pluginVitest.rules,
|
844
|
-
// extend `test/no-only-tests` rule
|
845
|
-
...pluginNoOnlyTests.rules
|
846
|
-
}
|
847
|
-
};
|
848
|
-
return [
|
849
|
-
{
|
850
|
-
name: "solvro/test/setup",
|
851
|
-
plugins: {
|
852
|
-
"no-only-tests": _pluginTest
|
853
|
-
}
|
854
|
-
},
|
855
|
-
{
|
856
|
-
files,
|
857
|
-
name: "solvro/test/rules",
|
858
|
-
rules: {
|
859
|
-
"no-only-tests/consistent-test-it": [
|
860
|
-
"error",
|
861
|
-
{ fn: "it", withinDescribe: "it" }
|
862
|
-
],
|
863
|
-
"no-only-tests/no-identical-title": "error",
|
864
|
-
"no-only-tests/no-import-node-test": "error",
|
865
|
-
"no-only-tests/no-only-tests": isInEditor ? "off" : "error",
|
866
|
-
"no-only-tests/prefer-hooks-in-order": "error",
|
867
|
-
"no-only-tests/prefer-lowercase-title": "error",
|
868
|
-
// Disables
|
869
|
-
...{
|
870
|
-
"antfu/no-top-level-await": "off",
|
871
|
-
"no-unused-expressions": "off",
|
872
|
-
"node/prefer-global/process": "off",
|
873
|
-
"@typescript-eslint/explicit-function-return-type": "off"
|
874
|
-
},
|
875
|
-
...overrides
|
785
|
+
]
|
876
786
|
}
|
877
787
|
}
|
878
788
|
];
|
@@ -880,100 +790,22 @@ async function test(options = {}) {
|
|
880
790
|
|
881
791
|
// eslint-config/configs/typescript.ts
|
882
792
|
init_esm_shims();
|
883
|
-
import
|
884
|
-
|
885
|
-
const {
|
886
|
-
componentExts = [],
|
887
|
-
overrides = {},
|
888
|
-
overridesTypeAware = {},
|
889
|
-
parserOptions = {},
|
890
|
-
type = "app"
|
891
|
-
} = options;
|
892
|
-
const files = options.files ?? [
|
893
|
-
GLOB_TS,
|
894
|
-
GLOB_TSX,
|
895
|
-
...componentExts.map((ext) => `**/*.${ext}`)
|
896
|
-
];
|
897
|
-
const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
|
898
|
-
const ignoresTypeAware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`];
|
899
|
-
const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
|
900
|
-
const isTypeAware = !!tsconfigPath;
|
901
|
-
const typeAwareRules = {
|
902
|
-
"dot-notation": "off",
|
903
|
-
"no-implied-eval": "off",
|
904
|
-
"@typescript-eslint/await-thenable": "error",
|
905
|
-
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
906
|
-
"@typescript-eslint/no-floating-promises": "error",
|
907
|
-
"@typescript-eslint/no-for-in-array": "error",
|
908
|
-
"@typescript-eslint/no-implied-eval": "error",
|
909
|
-
"@typescript-eslint/no-misused-promises": "error",
|
910
|
-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
911
|
-
"@typescript-eslint/no-unsafe-argument": "error",
|
912
|
-
"@typescript-eslint/no-unsafe-assignment": "error",
|
913
|
-
"@typescript-eslint/no-unsafe-call": "error",
|
914
|
-
"@typescript-eslint/no-unsafe-member-access": "error",
|
915
|
-
"@typescript-eslint/no-unsafe-return": "error",
|
916
|
-
"@typescript-eslint/promise-function-async": "error",
|
917
|
-
"@typescript-eslint/restrict-plus-operands": "error",
|
918
|
-
"@typescript-eslint/restrict-template-expressions": "error",
|
919
|
-
"@typescript-eslint/return-await": ["error", "in-try-catch"],
|
920
|
-
"@typescript-eslint/strict-boolean-expressions": [
|
921
|
-
"error",
|
922
|
-
{ allowNullableBoolean: true, allowNullableObject: true }
|
923
|
-
],
|
924
|
-
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
925
|
-
"@typescript-eslint/unbound-method": "error"
|
926
|
-
};
|
927
|
-
const [pluginTs, parserTs] = await Promise.all([
|
928
|
-
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
929
|
-
interopDefault(import("@typescript-eslint/parser"))
|
930
|
-
]);
|
931
|
-
function makeParser(typeAware, files2, ignores2) {
|
932
|
-
return {
|
933
|
-
files: files2,
|
934
|
-
...ignores2 ? { ignores: ignores2 } : {},
|
935
|
-
languageOptions: {
|
936
|
-
parser: parserTs,
|
937
|
-
parserOptions: {
|
938
|
-
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
939
|
-
sourceType: "module",
|
940
|
-
...typeAware ? {
|
941
|
-
projectService: {
|
942
|
-
allowDefaultProject: ["./*.js"],
|
943
|
-
defaultProject: tsconfigPath
|
944
|
-
},
|
945
|
-
tsconfigRootDir: process2.cwd()
|
946
|
-
} : {},
|
947
|
-
...parserOptions
|
948
|
-
}
|
949
|
-
},
|
950
|
-
name: `solvro/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
951
|
-
};
|
952
|
-
}
|
793
|
+
import tseslint from "typescript-eslint";
|
794
|
+
function typescript() {
|
953
795
|
return [
|
796
|
+
// @ts-expect-error ???
|
797
|
+
tseslint.configs.strictTypeChecked,
|
798
|
+
// @ts-expect-error ???
|
799
|
+
tseslint.configs.stylisticTypeChecked,
|
954
800
|
{
|
955
|
-
// Install the plugins without globs, so they can be configured separately.
|
956
801
|
name: "solvro/typescript/setup",
|
957
802
|
plugins: {
|
958
|
-
antfu: default3
|
959
|
-
"@typescript-eslint": pluginTs
|
803
|
+
antfu: default3
|
960
804
|
}
|
961
805
|
},
|
962
|
-
// assign type-aware parser for type-aware files and type-unaware parser for the rest
|
963
|
-
...isTypeAware ? [
|
964
|
-
makeParser(false, files),
|
965
|
-
makeParser(true, filesTypeAware, ignoresTypeAware)
|
966
|
-
] : [makeParser(false, files)],
|
967
806
|
{
|
968
|
-
files,
|
969
807
|
name: "solvro/typescript/rules",
|
970
808
|
rules: {
|
971
|
-
...pluginTs.configs["eslint-recommended"].overrides[0].rules,
|
972
|
-
...pluginTs.configs.strict.rules,
|
973
|
-
"no-dupe-class-members": "off",
|
974
|
-
"no-redeclare": "off",
|
975
|
-
"no-use-before-define": "off",
|
976
|
-
"no-useless-constructor": "off",
|
977
809
|
"@typescript-eslint/ban-ts-comment": [
|
978
810
|
"error",
|
979
811
|
{ "ts-expect-error": "allow-with-description" }
|
@@ -1021,253 +853,120 @@ async function typescript(options = {}) {
|
|
1021
853
|
"@typescript-eslint/no-wrapper-object-types": "error",
|
1022
854
|
"@typescript-eslint/triple-slash-reference": "off",
|
1023
855
|
"@typescript-eslint/unified-signatures": "off",
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
856
|
+
// prevent unnecessary use of void operator
|
857
|
+
"@typescript-eslint/no-meaningless-void-operator": "error",
|
858
|
+
// "using non-null assertions cancels the benefits of the strict
|
859
|
+
// null-checking mode."
|
860
|
+
// warn when one of the types in union / intersection overrides others
|
861
|
+
"@typescript-eslint/no-redundant-type-constituents": "warn",
|
862
|
+
// prevent variables shadowing
|
863
|
+
"no-shadow": "error",
|
864
|
+
"@typescript-eslint/no-shadow": "error",
|
865
|
+
// prevent assignment of this, signals a wrong usage of it
|
866
|
+
"@typescript-eslint/no-this-alias": "error",
|
867
|
+
// prevent throwing non-error
|
868
|
+
"no-throw-literal": "off",
|
869
|
+
// prevent unnecessary explicitly adding a default type argument
|
870
|
+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
871
|
+
// prevent unnecessary assertions that won't change the outcome
|
872
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
873
|
+
// prevent extending default types
|
874
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
875
|
+
// force typing out function arguments
|
876
|
+
"@typescript-eslint/no-unsafe-argument": "error",
|
877
|
+
// prevent usage of any via reassigning
|
878
|
+
"@typescript-eslint/no-unsafe-assignment": "error",
|
879
|
+
// prevent usage of any via calling it
|
880
|
+
"@typescript-eslint/no-unsafe-call": "error",
|
881
|
+
// prevent usage of any via using it's members
|
882
|
+
"@typescript-eslint/no-unsafe-member-access": "error",
|
883
|
+
// prevent reverting any from functions
|
884
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
885
|
+
// prevent unused expressions
|
886
|
+
"no-unused-expressions": "off",
|
887
|
+
// var<'string'> = 'string' -> var = 'string' as const
|
888
|
+
"@typescript-eslint/prefer-as-const": "error",
|
889
|
+
// force initializing enums
|
890
|
+
"@typescript-eslint/prefer-enum-initializers": "error",
|
891
|
+
// prefer for x of obj to for let i = 0...
|
892
|
+
"@typescript-eslint/prefer-for-of": "error",
|
893
|
+
// prefer includes() to indexOf()
|
894
|
+
"@typescript-eslint/prefer-includes": "error",
|
895
|
+
// use literals for enum initialization
|
896
|
+
"@typescript-eslint/prefer-literal-enum-member": "error",
|
897
|
+
// prefer safe cascade of a value when dealing with undefined or null
|
898
|
+
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
899
|
+
// prefer optional chaining (a?.b)
|
900
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
901
|
+
// prefer using type parameter for Array.reduce
|
902
|
+
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
903
|
+
// prefer RegExp#exec when no /g flag in regex
|
904
|
+
"@typescript-eslint/prefer-regexp-exec": "error",
|
905
|
+
// enforce `this` as a type when stating type for a method
|
906
|
+
"@typescript-eslint/prefer-return-this-type": "error",
|
907
|
+
// enforce startsWith to indexOf === 0
|
908
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
909
|
+
// prevents default behavior of .sort() - which is confusing
|
910
|
+
"@typescript-eslint/require-array-sort-compare": "error",
|
911
|
+
// no async functions without awaits in body
|
912
|
+
"require-await": "off",
|
913
|
+
"@typescript-eslint/require-await": "error",
|
914
|
+
// prevent number + string
|
915
|
+
"@typescript-eslint/restrict-plus-operands": "error",
|
916
|
+
// only allow string in templates
|
917
|
+
"@typescript-eslint/restrict-template-expressions": "error",
|
918
|
+
// prevent returning await
|
919
|
+
"no-return-await": "off",
|
920
|
+
"@typescript-eslint/return-await": "error",
|
921
|
+
// only booleans in ifs and whiles
|
922
|
+
"@typescript-eslint/strict-boolean-expressions": "error",
|
923
|
+
// check if all paths are followed in code
|
924
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
925
|
+
"dot-notation": "off",
|
926
|
+
"no-implied-eval": "off",
|
927
|
+
"@typescript-eslint/await-thenable": "error",
|
928
|
+
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
929
|
+
"@typescript-eslint/no-floating-promises": "error",
|
930
|
+
"@typescript-eslint/no-for-in-array": "error",
|
931
|
+
"@typescript-eslint/no-implied-eval": "error",
|
932
|
+
"@typescript-eslint/no-misused-promises": "error",
|
933
|
+
"@typescript-eslint/promise-function-async": "error",
|
934
|
+
"@typescript-eslint/unbound-method": "error"
|
1046
935
|
}
|
1047
|
-
|
936
|
+
}
|
1048
937
|
];
|
1049
938
|
}
|
1050
939
|
|
1051
940
|
// eslint-config/configs/unicorn.ts
|
1052
941
|
init_esm_shims();
|
1053
|
-
|
942
|
+
function unicorn() {
|
1054
943
|
return [
|
1055
944
|
{
|
1056
945
|
name: "solvro/unicorn/rules",
|
1057
946
|
plugins: {
|
1058
947
|
unicorn: default6
|
1059
948
|
},
|
1060
|
-
rules:
|
1061
|
-
...options.allRecommended ? default6.configs["flat/recommended"].rules : {
|
1062
|
-
"unicorn/consistent-empty-array-spread": "error",
|
1063
|
-
"unicorn/error-message": "error",
|
1064
|
-
"unicorn/escape-case": "error",
|
1065
|
-
"unicorn/new-for-builtins": "error",
|
1066
|
-
"unicorn/no-instanceof-array": "error",
|
1067
|
-
"unicorn/no-new-array": "error",
|
1068
|
-
"unicorn/no-new-buffer": "error",
|
1069
|
-
"unicorn/number-literal-case": "error",
|
1070
|
-
"unicorn/prefer-dom-node-text-content": "error",
|
1071
|
-
"unicorn/prefer-includes": "error",
|
1072
|
-
"unicorn/prefer-node-protocol": "error",
|
1073
|
-
"unicorn/prefer-number-properties": "error",
|
1074
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
1075
|
-
"unicorn/prefer-type-error": "error",
|
1076
|
-
"unicorn/throw-new-error": "error"
|
1077
|
-
}
|
1078
|
-
}
|
949
|
+
rules: default6.configs["flat/recommended"].rules
|
1079
950
|
}
|
1080
951
|
];
|
1081
952
|
}
|
1082
953
|
|
1083
|
-
// eslint-config/factory.ts
|
1084
|
-
var flatConfigProps = [
|
1085
|
-
"name",
|
1086
|
-
"languageOptions",
|
1087
|
-
"linterOptions",
|
1088
|
-
"processor",
|
1089
|
-
"plugins",
|
1090
|
-
"rules",
|
1091
|
-
"settings"
|
1092
|
-
];
|
1093
|
-
function solvro(options = {}, ...userConfigs) {
|
1094
|
-
const {
|
1095
|
-
componentExts = [],
|
1096
|
-
gitignore: enableGitignore = true,
|
1097
|
-
jsx: enableJsx = true,
|
1098
|
-
react: enableReact = false,
|
1099
|
-
regexp: enableRegexp = true,
|
1100
|
-
typescript: enableTypeScript = isPackageExists3("typescript"),
|
1101
|
-
unicorn: enableUnicorn = true
|
1102
|
-
} = options;
|
1103
|
-
let isInEditor = options.isInEditor;
|
1104
|
-
if (isInEditor == null) {
|
1105
|
-
isInEditor = isInEditorEnv();
|
1106
|
-
if (isInEditor)
|
1107
|
-
console.log(
|
1108
|
-
"[@solvro/config] Detected running in editor, some rules are disabled."
|
1109
|
-
);
|
1110
|
-
}
|
1111
|
-
const configs2 = [];
|
1112
|
-
if (enableGitignore) {
|
1113
|
-
if (typeof enableGitignore !== "boolean") {
|
1114
|
-
configs2.push(
|
1115
|
-
interopDefault(import("eslint-config-flat-gitignore")).then((r) => [
|
1116
|
-
r({
|
1117
|
-
name: "solvro/gitignore",
|
1118
|
-
...enableGitignore
|
1119
|
-
})
|
1120
|
-
])
|
1121
|
-
);
|
1122
|
-
} else {
|
1123
|
-
configs2.push(
|
1124
|
-
interopDefault(import("eslint-config-flat-gitignore")).then((r) => [
|
1125
|
-
r({
|
1126
|
-
name: "solvro/gitignore",
|
1127
|
-
strict: false
|
1128
|
-
})
|
1129
|
-
])
|
1130
|
-
);
|
1131
|
-
}
|
1132
|
-
}
|
1133
|
-
const typescriptOptions = resolveSubOptions(options, "typescript");
|
1134
|
-
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
1135
|
-
configs2.push(
|
1136
|
-
ignores(options.ignores),
|
1137
|
-
javascript({
|
1138
|
-
isInEditor,
|
1139
|
-
overrides: getOverrides(options, "javascript")
|
1140
|
-
}),
|
1141
|
-
comments(),
|
1142
|
-
node(),
|
1143
|
-
jsdoc(),
|
1144
|
-
imports(),
|
1145
|
-
command()
|
1146
|
-
);
|
1147
|
-
if (enableUnicorn) {
|
1148
|
-
configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
1149
|
-
}
|
1150
|
-
if (enableJsx) {
|
1151
|
-
configs2.push(jsx());
|
1152
|
-
}
|
1153
|
-
if (enableTypeScript) {
|
1154
|
-
configs2.push(
|
1155
|
-
typescript({
|
1156
|
-
...typescriptOptions,
|
1157
|
-
componentExts,
|
1158
|
-
overrides: getOverrides(options, "typescript"),
|
1159
|
-
type: options.type
|
1160
|
-
})
|
1161
|
-
);
|
1162
|
-
}
|
1163
|
-
if (enableRegexp) {
|
1164
|
-
configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
|
1165
|
-
}
|
1166
|
-
if (options.test ?? true) {
|
1167
|
-
configs2.push(
|
1168
|
-
test({
|
1169
|
-
isInEditor,
|
1170
|
-
overrides: getOverrides(options, "test")
|
1171
|
-
})
|
1172
|
-
);
|
1173
|
-
}
|
1174
|
-
if (enableReact) {
|
1175
|
-
configs2.push(
|
1176
|
-
react({
|
1177
|
-
...typescriptOptions,
|
1178
|
-
overrides: getOverrides(options, "react"),
|
1179
|
-
tsconfigPath
|
1180
|
-
})
|
1181
|
-
);
|
1182
|
-
}
|
1183
|
-
if (options.markdown ?? true) {
|
1184
|
-
configs2.push(
|
1185
|
-
markdown({
|
1186
|
-
componentExts,
|
1187
|
-
overrides: getOverrides(options, "markdown")
|
1188
|
-
})
|
1189
|
-
);
|
1190
|
-
}
|
1191
|
-
if (options.formatters) {
|
1192
|
-
configs2.push(formatters());
|
1193
|
-
}
|
1194
|
-
configs2.push(disables());
|
1195
|
-
if ("files" in options) {
|
1196
|
-
throw new Error(
|
1197
|
-
'[@solvro/config] The first argument should not contain the "files" property as the options are supposed to be global. Place it in the second or later config instead.'
|
1198
|
-
);
|
1199
|
-
}
|
1200
|
-
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
1201
|
-
if (key in options) acc[key] = options[key];
|
1202
|
-
return acc;
|
1203
|
-
}, {});
|
1204
|
-
if (Object.keys(fusedConfig).length) configs2.push([fusedConfig]);
|
1205
|
-
let composer = new FlatConfigComposer();
|
1206
|
-
composer = composer.append(...configs2, ...userConfigs);
|
1207
|
-
return composer;
|
1208
|
-
}
|
1209
|
-
function resolveSubOptions(options, key) {
|
1210
|
-
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
1211
|
-
}
|
1212
|
-
function getOverrides(options, key) {
|
1213
|
-
const sub = resolveSubOptions(options, key);
|
1214
|
-
return {
|
1215
|
-
...options.overrides?.[key],
|
1216
|
-
..."overrides" in sub ? sub.overrides : {}
|
1217
|
-
};
|
1218
|
-
}
|
1219
|
-
|
1220
|
-
// eslint-config/types.ts
|
1221
|
-
init_esm_shims();
|
1222
|
-
|
1223
954
|
// eslint-config/index.ts
|
1224
|
-
var
|
955
|
+
var solvro = (...configs) => tseslint2.config(
|
956
|
+
...react(),
|
957
|
+
...typescript(),
|
958
|
+
...javascript(),
|
959
|
+
...jsdoc(),
|
960
|
+
...unicorn(),
|
961
|
+
...disables(),
|
962
|
+
...imports(),
|
963
|
+
...comments(),
|
964
|
+
...ignores(),
|
965
|
+
...formatters(),
|
966
|
+
...node(),
|
967
|
+
...configs
|
968
|
+
);
|
1225
969
|
export {
|
1226
|
-
|
1227
|
-
GLOB_EXCLUDE,
|
1228
|
-
GLOB_HTML,
|
1229
|
-
GLOB_JS,
|
1230
|
-
GLOB_JSON,
|
1231
|
-
GLOB_JSON5,
|
1232
|
-
GLOB_JSX,
|
1233
|
-
GLOB_MARKDOWN,
|
1234
|
-
GLOB_MARKDOWN_CODE,
|
1235
|
-
GLOB_MARKDOWN_IN_MARKDOWN,
|
1236
|
-
GLOB_SRC,
|
1237
|
-
GLOB_SRC_EXT,
|
1238
|
-
GLOB_STYLE,
|
1239
|
-
GLOB_SVG,
|
1240
|
-
GLOB_TESTS,
|
1241
|
-
GLOB_TOML,
|
1242
|
-
GLOB_TS,
|
1243
|
-
GLOB_TSX,
|
1244
|
-
GLOB_XML,
|
1245
|
-
combine,
|
1246
|
-
command,
|
1247
|
-
comments,
|
1248
|
-
eslint_config_default as default,
|
1249
|
-
disables,
|
1250
|
-
ensurePackages,
|
1251
|
-
formatters,
|
1252
|
-
getOverrides,
|
1253
|
-
ignores,
|
1254
|
-
imports,
|
1255
|
-
interopDefault,
|
1256
|
-
isInEditorEnv,
|
1257
|
-
isInGitHooksOrLintStaged,
|
1258
|
-
isPackageInScope,
|
1259
|
-
javascript,
|
1260
|
-
jsdoc,
|
1261
|
-
jsx,
|
1262
|
-
markdown,
|
1263
|
-
node,
|
1264
|
-
parserPlain,
|
1265
|
-
react,
|
1266
|
-
regexp,
|
1267
|
-
resolveSubOptions,
|
1268
|
-
solvro,
|
1269
|
-
test,
|
1270
|
-
toArray,
|
1271
|
-
typescript,
|
1272
|
-
unicorn
|
970
|
+
solvro
|
1273
971
|
};
|
972
|
+
//# sourceMappingURL=index.js.map
|