@vinicunca/eslint-config 2.7.9 → 2.9.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/index.cjs +815 -185
- package/dist/index.d.cts +10203 -3539
- package/dist/index.d.ts +10203 -3539
- package/dist/index.js +801 -191
- package/package.json +70 -22
package/dist/index.cjs
CHANGED
|
@@ -31,8 +31,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
GLOB_ALL_SRC: () => GLOB_ALL_SRC,
|
|
34
|
+
GLOB_ASTRO: () => GLOB_ASTRO,
|
|
35
|
+
GLOB_ASTRO_TS: () => GLOB_ASTRO_TS,
|
|
34
36
|
GLOB_CSS: () => GLOB_CSS,
|
|
35
37
|
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
38
|
+
GLOB_GRAPHQL: () => GLOB_GRAPHQL,
|
|
36
39
|
GLOB_HTML: () => GLOB_HTML,
|
|
37
40
|
GLOB_JS: () => GLOB_JS,
|
|
38
41
|
GLOB_JSON: () => GLOB_JSON,
|
|
@@ -48,20 +51,29 @@ __export(src_exports, {
|
|
|
48
51
|
GLOB_SRC: () => GLOB_SRC,
|
|
49
52
|
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
50
53
|
GLOB_STYLE: () => GLOB_STYLE,
|
|
54
|
+
GLOB_SVELTE: () => GLOB_SVELTE,
|
|
55
|
+
GLOB_SVG: () => GLOB_SVG,
|
|
51
56
|
GLOB_TESTS: () => GLOB_TESTS,
|
|
57
|
+
GLOB_TOML: () => GLOB_TOML,
|
|
52
58
|
GLOB_TS: () => GLOB_TS,
|
|
53
59
|
GLOB_TSX: () => GLOB_TSX,
|
|
54
60
|
GLOB_VUE: () => GLOB_VUE,
|
|
61
|
+
GLOB_XML: () => GLOB_XML,
|
|
55
62
|
GLOB_YAML: () => GLOB_YAML,
|
|
56
63
|
STYLISTIC_CONFIG_DEFAULTS: () => STYLISTIC_CONFIG_DEFAULTS,
|
|
64
|
+
astro: () => astro,
|
|
57
65
|
combineConfigs: () => combineConfigs,
|
|
66
|
+
command: () => command,
|
|
58
67
|
comments: () => comments,
|
|
59
68
|
defaultPluginRenaming: () => defaultPluginRenaming,
|
|
69
|
+
ensurePackages: () => ensurePackages,
|
|
60
70
|
formatters: () => formatters,
|
|
61
71
|
ignores: () => ignores,
|
|
62
72
|
imports: () => imports,
|
|
63
73
|
interopDefault: () => interopDefault,
|
|
64
74
|
isInEditorEnv: () => isInEditorEnv,
|
|
75
|
+
isInGitHooksOrLintStaged: () => isInGitHooksOrLintStaged,
|
|
76
|
+
isPackageInScope: () => isPackageInScope,
|
|
65
77
|
javascript: () => javascript,
|
|
66
78
|
jsdoc: () => jsdoc,
|
|
67
79
|
jsonc: () => jsonc,
|
|
@@ -82,11 +94,15 @@ __export(src_exports, {
|
|
|
82
94
|
regexp: () => regexp,
|
|
83
95
|
renamePluginInConfigs: () => renamePluginInConfigs,
|
|
84
96
|
renameRules: () => renameRules,
|
|
97
|
+
solid: () => solid,
|
|
85
98
|
sonar: () => sonar,
|
|
86
99
|
sortPackageJson: () => sortPackageJson,
|
|
87
100
|
sortTsconfig: () => sortTsconfig,
|
|
88
101
|
stylistic: () => stylistic,
|
|
102
|
+
svelte: () => svelte,
|
|
89
103
|
test: () => test,
|
|
104
|
+
toArray: () => toArray,
|
|
105
|
+
toml: () => toml,
|
|
90
106
|
typescript: () => typescript,
|
|
91
107
|
unicorn: () => unicorn,
|
|
92
108
|
unocss: () => unocss,
|
|
@@ -96,10 +112,14 @@ __export(src_exports, {
|
|
|
96
112
|
});
|
|
97
113
|
module.exports = __toCommonJS(src_exports);
|
|
98
114
|
|
|
115
|
+
// ../node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.41_tsx@4.17.1_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
|
|
116
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
117
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
118
|
+
|
|
99
119
|
// ../node_modules/.pnpm/@vinicunca+perkakas@1.0.5/node_modules/@vinicunca/perkakas/dist/chunk-HLL46USD.js
|
|
100
|
-
function r(
|
|
101
|
-
if (typeof
|
|
102
|
-
let o = Object.getPrototypeOf(
|
|
120
|
+
function r(e3) {
|
|
121
|
+
if (typeof e3 != "object" || e3 === null) return false;
|
|
122
|
+
let o = Object.getPrototypeOf(e3);
|
|
103
123
|
return o === null || o === Object.prototype;
|
|
104
124
|
}
|
|
105
125
|
|
|
@@ -108,9 +128,14 @@ function e(o) {
|
|
|
108
128
|
return typeof o == "boolean";
|
|
109
129
|
}
|
|
110
130
|
|
|
131
|
+
// ../node_modules/.pnpm/@vinicunca+perkakas@1.0.5/node_modules/@vinicunca/perkakas/dist/chunk-Q2HW4RVT.js
|
|
132
|
+
function e2(r2) {
|
|
133
|
+
return typeof r2 == "number" && !Number.isNaN(r2);
|
|
134
|
+
}
|
|
135
|
+
|
|
111
136
|
// src/base.ts
|
|
112
137
|
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
113
|
-
var
|
|
138
|
+
var import_local_pkg4 = require("local-pkg");
|
|
114
139
|
|
|
115
140
|
// src/flags.ts
|
|
116
141
|
var ERROR = "error";
|
|
@@ -120,37 +145,9 @@ var CONSISTENT = "consistent";
|
|
|
120
145
|
var NEVER = "never";
|
|
121
146
|
var ALWAYS = "always";
|
|
122
147
|
|
|
123
|
-
// src/plugins.ts
|
|
124
|
-
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
125
|
-
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
126
|
-
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
127
|
-
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
128
|
-
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
129
|
-
var import_eslint_plugin_sonarjs = __toESM(require("eslint-plugin-sonarjs"), 1);
|
|
130
|
-
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
131
|
-
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
132
|
-
|
|
133
|
-
// src/configs/comments.ts
|
|
134
|
-
async function comments() {
|
|
135
|
-
return [
|
|
136
|
-
{
|
|
137
|
-
name: "vinicunca/eslint-comments",
|
|
138
|
-
plugins: {
|
|
139
|
-
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
140
|
-
},
|
|
141
|
-
rules: {
|
|
142
|
-
"eslint-comments/no-aggregating-enable": ERROR,
|
|
143
|
-
"eslint-comments/no-duplicate-disable": ERROR,
|
|
144
|
-
"eslint-comments/no-unlimited-disable": ERROR,
|
|
145
|
-
"eslint-comments/no-unused-enable": ERROR
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
148
|
// src/globs.ts
|
|
152
|
-
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
153
149
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
150
|
+
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
154
151
|
var GLOB_JS = "**/*.?([cm])js";
|
|
155
152
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
156
153
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
@@ -165,9 +162,16 @@ var GLOB_JSON5 = "**/*.json5";
|
|
|
165
162
|
var GLOB_JSONC = "**/*.jsonc";
|
|
166
163
|
var GLOB_MARKDOWN = "**/*.md";
|
|
167
164
|
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
165
|
+
var GLOB_SVELTE = "**/*.svelte";
|
|
168
166
|
var GLOB_VUE = "**/*.vue";
|
|
169
167
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
168
|
+
var GLOB_TOML = "**/*.toml";
|
|
169
|
+
var GLOB_XML = "**/*.xml";
|
|
170
|
+
var GLOB_SVG = "**/*.svg";
|
|
170
171
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
172
|
+
var GLOB_ASTRO = "**/*.astro";
|
|
173
|
+
var GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
174
|
+
var GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
171
175
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
172
176
|
var GLOB_TESTS = [
|
|
173
177
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
@@ -182,8 +186,10 @@ var GLOB_ALL_SRC = [
|
|
|
182
186
|
GLOB_JSON,
|
|
183
187
|
GLOB_JSON5,
|
|
184
188
|
GLOB_MARKDOWN,
|
|
189
|
+
GLOB_SVELTE,
|
|
185
190
|
GLOB_VUE,
|
|
186
191
|
GLOB_YAML,
|
|
192
|
+
GLOB_XML,
|
|
187
193
|
GLOB_HTML
|
|
188
194
|
];
|
|
189
195
|
var GLOB_EXCLUDE = [
|
|
@@ -203,6 +209,7 @@ var GLOB_EXCLUDE = [
|
|
|
203
209
|
"**/.vitepress/cache",
|
|
204
210
|
"**/.nuxt",
|
|
205
211
|
"**/.next",
|
|
212
|
+
"**/.svelte-kit",
|
|
206
213
|
"**/.vercel",
|
|
207
214
|
"**/.changeset",
|
|
208
215
|
"**/.idea",
|
|
@@ -220,7 +227,31 @@ var GLOB_EXCLUDE = [
|
|
|
220
227
|
];
|
|
221
228
|
|
|
222
229
|
// src/utils.ts
|
|
230
|
+
var import_local_pkg = require("local-pkg");
|
|
223
231
|
var import_node_process = __toESM(require("process"), 1);
|
|
232
|
+
var import_node_url = require("url");
|
|
233
|
+
var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
|
|
234
|
+
var isCwdInScope = (0, import_local_pkg.isPackageExists)("@vinicunca/eslint-config");
|
|
235
|
+
var parserPlain = {
|
|
236
|
+
meta: {
|
|
237
|
+
name: "parser-plain"
|
|
238
|
+
},
|
|
239
|
+
parseForESLint: (code) => ({
|
|
240
|
+
ast: {
|
|
241
|
+
body: [],
|
|
242
|
+
comments: [],
|
|
243
|
+
loc: { end: code.length, start: 0 },
|
|
244
|
+
range: [0, code.length],
|
|
245
|
+
tokens: [],
|
|
246
|
+
type: "Program"
|
|
247
|
+
},
|
|
248
|
+
scopeManager: null,
|
|
249
|
+
services: { isPlain: true },
|
|
250
|
+
visitorKeys: {
|
|
251
|
+
Program: []
|
|
252
|
+
}
|
|
253
|
+
})
|
|
254
|
+
};
|
|
224
255
|
async function combineConfigs(...configs2) {
|
|
225
256
|
const resolved = await Promise.all(configs2);
|
|
226
257
|
return resolved.flat();
|
|
@@ -256,36 +287,149 @@ function renamePluginInConfigs(configs2, map) {
|
|
|
256
287
|
return clone;
|
|
257
288
|
});
|
|
258
289
|
}
|
|
290
|
+
function toArray(value) {
|
|
291
|
+
return Array.isArray(value) ? value : [value];
|
|
292
|
+
}
|
|
259
293
|
async function interopDefault(m) {
|
|
260
294
|
const resolved = await m;
|
|
261
295
|
return resolved.default || resolved;
|
|
262
296
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
297
|
+
function isPackageInScope(name) {
|
|
298
|
+
return (0, import_local_pkg.isPackageExists)(name, { paths: [scopeUrl] });
|
|
299
|
+
}
|
|
300
|
+
async function ensurePackages(packages) {
|
|
301
|
+
if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false || isCwdInScope === false) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
|
|
305
|
+
if (nonExistingPackages.length === 0) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
const p = await import("@clack/prompts");
|
|
309
|
+
const result = await p.confirm({
|
|
310
|
+
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
|
|
311
|
+
});
|
|
312
|
+
if (result) {
|
|
313
|
+
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function isInEditorEnv() {
|
|
317
|
+
if (import_node_process.default.env.CI) {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
if (isInGitHooksOrLintStaged()) {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
return !!(import_node_process.default.env.VSCODE_PID || import_node_process.default.env.VSCODE_CWD || import_node_process.default.env.JETBRAINS_IDE || import_node_process.default.env.VIM || import_node_process.default.env.NVIM);
|
|
324
|
+
}
|
|
325
|
+
function isInGitHooksOrLintStaged() {
|
|
326
|
+
return !!(import_node_process.default.env.GIT_PARAMS || import_node_process.default.env.VSCODE_GIT_COMMAND || import_node_process.default.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// src/configs/astro.ts
|
|
330
|
+
async function astro(options = {}) {
|
|
331
|
+
const {
|
|
332
|
+
files = [GLOB_ASTRO],
|
|
333
|
+
overrides = {},
|
|
334
|
+
stylistic: stylistic2 = true
|
|
335
|
+
} = options;
|
|
336
|
+
const [
|
|
337
|
+
pluginAstro,
|
|
338
|
+
parserAstro,
|
|
339
|
+
parserTs
|
|
340
|
+
] = await Promise.all([
|
|
341
|
+
interopDefault(import("eslint-plugin-astro")),
|
|
342
|
+
interopDefault(import("astro-eslint-parser")),
|
|
343
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
344
|
+
]);
|
|
345
|
+
return [
|
|
346
|
+
{
|
|
347
|
+
name: "vinicunca/astro/setup",
|
|
348
|
+
plugins: {
|
|
349
|
+
astro: pluginAstro
|
|
350
|
+
}
|
|
275
351
|
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
352
|
+
{
|
|
353
|
+
files,
|
|
354
|
+
languageOptions: {
|
|
355
|
+
globals: pluginAstro.environments.astro.globals,
|
|
356
|
+
parser: parserAstro,
|
|
357
|
+
parserOptions: {
|
|
358
|
+
extraFileExtensions: [".astro"],
|
|
359
|
+
parser: parserTs
|
|
360
|
+
},
|
|
361
|
+
sourceType: "module"
|
|
362
|
+
},
|
|
363
|
+
name: "vinicunca/astro/rules",
|
|
364
|
+
processor: "astro/client-side-ts",
|
|
365
|
+
rules: {
|
|
366
|
+
// use recommended rules
|
|
367
|
+
"astro/missing-client-only-directive-value": ERROR,
|
|
368
|
+
"astro/no-conflict-set-directives": ERROR,
|
|
369
|
+
"astro/no-deprecated-astro-canonicalurl": ERROR,
|
|
370
|
+
"astro/no-deprecated-astro-fetchcontent": ERROR,
|
|
371
|
+
"astro/no-deprecated-astro-resolve": ERROR,
|
|
372
|
+
"astro/no-deprecated-getentrybyslug": ERROR,
|
|
373
|
+
"astro/no-set-html-directive": OFF,
|
|
374
|
+
"astro/no-unused-define-vars-in-style": ERROR,
|
|
375
|
+
"astro/semi": OFF,
|
|
376
|
+
"astro/valid-compile": ERROR,
|
|
377
|
+
...stylistic2 ? {
|
|
378
|
+
"style/indent": OFF,
|
|
379
|
+
"style/jsx-closing-tag-location": OFF,
|
|
380
|
+
"style/jsx-indent": OFF,
|
|
381
|
+
"style/jsx-one-expression-per-line": OFF,
|
|
382
|
+
"style/no-multiple-empty-lines": OFF
|
|
383
|
+
} : {},
|
|
384
|
+
...overrides
|
|
385
|
+
}
|
|
280
386
|
}
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
387
|
+
];
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// src/configs/command.ts
|
|
391
|
+
var import_config = __toESM(require("eslint-plugin-command/config"), 1);
|
|
392
|
+
async function command() {
|
|
393
|
+
return [
|
|
394
|
+
{
|
|
395
|
+
...(0, import_config.default)(),
|
|
396
|
+
name: "vinicunca/command/rules"
|
|
397
|
+
}
|
|
398
|
+
];
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// src/plugins.ts
|
|
402
|
+
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
403
|
+
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
404
|
+
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
405
|
+
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
406
|
+
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
407
|
+
var import_eslint_plugin_sonarjs = __toESM(require("eslint-plugin-sonarjs"), 1);
|
|
408
|
+
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
409
|
+
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
410
|
+
|
|
411
|
+
// src/configs/comments.ts
|
|
412
|
+
async function comments() {
|
|
413
|
+
return [
|
|
414
|
+
{
|
|
415
|
+
name: "vinicunca/eslint-comments/rules",
|
|
416
|
+
plugins: {
|
|
417
|
+
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
418
|
+
},
|
|
419
|
+
rules: {
|
|
420
|
+
"eslint-comments/no-aggregating-enable": ERROR,
|
|
421
|
+
"eslint-comments/no-duplicate-disable": ERROR,
|
|
422
|
+
"eslint-comments/no-unlimited-disable": ERROR,
|
|
423
|
+
"eslint-comments/no-unused-enable": ERROR
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
];
|
|
285
427
|
}
|
|
286
428
|
|
|
429
|
+
// src/configs/formatters.ts
|
|
430
|
+
var import_local_pkg2 = require("local-pkg");
|
|
431
|
+
|
|
287
432
|
// src/configs/stylistic.ts
|
|
288
|
-
var STR_PARENS_NEW_LINE = "parens-new-line";
|
|
289
433
|
var STYLISTIC_CONFIG_DEFAULTS = {
|
|
290
434
|
indent: 2,
|
|
291
435
|
jsx: true,
|
|
@@ -321,8 +465,8 @@ async function stylistic(options = {}) {
|
|
|
321
465
|
},
|
|
322
466
|
rules: {
|
|
323
467
|
...config.rules,
|
|
324
|
-
"antfu/consistent-list-newline":
|
|
325
|
-
"antfu/top-level-function":
|
|
468
|
+
"antfu/consistent-list-newline": ERROR,
|
|
469
|
+
"antfu/top-level-function": ERROR,
|
|
326
470
|
"curly": [ERROR, "all"],
|
|
327
471
|
"style/array-bracket-newline": [ERROR, CONSISTENT],
|
|
328
472
|
"style/array-bracket-spacing": [ERROR, NEVER],
|
|
@@ -330,46 +474,6 @@ async function stylistic(options = {}) {
|
|
|
330
474
|
"style/arrow-parens": [ERROR, ALWAYS],
|
|
331
475
|
"style/brace-style": [ERROR],
|
|
332
476
|
"style/func-call-spacing": [ERROR, NEVER],
|
|
333
|
-
"style/jsx-child-element-spacing": OFF,
|
|
334
|
-
"style/jsx-closing-bracket-location": [ERROR, "line-aligned"],
|
|
335
|
-
"style/jsx-closing-tag-location": ERROR,
|
|
336
|
-
"style/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
|
|
337
|
-
"style/jsx-curly-newline": [ERROR, {
|
|
338
|
-
multiline: "consistent",
|
|
339
|
-
singleline: "consistent"
|
|
340
|
-
}],
|
|
341
|
-
"style/jsx-curly-spacing": [ERROR, {
|
|
342
|
-
children: true,
|
|
343
|
-
spacing: {
|
|
344
|
-
objectLiterals: NEVER
|
|
345
|
-
},
|
|
346
|
-
when: "always"
|
|
347
|
-
}],
|
|
348
|
-
"style/jsx-equals-spacing": [ERROR, NEVER],
|
|
349
|
-
"style/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
|
|
350
|
-
"style/jsx-indent": [ERROR, 2],
|
|
351
|
-
"style/jsx-indent-props": [ERROR, 2],
|
|
352
|
-
"style/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
|
|
353
|
-
"style/jsx-newline": ERROR,
|
|
354
|
-
"style/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
|
|
355
|
-
"style/jsx-props-no-multi-spaces": ERROR,
|
|
356
|
-
// Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
|
|
357
|
-
"style/jsx-sort-props": [OFF],
|
|
358
|
-
"style/jsx-tag-spacing": [ERROR, {
|
|
359
|
-
afterOpening: NEVER,
|
|
360
|
-
beforeClosing: NEVER,
|
|
361
|
-
beforeSelfClosing: "always",
|
|
362
|
-
closingSlash: NEVER
|
|
363
|
-
}],
|
|
364
|
-
"style/jsx-wrap-multilines": [ERROR, {
|
|
365
|
-
arrow: STR_PARENS_NEW_LINE,
|
|
366
|
-
assignment: STR_PARENS_NEW_LINE,
|
|
367
|
-
condition: STR_PARENS_NEW_LINE,
|
|
368
|
-
declaration: STR_PARENS_NEW_LINE,
|
|
369
|
-
logical: STR_PARENS_NEW_LINE,
|
|
370
|
-
prop: STR_PARENS_NEW_LINE,
|
|
371
|
-
return: STR_PARENS_NEW_LINE
|
|
372
|
-
}],
|
|
373
477
|
"style/member-delimiter-style": [ERROR],
|
|
374
478
|
"style/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
|
|
375
479
|
"style/object-curly-spacing": [ERROR, ALWAYS],
|
|
@@ -390,13 +494,27 @@ async function stylistic(options = {}) {
|
|
|
390
494
|
// src/configs/formatters.ts
|
|
391
495
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
392
496
|
if (options === true) {
|
|
497
|
+
const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
|
|
393
498
|
options = {
|
|
499
|
+
astro: isPackageInScope("prettier-plugin-astro"),
|
|
394
500
|
css: true,
|
|
395
501
|
graphql: true,
|
|
396
502
|
html: true,
|
|
397
|
-
markdown: true
|
|
503
|
+
markdown: true,
|
|
504
|
+
slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli"),
|
|
505
|
+
svg: isPrettierPluginXmlInScope,
|
|
506
|
+
xml: isPrettierPluginXmlInScope
|
|
398
507
|
};
|
|
399
508
|
}
|
|
509
|
+
await ensurePackages([
|
|
510
|
+
"eslint-plugin-format",
|
|
511
|
+
options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0,
|
|
512
|
+
options.astro ? "prettier-plugin-astro" : void 0,
|
|
513
|
+
options.xml || options.svg ? "@prettier/plugin-xml" : void 0
|
|
514
|
+
]);
|
|
515
|
+
if (options.slidev && options.markdown !== true && options.markdown !== "prettier") {
|
|
516
|
+
throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
|
|
517
|
+
}
|
|
400
518
|
const {
|
|
401
519
|
indent,
|
|
402
520
|
quotes,
|
|
@@ -410,15 +528,21 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
410
528
|
endOfLine: "auto",
|
|
411
529
|
semi,
|
|
412
530
|
singleQuote: quotes === "single",
|
|
413
|
-
tabWidth:
|
|
531
|
+
tabWidth: e2(indent) ? indent : 2,
|
|
414
532
|
trailingComma: "all",
|
|
415
533
|
useTabs: indent === "tab"
|
|
416
534
|
},
|
|
417
535
|
options.prettierOptions || {}
|
|
418
536
|
);
|
|
537
|
+
const prettierXmlOptions = {
|
|
538
|
+
xmlQuoteAttributes: "double",
|
|
539
|
+
xmlSelfClosingSpace: true,
|
|
540
|
+
xmlSortAttributesByKey: false,
|
|
541
|
+
xmlWhitespaceSensitivity: "ignore"
|
|
542
|
+
};
|
|
419
543
|
const dprintOptions = Object.assign(
|
|
420
544
|
{
|
|
421
|
-
indentWidth:
|
|
545
|
+
indentWidth: e2(indent) ? indent : 2,
|
|
422
546
|
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
423
547
|
useTabs: indent === "tab"
|
|
424
548
|
},
|
|
@@ -443,7 +567,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
443
567
|
name: "vinicunca/formatter/css",
|
|
444
568
|
rules: {
|
|
445
569
|
"format/prettier": [
|
|
446
|
-
|
|
570
|
+
ERROR,
|
|
447
571
|
{
|
|
448
572
|
...prettierOptions,
|
|
449
573
|
parser: "css"
|
|
@@ -459,7 +583,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
459
583
|
name: "vinicunca/formatter/scss",
|
|
460
584
|
rules: {
|
|
461
585
|
"format/prettier": [
|
|
462
|
-
|
|
586
|
+
ERROR,
|
|
463
587
|
{
|
|
464
588
|
...prettierOptions,
|
|
465
589
|
parser: "scss"
|
|
@@ -475,7 +599,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
475
599
|
name: "vinicunca/formatter/less",
|
|
476
600
|
rules: {
|
|
477
601
|
"format/prettier": [
|
|
478
|
-
|
|
602
|
+
ERROR,
|
|
479
603
|
{
|
|
480
604
|
...prettierOptions,
|
|
481
605
|
parser: "less"
|
|
@@ -494,7 +618,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
494
618
|
name: "vinicunca/formatter/html",
|
|
495
619
|
rules: {
|
|
496
620
|
"format/prettier": [
|
|
497
|
-
|
|
621
|
+
ERROR,
|
|
498
622
|
{
|
|
499
623
|
...prettierOptions,
|
|
500
624
|
parser: "html"
|
|
@@ -503,21 +627,72 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
503
627
|
}
|
|
504
628
|
});
|
|
505
629
|
}
|
|
630
|
+
if (options.xml) {
|
|
631
|
+
configs2.push({
|
|
632
|
+
files: [GLOB_XML],
|
|
633
|
+
languageOptions: {
|
|
634
|
+
parser: parserPlain
|
|
635
|
+
},
|
|
636
|
+
name: "antfu/formatter/xml",
|
|
637
|
+
rules: {
|
|
638
|
+
"format/prettier": [
|
|
639
|
+
ERROR,
|
|
640
|
+
{
|
|
641
|
+
...prettierXmlOptions,
|
|
642
|
+
...prettierOptions,
|
|
643
|
+
parser: "xml",
|
|
644
|
+
plugins: [
|
|
645
|
+
"@prettier/plugin-xml"
|
|
646
|
+
]
|
|
647
|
+
}
|
|
648
|
+
]
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
if (options.svg) {
|
|
653
|
+
configs2.push({
|
|
654
|
+
files: [GLOB_SVG],
|
|
655
|
+
languageOptions: {
|
|
656
|
+
parser: parserPlain
|
|
657
|
+
},
|
|
658
|
+
name: "antfu/formatter/svg",
|
|
659
|
+
rules: {
|
|
660
|
+
"format/prettier": [
|
|
661
|
+
ERROR,
|
|
662
|
+
{
|
|
663
|
+
...prettierXmlOptions,
|
|
664
|
+
...prettierOptions,
|
|
665
|
+
parser: "xml",
|
|
666
|
+
plugins: [
|
|
667
|
+
"@prettier/plugin-xml"
|
|
668
|
+
]
|
|
669
|
+
}
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
}
|
|
506
674
|
if (options.markdown) {
|
|
507
675
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
676
|
+
let GLOB_SLIDEV;
|
|
677
|
+
if (options.slidev) {
|
|
678
|
+
GLOB_SLIDEV = options.slidev === true ? ["**/slides.md"] : options.slidev.files;
|
|
679
|
+
} else {
|
|
680
|
+
GLOB_SLIDEV = [];
|
|
681
|
+
}
|
|
508
682
|
configs2.push({
|
|
509
683
|
files: [GLOB_MARKDOWN],
|
|
684
|
+
ignores: GLOB_SLIDEV,
|
|
510
685
|
languageOptions: {
|
|
511
686
|
parser: parserPlain
|
|
512
687
|
},
|
|
513
688
|
name: "vinicunca/formatter/markdown",
|
|
514
689
|
rules: {
|
|
515
690
|
[`format/${formater}`]: [
|
|
516
|
-
|
|
691
|
+
ERROR,
|
|
517
692
|
formater === "prettier" ? {
|
|
518
693
|
printWidth: 120,
|
|
519
694
|
...prettierOptions,
|
|
520
|
-
embeddedLanguageFormatting:
|
|
695
|
+
embeddedLanguageFormatting: OFF,
|
|
521
696
|
parser: "markdown"
|
|
522
697
|
} : {
|
|
523
698
|
...dprintOptions,
|
|
@@ -526,17 +701,73 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
526
701
|
]
|
|
527
702
|
}
|
|
528
703
|
});
|
|
704
|
+
if (options.slidev) {
|
|
705
|
+
configs2.push({
|
|
706
|
+
files: GLOB_SLIDEV,
|
|
707
|
+
languageOptions: {
|
|
708
|
+
parser: parserPlain
|
|
709
|
+
},
|
|
710
|
+
name: "vinicunca/formatter/slidev",
|
|
711
|
+
rules: {
|
|
712
|
+
"format/prettier": [
|
|
713
|
+
ERROR,
|
|
714
|
+
{
|
|
715
|
+
...prettierOptions,
|
|
716
|
+
embeddedLanguageFormatting: "off",
|
|
717
|
+
parser: "slidev",
|
|
718
|
+
plugins: [
|
|
719
|
+
"prettier-plugin-slidev"
|
|
720
|
+
]
|
|
721
|
+
}
|
|
722
|
+
]
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
if (options.astro) {
|
|
728
|
+
configs2.push({
|
|
729
|
+
files: [GLOB_ASTRO],
|
|
730
|
+
languageOptions: {
|
|
731
|
+
parser: parserPlain
|
|
732
|
+
},
|
|
733
|
+
name: "vinicunca/formatter/astro",
|
|
734
|
+
rules: {
|
|
735
|
+
"format/prettier": [
|
|
736
|
+
ERROR,
|
|
737
|
+
{
|
|
738
|
+
...prettierOptions,
|
|
739
|
+
parser: "astro",
|
|
740
|
+
plugins: [
|
|
741
|
+
"prettier-plugin-astro"
|
|
742
|
+
]
|
|
743
|
+
}
|
|
744
|
+
]
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
configs2.push({
|
|
748
|
+
files: [GLOB_ASTRO, GLOB_ASTRO_TS],
|
|
749
|
+
name: "vinicunca/formatter/astro/disables",
|
|
750
|
+
rules: {
|
|
751
|
+
"style/arrow-parens": OFF,
|
|
752
|
+
"style/block-spacing": OFF,
|
|
753
|
+
"style/comma-dangle": OFF,
|
|
754
|
+
"style/indent": OFF,
|
|
755
|
+
"style/no-multi-spaces": OFF,
|
|
756
|
+
"style/quotes": OFF,
|
|
757
|
+
"style/semi": OFF
|
|
758
|
+
}
|
|
759
|
+
});
|
|
529
760
|
}
|
|
530
761
|
if (options.graphql) {
|
|
531
762
|
configs2.push({
|
|
532
|
-
files: [
|
|
763
|
+
files: [GLOB_GRAPHQL],
|
|
533
764
|
languageOptions: {
|
|
534
765
|
parser: parserPlain
|
|
535
766
|
},
|
|
536
767
|
name: "vinicunca/formatter/graphql",
|
|
537
768
|
rules: {
|
|
538
769
|
"format/prettier": [
|
|
539
|
-
|
|
770
|
+
ERROR,
|
|
540
771
|
{
|
|
541
772
|
...prettierOptions,
|
|
542
773
|
parser: "graphql"
|
|
@@ -558,7 +789,10 @@ async function ignores() {
|
|
|
558
789
|
}
|
|
559
790
|
|
|
560
791
|
// src/configs/imports.ts
|
|
561
|
-
async function imports() {
|
|
792
|
+
async function imports(options = {}) {
|
|
793
|
+
const {
|
|
794
|
+
stylistic: stylistic2 = true
|
|
795
|
+
} = options;
|
|
562
796
|
return [
|
|
563
797
|
{
|
|
564
798
|
name: "vinicunca/imports/rules",
|
|
@@ -567,19 +801,32 @@ async function imports() {
|
|
|
567
801
|
import: pluginImport
|
|
568
802
|
},
|
|
569
803
|
rules: {
|
|
804
|
+
"antfu/import-dedupe": ERROR,
|
|
805
|
+
"antfu/no-import-dist": ERROR,
|
|
806
|
+
"antfu/no-import-node-modules-by-path": ERROR,
|
|
570
807
|
"import/export": ERROR,
|
|
571
808
|
"import/first": ERROR,
|
|
572
|
-
"import/newline-after-import": [OFF, {
|
|
573
|
-
considerComments: true,
|
|
574
|
-
count: 1
|
|
575
|
-
}],
|
|
576
809
|
"import/no-duplicates": ERROR,
|
|
577
810
|
"import/no-mutable-exports": ERROR,
|
|
578
811
|
"import/no-named-default": ERROR,
|
|
579
812
|
"import/no-self-import": ERROR,
|
|
580
813
|
"import/no-webpack-loader-syntax": ERROR,
|
|
581
814
|
// Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-imports
|
|
582
|
-
"import/order": OFF
|
|
815
|
+
"import/order": OFF,
|
|
816
|
+
...stylistic2 ? {
|
|
817
|
+
"import/newline-after-import": [ERROR, {
|
|
818
|
+
count: 1,
|
|
819
|
+
considerComments: true
|
|
820
|
+
}]
|
|
821
|
+
} : {}
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
826
|
+
name: "vinicunca/imports/disables/bin",
|
|
827
|
+
rules: {
|
|
828
|
+
"antfu/no-import-dist": OFF,
|
|
829
|
+
"antfu/no-import-node-modules-by-path": OFF
|
|
583
830
|
}
|
|
584
831
|
}
|
|
585
832
|
];
|
|
@@ -887,8 +1134,8 @@ async function jsdoc(options = {}) {
|
|
|
887
1134
|
"jsdoc/require-yields-check": WARN,
|
|
888
1135
|
"jsdoc/valid-types": WARN,
|
|
889
1136
|
...stylistic2 ? {
|
|
890
|
-
"jsdoc/check-alignment":
|
|
891
|
-
"jsdoc/multiline-blocks":
|
|
1137
|
+
"jsdoc/check-alignment": WARN,
|
|
1138
|
+
"jsdoc/multiline-blocks": WARN
|
|
892
1139
|
} : {}
|
|
893
1140
|
}
|
|
894
1141
|
}
|
|
@@ -1113,21 +1360,40 @@ async function perfectionist() {
|
|
|
1113
1360
|
}
|
|
1114
1361
|
|
|
1115
1362
|
// src/configs/react.ts
|
|
1363
|
+
var import_local_pkg3 = require("local-pkg");
|
|
1364
|
+
var ReactRefreshAllowConstantExportPackages = [
|
|
1365
|
+
"vite"
|
|
1366
|
+
];
|
|
1367
|
+
var RemixPackages = [
|
|
1368
|
+
"@remix-run/node",
|
|
1369
|
+
"@remix-run/react",
|
|
1370
|
+
"@remix-run/serve",
|
|
1371
|
+
"@remix-run/dev"
|
|
1372
|
+
];
|
|
1373
|
+
var NextJsPackages = [
|
|
1374
|
+
"next"
|
|
1375
|
+
];
|
|
1116
1376
|
async function react(options = {}) {
|
|
1117
1377
|
const {
|
|
1118
1378
|
files = [GLOB_SRC],
|
|
1119
1379
|
overrides = {}
|
|
1120
1380
|
} = options;
|
|
1381
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1382
|
+
const isTypeAware = !!tsconfigPath;
|
|
1121
1383
|
const [
|
|
1122
1384
|
pluginReact,
|
|
1123
1385
|
pluginReactHooks,
|
|
1386
|
+
pluginReactRefresh,
|
|
1124
1387
|
parserTs
|
|
1125
1388
|
] = await Promise.all([
|
|
1126
1389
|
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1127
|
-
// @ts-expect-error missing types
|
|
1128
1390
|
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1391
|
+
interopDefault(import("eslint-plugin-react-refresh")),
|
|
1129
1392
|
interopDefault(import("@typescript-eslint/parser"))
|
|
1130
1393
|
]);
|
|
1394
|
+
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => (0, import_local_pkg3.isPackageExists)(i));
|
|
1395
|
+
const isUsingRemix = RemixPackages.some((i) => (0, import_local_pkg3.isPackageExists)(i));
|
|
1396
|
+
const isUsingNext = NextJsPackages.some((i) => (0, import_local_pkg3.isPackageExists)(i));
|
|
1131
1397
|
const plugins = pluginReact.configs.all.plugins;
|
|
1132
1398
|
return [
|
|
1133
1399
|
{
|
|
@@ -1135,12 +1401,10 @@ async function react(options = {}) {
|
|
|
1135
1401
|
plugins: {
|
|
1136
1402
|
"react": plugins["@eslint-react"],
|
|
1137
1403
|
"react-dom": plugins["@eslint-react/dom"],
|
|
1138
|
-
"react-hooks": pluginReactHooks
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
react:
|
|
1142
|
-
version: "detect"
|
|
1143
|
-
}
|
|
1404
|
+
"react-hooks": pluginReactHooks,
|
|
1405
|
+
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
1406
|
+
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1407
|
+
"react-refresh": pluginReactRefresh
|
|
1144
1408
|
}
|
|
1145
1409
|
},
|
|
1146
1410
|
{
|
|
@@ -1150,38 +1414,93 @@ async function react(options = {}) {
|
|
|
1150
1414
|
parserOptions: {
|
|
1151
1415
|
ecmaFeatures: {
|
|
1152
1416
|
jsx: true
|
|
1153
|
-
}
|
|
1417
|
+
},
|
|
1418
|
+
...isTypeAware ? { project: tsconfigPath } : {}
|
|
1154
1419
|
},
|
|
1155
1420
|
sourceType: "module"
|
|
1156
1421
|
},
|
|
1157
1422
|
name: "vinicunca/react/rules",
|
|
1158
1423
|
rules: {
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
"react/
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
"react/
|
|
1167
|
-
"react/
|
|
1168
|
-
"react/
|
|
1169
|
-
"react/
|
|
1170
|
-
"react/
|
|
1171
|
-
|
|
1172
|
-
"react/
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1424
|
+
// recommended rules from @eslint-react/dom
|
|
1425
|
+
"react-dom/no-children-in-void-dom-elements": WARN,
|
|
1426
|
+
"react-dom/no-dangerously-set-innerhtml": WARN,
|
|
1427
|
+
"react-dom/no-dangerously-set-innerhtml-with-children": ERROR,
|
|
1428
|
+
"react-dom/no-find-dom-node": ERROR,
|
|
1429
|
+
"react-dom/no-missing-button-type": WARN,
|
|
1430
|
+
"react-dom/no-missing-iframe-sandbox": WARN,
|
|
1431
|
+
"react-dom/no-namespace": ERROR,
|
|
1432
|
+
"react-dom/no-render-return-value": ERROR,
|
|
1433
|
+
"react-dom/no-script-url": WARN,
|
|
1434
|
+
"react-dom/no-unsafe-iframe-sandbox": WARN,
|
|
1435
|
+
"react-dom/no-unsafe-target-blank": WARN,
|
|
1436
|
+
// recommended rules react-hooks
|
|
1437
|
+
"react-hooks/exhaustive-deps": WARN,
|
|
1438
|
+
"react-hooks/rules-of-hooks": ERROR,
|
|
1439
|
+
// react refresh
|
|
1440
|
+
"react-refresh/only-export-components": [
|
|
1441
|
+
WARN,
|
|
1442
|
+
{
|
|
1443
|
+
allowConstantExport: isAllowConstantExport,
|
|
1444
|
+
allowExportNames: [
|
|
1445
|
+
...isUsingNext ? [
|
|
1446
|
+
"config",
|
|
1447
|
+
"generateStaticParams",
|
|
1448
|
+
"metadata",
|
|
1449
|
+
"generateMetadata",
|
|
1450
|
+
"viewport",
|
|
1451
|
+
"generateViewport"
|
|
1452
|
+
] : [],
|
|
1453
|
+
...isUsingRemix ? [
|
|
1454
|
+
"meta",
|
|
1455
|
+
"links",
|
|
1456
|
+
"headers",
|
|
1457
|
+
"loader",
|
|
1458
|
+
"action"
|
|
1459
|
+
] : []
|
|
1460
|
+
]
|
|
1461
|
+
}
|
|
1462
|
+
],
|
|
1463
|
+
// recommended rules from @eslint-react
|
|
1464
|
+
"react/ensure-forward-ref-using-ref": WARN,
|
|
1465
|
+
"react/no-access-state-in-setstate": ERROR,
|
|
1466
|
+
"react/no-array-index-key": WARN,
|
|
1467
|
+
"react/no-children-count": WARN,
|
|
1468
|
+
"react/no-children-for-each": WARN,
|
|
1469
|
+
"react/no-children-map": WARN,
|
|
1470
|
+
"react/no-children-only": WARN,
|
|
1471
|
+
"react/no-children-prop": WARN,
|
|
1472
|
+
"react/no-children-to-array": WARN,
|
|
1473
|
+
"react/no-clone-element": WARN,
|
|
1474
|
+
"react/no-comment-textnodes": WARN,
|
|
1475
|
+
"react/no-component-will-mount": ERROR,
|
|
1476
|
+
"react/no-component-will-receive-props": ERROR,
|
|
1477
|
+
"react/no-component-will-update": ERROR,
|
|
1478
|
+
"react/no-create-ref": ERROR,
|
|
1479
|
+
"react/no-direct-mutation-state": ERROR,
|
|
1480
|
+
"react/no-duplicate-key": ERROR,
|
|
1481
|
+
"react/no-implicit-key": ERROR,
|
|
1482
|
+
"react/no-missing-key": ERROR,
|
|
1483
|
+
"react/no-nested-components": WARN,
|
|
1484
|
+
"react/no-redundant-should-component-update": ERROR,
|
|
1485
|
+
"react/no-set-state-in-component-did-mount": WARN,
|
|
1486
|
+
"react/no-set-state-in-component-did-update": WARN,
|
|
1487
|
+
"react/no-set-state-in-component-will-update": WARN,
|
|
1488
|
+
"react/no-string-refs": ERROR,
|
|
1489
|
+
"react/no-unsafe-component-will-mount": WARN,
|
|
1490
|
+
"react/no-unsafe-component-will-receive-props": WARN,
|
|
1491
|
+
"react/no-unsafe-component-will-update": WARN,
|
|
1492
|
+
"react/no-unstable-context-value": ERROR,
|
|
1493
|
+
"react/no-unstable-default-props": ERROR,
|
|
1494
|
+
"react/no-unused-class-component-members": WARN,
|
|
1495
|
+
"react/no-unused-state": WARN,
|
|
1496
|
+
"react/no-useless-fragment": WARN,
|
|
1497
|
+
"react/prefer-destructuring-assignment": WARN,
|
|
1498
|
+
"react/prefer-shorthand-boolean": WARN,
|
|
1499
|
+
"react/prefer-shorthand-fragment": WARN,
|
|
1500
|
+
...isTypeAware ? {
|
|
1501
|
+
"react/no-leaked-conditional-rendering": WARN
|
|
1502
|
+
} : {},
|
|
1503
|
+
// overrides
|
|
1185
1504
|
...overrides
|
|
1186
1505
|
}
|
|
1187
1506
|
}
|
|
@@ -1214,6 +1533,79 @@ async function regexp(options = {}) {
|
|
|
1214
1533
|
];
|
|
1215
1534
|
}
|
|
1216
1535
|
|
|
1536
|
+
// src/configs/solid.ts
|
|
1537
|
+
async function solid(options = {}) {
|
|
1538
|
+
const {
|
|
1539
|
+
files = [GLOB_JSX, GLOB_TSX],
|
|
1540
|
+
overrides = {},
|
|
1541
|
+
typescript: typescript2 = true
|
|
1542
|
+
} = options;
|
|
1543
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1544
|
+
const isTypeAware = !!tsconfigPath;
|
|
1545
|
+
const [
|
|
1546
|
+
pluginSolid,
|
|
1547
|
+
parserTs
|
|
1548
|
+
] = await Promise.all([
|
|
1549
|
+
interopDefault(import("eslint-plugin-solid")),
|
|
1550
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
1551
|
+
]);
|
|
1552
|
+
return [
|
|
1553
|
+
{
|
|
1554
|
+
name: "vinicunca/solid/setup",
|
|
1555
|
+
plugins: {
|
|
1556
|
+
solid: pluginSolid
|
|
1557
|
+
}
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
files,
|
|
1561
|
+
languageOptions: {
|
|
1562
|
+
parser: parserTs,
|
|
1563
|
+
parserOptions: {
|
|
1564
|
+
ecmaFeatures: {
|
|
1565
|
+
jsx: true
|
|
1566
|
+
},
|
|
1567
|
+
...isTypeAware ? { project: tsconfigPath } : {}
|
|
1568
|
+
},
|
|
1569
|
+
sourceType: "module"
|
|
1570
|
+
},
|
|
1571
|
+
name: "vinicunca/solid/rules",
|
|
1572
|
+
rules: {
|
|
1573
|
+
// reactivity
|
|
1574
|
+
"solid/components-return-once": WARN,
|
|
1575
|
+
"solid/event-handlers": [ERROR, {
|
|
1576
|
+
// if true, don't warn on ambiguously named event handlers like `onclick` or `onchange`
|
|
1577
|
+
ignoreCase: false,
|
|
1578
|
+
// if true, warn when spreading event handlers onto JSX. Enable for Solid < v1.6.
|
|
1579
|
+
warnOnSpread: false
|
|
1580
|
+
}],
|
|
1581
|
+
// these rules are mostly style suggestions
|
|
1582
|
+
"solid/imports": ERROR,
|
|
1583
|
+
// identifier usage is important
|
|
1584
|
+
"solid/jsx-no-duplicate-props": ERROR,
|
|
1585
|
+
"solid/jsx-no-script-url": ERROR,
|
|
1586
|
+
"solid/jsx-no-undef": ERROR,
|
|
1587
|
+
"solid/jsx-uses-vars": ERROR,
|
|
1588
|
+
"solid/no-destructure": ERROR,
|
|
1589
|
+
// security problems
|
|
1590
|
+
"solid/no-innerhtml": [ERROR, { allowStatic: true }],
|
|
1591
|
+
"solid/no-react-deps": ERROR,
|
|
1592
|
+
"solid/no-react-specific-props": ERROR,
|
|
1593
|
+
"solid/no-unknown-namespaces": ERROR,
|
|
1594
|
+
"solid/prefer-for": ERROR,
|
|
1595
|
+
"solid/reactivity": WARN,
|
|
1596
|
+
"solid/self-closing-comp": ERROR,
|
|
1597
|
+
"solid/style-prop": [ERROR, { styleProps: ["style", "css"] }],
|
|
1598
|
+
...typescript2 ? {
|
|
1599
|
+
"solid/jsx-no-undef": [ERROR, { typescriptEnabled: true }],
|
|
1600
|
+
"solid/no-unknown-namespaces": OFF
|
|
1601
|
+
} : {},
|
|
1602
|
+
// overrides
|
|
1603
|
+
...overrides
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
];
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1217
1609
|
// src/configs/sonar.ts
|
|
1218
1610
|
async function sonar() {
|
|
1219
1611
|
return [
|
|
@@ -1462,6 +1854,102 @@ function sortTsconfig() {
|
|
|
1462
1854
|
];
|
|
1463
1855
|
}
|
|
1464
1856
|
|
|
1857
|
+
// src/configs/svelte.ts
|
|
1858
|
+
async function svelte(options = {}) {
|
|
1859
|
+
const {
|
|
1860
|
+
files = [GLOB_SVELTE],
|
|
1861
|
+
overrides = {},
|
|
1862
|
+
stylistic: stylistic2 = true
|
|
1863
|
+
} = options;
|
|
1864
|
+
const {
|
|
1865
|
+
indent = 2,
|
|
1866
|
+
quotes = "single"
|
|
1867
|
+
} = e(stylistic2) ? {} : stylistic2;
|
|
1868
|
+
const [
|
|
1869
|
+
pluginSvelte,
|
|
1870
|
+
parserSvelte
|
|
1871
|
+
] = await Promise.all([
|
|
1872
|
+
interopDefault(import("eslint-plugin-svelte")),
|
|
1873
|
+
interopDefault(import("svelte-eslint-parser"))
|
|
1874
|
+
]);
|
|
1875
|
+
return [
|
|
1876
|
+
{
|
|
1877
|
+
name: "vinicunca/svelte/setup",
|
|
1878
|
+
plugins: {
|
|
1879
|
+
svelte: pluginSvelte
|
|
1880
|
+
}
|
|
1881
|
+
},
|
|
1882
|
+
{
|
|
1883
|
+
files,
|
|
1884
|
+
languageOptions: {
|
|
1885
|
+
parser: parserSvelte,
|
|
1886
|
+
parserOptions: {
|
|
1887
|
+
extraFileExtensions: [".svelte"],
|
|
1888
|
+
parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null
|
|
1889
|
+
}
|
|
1890
|
+
},
|
|
1891
|
+
name: "vinicunca/svelte/rules",
|
|
1892
|
+
processor: pluginSvelte.processors[".svelte"],
|
|
1893
|
+
rules: {
|
|
1894
|
+
"import/no-mutable-exports": OFF,
|
|
1895
|
+
"no-undef": OFF,
|
|
1896
|
+
// incompatible with most recent (attribute-form) generic types RFC
|
|
1897
|
+
"no-unused-vars": [ERROR, {
|
|
1898
|
+
args: "none",
|
|
1899
|
+
caughtErrors: "none",
|
|
1900
|
+
ignoreRestSiblings: true,
|
|
1901
|
+
vars: "all",
|
|
1902
|
+
varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
|
|
1903
|
+
}],
|
|
1904
|
+
"svelte/comment-directive": ERROR,
|
|
1905
|
+
"svelte/no-at-debug-tags": "warn",
|
|
1906
|
+
"svelte/no-at-html-tags": ERROR,
|
|
1907
|
+
"svelte/no-dupe-else-if-blocks": ERROR,
|
|
1908
|
+
"svelte/no-dupe-style-properties": ERROR,
|
|
1909
|
+
"svelte/no-dupe-use-directives": ERROR,
|
|
1910
|
+
"svelte/no-dynamic-slot-name": ERROR,
|
|
1911
|
+
"svelte/no-export-load-in-svelte-module-in-kit-pages": ERROR,
|
|
1912
|
+
"svelte/no-inner-declarations": ERROR,
|
|
1913
|
+
"svelte/no-not-function-handler": ERROR,
|
|
1914
|
+
"svelte/no-object-in-text-mustaches": ERROR,
|
|
1915
|
+
"svelte/no-reactive-functions": ERROR,
|
|
1916
|
+
"svelte/no-reactive-literals": ERROR,
|
|
1917
|
+
"svelte/no-shorthand-style-property-overrides": ERROR,
|
|
1918
|
+
"svelte/no-unknown-style-directive-property": ERROR,
|
|
1919
|
+
"svelte/no-unused-svelte-ignore": ERROR,
|
|
1920
|
+
"svelte/no-useless-mustaches": ERROR,
|
|
1921
|
+
"svelte/require-store-callbacks-use-set-param": ERROR,
|
|
1922
|
+
"svelte/system": ERROR,
|
|
1923
|
+
"svelte/valid-each-key": ERROR,
|
|
1924
|
+
"unused-imports/no-unused-vars": [
|
|
1925
|
+
ERROR,
|
|
1926
|
+
{
|
|
1927
|
+
args: "after-used",
|
|
1928
|
+
argsIgnorePattern: "^_",
|
|
1929
|
+
vars: "all",
|
|
1930
|
+
varsIgnorePattern: "^(_|\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
|
|
1931
|
+
}
|
|
1932
|
+
],
|
|
1933
|
+
...stylistic2 ? {
|
|
1934
|
+
"style/indent": OFF,
|
|
1935
|
+
// superseded by svelte/indent
|
|
1936
|
+
"style/no-trailing-spaces": OFF,
|
|
1937
|
+
// superseded by svelte/no-trailing-spaces
|
|
1938
|
+
"svelte/derived-has-same-inputs-outputs": ERROR,
|
|
1939
|
+
"svelte/html-closing-bracket-spacing": ERROR,
|
|
1940
|
+
"svelte/html-quotes": [ERROR, { prefer: quotes }],
|
|
1941
|
+
"svelte/indent": [ERROR, { alignAttributesVertically: true, indent }],
|
|
1942
|
+
"svelte/mustache-spacing": ERROR,
|
|
1943
|
+
"svelte/no-spaces-around-equal-signs-in-attribute": ERROR,
|
|
1944
|
+
"svelte/no-trailing-spaces": ERROR,
|
|
1945
|
+
"svelte/spaced-html-comment": ERROR
|
|
1946
|
+
} : {},
|
|
1947
|
+
...overrides
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
];
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1465
1953
|
// src/configs/test.ts
|
|
1466
1954
|
var _pluginTest;
|
|
1467
1955
|
async function test(options = {}) {
|
|
@@ -1509,21 +1997,84 @@ async function test(options = {}) {
|
|
|
1509
1997
|
];
|
|
1510
1998
|
}
|
|
1511
1999
|
|
|
2000
|
+
// src/configs/toml.ts
|
|
2001
|
+
async function toml(options = {}) {
|
|
2002
|
+
const {
|
|
2003
|
+
files = [GLOB_TOML],
|
|
2004
|
+
overrides = {},
|
|
2005
|
+
stylistic: stylistic2 = true
|
|
2006
|
+
} = options;
|
|
2007
|
+
const {
|
|
2008
|
+
indent = 2
|
|
2009
|
+
} = e(stylistic2) ? {} : stylistic2;
|
|
2010
|
+
const [
|
|
2011
|
+
pluginToml,
|
|
2012
|
+
parserToml
|
|
2013
|
+
] = await Promise.all([
|
|
2014
|
+
interopDefault(import("eslint-plugin-toml")),
|
|
2015
|
+
interopDefault(import("toml-eslint-parser"))
|
|
2016
|
+
]);
|
|
2017
|
+
return [
|
|
2018
|
+
{
|
|
2019
|
+
name: "vinicunca/toml/setup",
|
|
2020
|
+
plugins: {
|
|
2021
|
+
toml: pluginToml
|
|
2022
|
+
}
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
files,
|
|
2026
|
+
languageOptions: {
|
|
2027
|
+
parser: parserToml
|
|
2028
|
+
},
|
|
2029
|
+
name: "vinicunca/toml/rules",
|
|
2030
|
+
rules: {
|
|
2031
|
+
"style/spaced-comment": OFF,
|
|
2032
|
+
"toml/comma-style": ERROR,
|
|
2033
|
+
"toml/keys-order": ERROR,
|
|
2034
|
+
"toml/no-space-dots": ERROR,
|
|
2035
|
+
"toml/no-unreadable-number-separator": ERROR,
|
|
2036
|
+
"toml/precision-of-fractional-seconds": ERROR,
|
|
2037
|
+
"toml/precision-of-integer": ERROR,
|
|
2038
|
+
"toml/tables-order": ERROR,
|
|
2039
|
+
"toml/vue-custom-block/no-parsing-error": ERROR,
|
|
2040
|
+
...stylistic2 ? {
|
|
2041
|
+
"toml/array-bracket-newline": ERROR,
|
|
2042
|
+
"toml/array-bracket-spacing": ERROR,
|
|
2043
|
+
"toml/array-element-newline": ERROR,
|
|
2044
|
+
"toml/indent": [ERROR, indent === "tab" ? 2 : indent],
|
|
2045
|
+
"toml/inline-table-curly-spacing": ERROR,
|
|
2046
|
+
"toml/key-spacing": ERROR,
|
|
2047
|
+
"toml/padding-line-between-pairs": ERROR,
|
|
2048
|
+
"toml/padding-line-between-tables": ERROR,
|
|
2049
|
+
"toml/quoted-keys": ERROR,
|
|
2050
|
+
"toml/spaced-comment": ERROR,
|
|
2051
|
+
"toml/table-bracket-spacing": ERROR
|
|
2052
|
+
} : {},
|
|
2053
|
+
...overrides
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
];
|
|
2057
|
+
}
|
|
2058
|
+
|
|
1512
2059
|
// src/configs/typescript.ts
|
|
1513
2060
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
1514
2061
|
async function typescript(options = {}) {
|
|
1515
2062
|
const {
|
|
1516
2063
|
componentExts = [],
|
|
1517
2064
|
overrides = {},
|
|
1518
|
-
|
|
2065
|
+
overridesTypeAware = {},
|
|
2066
|
+
parserOptions = {},
|
|
2067
|
+
type = "app"
|
|
1519
2068
|
} = options ?? {};
|
|
1520
2069
|
const files = options.files ?? [
|
|
1521
|
-
|
|
2070
|
+
GLOB_TS,
|
|
2071
|
+
GLOB_TSX,
|
|
1522
2072
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1523
2073
|
];
|
|
1524
2074
|
const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
|
|
1525
2075
|
const ignoresTypeAware = options.ignoresTypeAware ?? [
|
|
1526
|
-
`${GLOB_MARKDOWN}
|
|
2076
|
+
`${GLOB_MARKDOWN}/**`,
|
|
2077
|
+
GLOB_ASTRO_TS
|
|
1527
2078
|
];
|
|
1528
2079
|
const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
|
|
1529
2080
|
const isTypeAware = !!tsconfigPath;
|
|
@@ -1543,7 +2094,7 @@ async function typescript(options = {}) {
|
|
|
1543
2094
|
"ts/no-unsafe-call": ERROR,
|
|
1544
2095
|
"ts/no-unsafe-member-access": ERROR,
|
|
1545
2096
|
"ts/no-unsafe-return": ERROR,
|
|
1546
|
-
"ts/promise-function-async":
|
|
2097
|
+
"ts/promise-function-async": ERROR,
|
|
1547
2098
|
"ts/restrict-plus-operands": ERROR,
|
|
1548
2099
|
"ts/restrict-template-expressions": ERROR,
|
|
1549
2100
|
"ts/return-await": [ERROR, "in-try-catch"],
|
|
@@ -1616,10 +2167,9 @@ async function typescript(options = {}) {
|
|
|
1616
2167
|
"no-use-before-define": OFF,
|
|
1617
2168
|
"no-useless-constructor": OFF,
|
|
1618
2169
|
"ts/array-type": [ERROR, { default: "generic" }],
|
|
1619
|
-
"ts/ban-ts-comment": [
|
|
2170
|
+
"ts/ban-ts-comment": [ERROR, { "ts-expect-error": "allow-with-description" }],
|
|
1620
2171
|
"ts/consistent-type-definitions": [ERROR, "interface"],
|
|
1621
2172
|
"ts/consistent-type-imports": [ERROR, { disallowTypeAnnotations: false, prefer: "type-imports" }],
|
|
1622
|
-
"ts/explicit-function-return-type": OFF,
|
|
1623
2173
|
"ts/explicit-member-accessibility": OFF,
|
|
1624
2174
|
"ts/explicit-module-boundary-types": OFF,
|
|
1625
2175
|
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
@@ -1628,7 +2178,7 @@ async function typescript(options = {}) {
|
|
|
1628
2178
|
"ts/no-dupe-class-members": ERROR,
|
|
1629
2179
|
"ts/no-empty-function": OFF,
|
|
1630
2180
|
"ts/no-empty-interface": OFF,
|
|
1631
|
-
"ts/no-empty-object-type": [
|
|
2181
|
+
"ts/no-empty-object-type": [ERROR, { allowInterfaces: "always" }],
|
|
1632
2182
|
"ts/no-explicit-any": OFF,
|
|
1633
2183
|
"ts/no-import-type-side-effects": ERROR,
|
|
1634
2184
|
"ts/no-invalid-this": ERROR,
|
|
@@ -1647,14 +2197,13 @@ async function typescript(options = {}) {
|
|
|
1647
2197
|
"ts/parameter-properties": OFF,
|
|
1648
2198
|
"ts/prefer-ts-expect-error": ERROR,
|
|
1649
2199
|
"ts/triple-slash-reference": OFF,
|
|
1650
|
-
...
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
...tsconfigPath ? typeAwareRules : {},
|
|
2200
|
+
...type === "lib" ? {
|
|
2201
|
+
"ts/explicit-function-return-type": [ERROR, {
|
|
2202
|
+
allowExpressions: true,
|
|
2203
|
+
allowHigherOrderFunctions: true,
|
|
2204
|
+
allowIIFEs: true
|
|
2205
|
+
}]
|
|
2206
|
+
} : {},
|
|
1658
2207
|
...overrides
|
|
1659
2208
|
}
|
|
1660
2209
|
},
|
|
@@ -1662,7 +2211,10 @@ async function typescript(options = {}) {
|
|
|
1662
2211
|
files: filesTypeAware,
|
|
1663
2212
|
ignores: ignoresTypeAware,
|
|
1664
2213
|
name: "vinicunca/typescript/rules-type-aware",
|
|
1665
|
-
rules:
|
|
2214
|
+
rules: {
|
|
2215
|
+
...typeAwareRules,
|
|
2216
|
+
...overridesTypeAware
|
|
2217
|
+
}
|
|
1666
2218
|
}] : [],
|
|
1667
2219
|
{
|
|
1668
2220
|
files: ["**/*.d.?([cm])ts"],
|
|
@@ -1670,7 +2222,7 @@ async function typescript(options = {}) {
|
|
|
1670
2222
|
rules: {
|
|
1671
2223
|
"eslint-comments/no-unlimited-disable": OFF,
|
|
1672
2224
|
"import/no-duplicates": OFF,
|
|
1673
|
-
"no-restricted-syntax":
|
|
2225
|
+
"no-restricted-syntax": OFF,
|
|
1674
2226
|
"unused-imports/no-unused-vars": OFF
|
|
1675
2227
|
}
|
|
1676
2228
|
},
|
|
@@ -1737,12 +2289,12 @@ async function unocss(options = {}) {
|
|
|
1737
2289
|
unocss: pluginUnoCSS
|
|
1738
2290
|
},
|
|
1739
2291
|
rules: {
|
|
1740
|
-
"unocss/order":
|
|
2292
|
+
"unocss/order": WARN,
|
|
1741
2293
|
...attributify ? {
|
|
1742
|
-
"unocss/order-attributify":
|
|
2294
|
+
"unocss/order-attributify": WARN
|
|
1743
2295
|
} : {},
|
|
1744
2296
|
...strict ? {
|
|
1745
|
-
"unocss/blocklist":
|
|
2297
|
+
"unocss/blocklist": ERROR
|
|
1746
2298
|
} : {}
|
|
1747
2299
|
}
|
|
1748
2300
|
}
|
|
@@ -1776,6 +2328,26 @@ async function vue(options = {}) {
|
|
|
1776
2328
|
name: "vinicunca/vue/setup",
|
|
1777
2329
|
plugins: {
|
|
1778
2330
|
vue: pluginVue
|
|
2331
|
+
},
|
|
2332
|
+
// This allows Vue plugin to work with auto imports
|
|
2333
|
+
// https://github.com/vuejs/eslint-plugin-vue/pull/2422
|
|
2334
|
+
languageOptions: {
|
|
2335
|
+
globals: {
|
|
2336
|
+
computed: "readonly",
|
|
2337
|
+
defineEmits: "readonly",
|
|
2338
|
+
defineExpose: "readonly",
|
|
2339
|
+
defineProps: "readonly",
|
|
2340
|
+
onMounted: "readonly",
|
|
2341
|
+
onUnmounted: "readonly",
|
|
2342
|
+
reactive: "readonly",
|
|
2343
|
+
ref: "readonly",
|
|
2344
|
+
shallowReactive: "readonly",
|
|
2345
|
+
shallowRef: "readonly",
|
|
2346
|
+
toRef: "readonly",
|
|
2347
|
+
toRefs: "readonly",
|
|
2348
|
+
watch: "readonly",
|
|
2349
|
+
watchEffect: "readonly"
|
|
2350
|
+
}
|
|
1779
2351
|
}
|
|
1780
2352
|
},
|
|
1781
2353
|
{
|
|
@@ -1979,6 +2551,10 @@ var VuePackages = [
|
|
|
1979
2551
|
"@slidev/cli"
|
|
1980
2552
|
];
|
|
1981
2553
|
var defaultPluginRenaming = {
|
|
2554
|
+
"@eslint-react": "react",
|
|
2555
|
+
"@eslint-react/dom": "react-dom",
|
|
2556
|
+
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
2557
|
+
"@eslint-react/naming-convention": "react-naming-convention",
|
|
1982
2558
|
"@stylistic": "style",
|
|
1983
2559
|
"@typescript-eslint": "ts",
|
|
1984
2560
|
"import-x": "import",
|
|
@@ -1989,35 +2565,43 @@ var defaultPluginRenaming = {
|
|
|
1989
2565
|
};
|
|
1990
2566
|
function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
1991
2567
|
const {
|
|
2568
|
+
astro: enableAstro = false,
|
|
1992
2569
|
autoRenamePlugins = true,
|
|
1993
2570
|
componentExts = [],
|
|
1994
2571
|
gitignore: enableGitignore = true,
|
|
1995
|
-
isInEditor = isInEditorEnv(),
|
|
1996
2572
|
jsx: enableJsx = true,
|
|
1997
2573
|
react: enableReact = false,
|
|
1998
2574
|
regexp: enableRegexp = true,
|
|
1999
|
-
|
|
2575
|
+
solid: enableSolid = false,
|
|
2576
|
+
svelte: enableSvelte = false,
|
|
2577
|
+
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
2000
2578
|
unocss: enableUnoCSS = false,
|
|
2001
|
-
vue: enableVue = VuePackages.some((i) => (0,
|
|
2579
|
+
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
|
|
2002
2580
|
} = options;
|
|
2581
|
+
let isInEditor = options.isInEditor;
|
|
2582
|
+
if (isInEditor == null) {
|
|
2583
|
+
isInEditor = isInEditorEnv();
|
|
2584
|
+
if (isInEditor) {
|
|
2585
|
+
console.log("[@antfu/eslint-config] Detected running in editor, some rules are disabled.");
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2003
2588
|
let stylisticOptions = {};
|
|
2004
2589
|
if (options.stylistic === false) {
|
|
2005
2590
|
stylisticOptions = false;
|
|
2006
2591
|
} else if (r(options.stylistic)) {
|
|
2007
|
-
stylisticOptions =
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
};
|
|
2592
|
+
stylisticOptions = options.stylistic;
|
|
2593
|
+
} else {
|
|
2594
|
+
stylisticOptions = {};
|
|
2011
2595
|
}
|
|
2012
2596
|
if (stylisticOptions && !("jsx" in stylisticOptions)) {
|
|
2013
2597
|
stylisticOptions.jsx = enableJsx;
|
|
2014
2598
|
}
|
|
2015
2599
|
const configs2 = [];
|
|
2016
2600
|
if (enableGitignore) {
|
|
2017
|
-
if (
|
|
2601
|
+
if (!e(enableGitignore)) {
|
|
2018
2602
|
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r2) => [r2(enableGitignore)]));
|
|
2019
2603
|
} else {
|
|
2020
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r2) => [r2()]));
|
|
2604
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r2) => [r2({ strict: false })]));
|
|
2021
2605
|
}
|
|
2022
2606
|
}
|
|
2023
2607
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
@@ -2033,8 +2617,11 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2033
2617
|
jsdoc({
|
|
2034
2618
|
stylistic: stylisticOptions
|
|
2035
2619
|
}),
|
|
2036
|
-
imports(
|
|
2620
|
+
imports({
|
|
2621
|
+
stylistic: stylisticOptions
|
|
2622
|
+
}),
|
|
2037
2623
|
unicorn(),
|
|
2624
|
+
command(),
|
|
2038
2625
|
perfectionist(),
|
|
2039
2626
|
sonar()
|
|
2040
2627
|
);
|
|
@@ -2048,7 +2635,8 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2048
2635
|
configs2.push(typescript({
|
|
2049
2636
|
...typescriptOptions,
|
|
2050
2637
|
componentExts,
|
|
2051
|
-
overrides: getOverrides(options, "typescript")
|
|
2638
|
+
overrides: getOverrides(options, "typescript"),
|
|
2639
|
+
type: options.type
|
|
2052
2640
|
}));
|
|
2053
2641
|
}
|
|
2054
2642
|
if (stylisticOptions) {
|
|
@@ -2058,7 +2646,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2058
2646
|
}));
|
|
2059
2647
|
}
|
|
2060
2648
|
if (enableRegexp) {
|
|
2061
|
-
configs2.push(regexp(
|
|
2649
|
+
configs2.push(regexp(e(enableRegexp) ? {} : enableRegexp));
|
|
2062
2650
|
}
|
|
2063
2651
|
if (options.test ?? true) {
|
|
2064
2652
|
configs2.push(test({
|
|
@@ -2080,12 +2668,32 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2080
2668
|
tsconfigPath
|
|
2081
2669
|
}));
|
|
2082
2670
|
}
|
|
2671
|
+
if (enableSolid) {
|
|
2672
|
+
configs2.push(solid({
|
|
2673
|
+
overrides: getOverrides(options, "solid"),
|
|
2674
|
+
tsconfigPath,
|
|
2675
|
+
typescript: !!enableTypeScript
|
|
2676
|
+
}));
|
|
2677
|
+
}
|
|
2678
|
+
if (enableSvelte) {
|
|
2679
|
+
configs2.push(svelte({
|
|
2680
|
+
overrides: getOverrides(options, "svelte"),
|
|
2681
|
+
stylistic: stylisticOptions,
|
|
2682
|
+
typescript: !!enableTypeScript
|
|
2683
|
+
}));
|
|
2684
|
+
}
|
|
2083
2685
|
if (enableUnoCSS) {
|
|
2084
2686
|
configs2.push(unocss({
|
|
2085
2687
|
...resolveSubOptions(options, "unocss"),
|
|
2086
2688
|
overrides: getOverrides(options, "unocss")
|
|
2087
2689
|
}));
|
|
2088
2690
|
}
|
|
2691
|
+
if (enableAstro) {
|
|
2692
|
+
configs2.push(astro({
|
|
2693
|
+
overrides: getOverrides(options, "astro"),
|
|
2694
|
+
stylistic: stylisticOptions
|
|
2695
|
+
}));
|
|
2696
|
+
}
|
|
2089
2697
|
if (options.jsonc ?? true) {
|
|
2090
2698
|
configs2.push(
|
|
2091
2699
|
jsonc({
|
|
@@ -2102,6 +2710,12 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2102
2710
|
stylistic: stylisticOptions
|
|
2103
2711
|
}));
|
|
2104
2712
|
}
|
|
2713
|
+
if (options.toml ?? true) {
|
|
2714
|
+
configs2.push(toml({
|
|
2715
|
+
overrides: getOverrides(options, "toml"),
|
|
2716
|
+
stylistic: stylisticOptions
|
|
2717
|
+
}));
|
|
2718
|
+
}
|
|
2105
2719
|
if (options.markdown ?? true) {
|
|
2106
2720
|
configs2.push(
|
|
2107
2721
|
markdown(
|
|
@@ -2115,7 +2729,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2115
2729
|
if (options.formatters) {
|
|
2116
2730
|
configs2.push(formatters(
|
|
2117
2731
|
options.formatters,
|
|
2118
|
-
|
|
2732
|
+
e(stylisticOptions) ? {} : stylisticOptions
|
|
2119
2733
|
));
|
|
2120
2734
|
}
|
|
2121
2735
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
@@ -2139,20 +2753,23 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2139
2753
|
}
|
|
2140
2754
|
return composer;
|
|
2141
2755
|
}
|
|
2756
|
+
function resolveSubOptions(options, key) {
|
|
2757
|
+
return e(options[key]) ? {} : options[key] || {};
|
|
2758
|
+
}
|
|
2142
2759
|
function getOverrides(options, key) {
|
|
2143
2760
|
const sub = resolveSubOptions(options, key);
|
|
2144
2761
|
return {
|
|
2145
2762
|
..."overrides" in sub ? sub.overrides : {}
|
|
2146
2763
|
};
|
|
2147
2764
|
}
|
|
2148
|
-
function resolveSubOptions(options, key) {
|
|
2149
|
-
return e(options[key]) ? {} : options[key] || {};
|
|
2150
|
-
}
|
|
2151
2765
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2152
2766
|
0 && (module.exports = {
|
|
2153
2767
|
GLOB_ALL_SRC,
|
|
2768
|
+
GLOB_ASTRO,
|
|
2769
|
+
GLOB_ASTRO_TS,
|
|
2154
2770
|
GLOB_CSS,
|
|
2155
2771
|
GLOB_EXCLUDE,
|
|
2772
|
+
GLOB_GRAPHQL,
|
|
2156
2773
|
GLOB_HTML,
|
|
2157
2774
|
GLOB_JS,
|
|
2158
2775
|
GLOB_JSON,
|
|
@@ -2168,20 +2785,29 @@ function resolveSubOptions(options, key) {
|
|
|
2168
2785
|
GLOB_SRC,
|
|
2169
2786
|
GLOB_SRC_EXT,
|
|
2170
2787
|
GLOB_STYLE,
|
|
2788
|
+
GLOB_SVELTE,
|
|
2789
|
+
GLOB_SVG,
|
|
2171
2790
|
GLOB_TESTS,
|
|
2791
|
+
GLOB_TOML,
|
|
2172
2792
|
GLOB_TS,
|
|
2173
2793
|
GLOB_TSX,
|
|
2174
2794
|
GLOB_VUE,
|
|
2795
|
+
GLOB_XML,
|
|
2175
2796
|
GLOB_YAML,
|
|
2176
2797
|
STYLISTIC_CONFIG_DEFAULTS,
|
|
2798
|
+
astro,
|
|
2177
2799
|
combineConfigs,
|
|
2800
|
+
command,
|
|
2178
2801
|
comments,
|
|
2179
2802
|
defaultPluginRenaming,
|
|
2803
|
+
ensurePackages,
|
|
2180
2804
|
formatters,
|
|
2181
2805
|
ignores,
|
|
2182
2806
|
imports,
|
|
2183
2807
|
interopDefault,
|
|
2184
2808
|
isInEditorEnv,
|
|
2809
|
+
isInGitHooksOrLintStaged,
|
|
2810
|
+
isPackageInScope,
|
|
2185
2811
|
javascript,
|
|
2186
2812
|
jsdoc,
|
|
2187
2813
|
jsonc,
|
|
@@ -2202,11 +2828,15 @@ function resolveSubOptions(options, key) {
|
|
|
2202
2828
|
regexp,
|
|
2203
2829
|
renamePluginInConfigs,
|
|
2204
2830
|
renameRules,
|
|
2831
|
+
solid,
|
|
2205
2832
|
sonar,
|
|
2206
2833
|
sortPackageJson,
|
|
2207
2834
|
sortTsconfig,
|
|
2208
2835
|
stylistic,
|
|
2836
|
+
svelte,
|
|
2209
2837
|
test,
|
|
2838
|
+
toArray,
|
|
2839
|
+
toml,
|
|
2210
2840
|
typescript,
|
|
2211
2841
|
unicorn,
|
|
2212
2842
|
unocss,
|