@lincy/eslint-config 5.8.1 → 5.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 +43 -24
- package/dist/index.d.cts +417 -191
- package/dist/index.d.ts +417 -191
- package/dist/index.js +13 -9
- package/package.json +37 -37
package/dist/index.cjs
CHANGED
|
@@ -22,21 +22,36 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
let eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
26
|
+
eslint_flat_config_utils = __toESM(eslint_flat_config_utils);
|
|
27
|
+
let local_pkg = require("local-pkg");
|
|
28
|
+
local_pkg = __toESM(local_pkg);
|
|
29
|
+
let __eslint_community_eslint_plugin_eslint_comments = require("@eslint-community/eslint-plugin-eslint-comments");
|
|
30
|
+
__eslint_community_eslint_plugin_eslint_comments = __toESM(__eslint_community_eslint_plugin_eslint_comments);
|
|
31
|
+
let eslint_plugin_antfu = require("eslint-plugin-antfu");
|
|
32
|
+
eslint_plugin_antfu = __toESM(eslint_plugin_antfu);
|
|
33
|
+
let eslint_plugin_import_lite = require("eslint-plugin-import-lite");
|
|
34
|
+
eslint_plugin_import_lite = __toESM(eslint_plugin_import_lite);
|
|
35
|
+
let eslint_plugin_n = require("eslint-plugin-n");
|
|
36
|
+
eslint_plugin_n = __toESM(eslint_plugin_n);
|
|
37
|
+
let eslint_plugin_perfectionist = require("eslint-plugin-perfectionist");
|
|
38
|
+
eslint_plugin_perfectionist = __toESM(eslint_plugin_perfectionist);
|
|
39
|
+
let eslint_plugin_unicorn = require("eslint-plugin-unicorn");
|
|
40
|
+
eslint_plugin_unicorn = __toESM(eslint_plugin_unicorn);
|
|
41
|
+
let eslint_plugin_unused_imports = require("eslint-plugin-unused-imports");
|
|
42
|
+
eslint_plugin_unused_imports = __toESM(eslint_plugin_unused_imports);
|
|
43
|
+
let node_process = require("node:process");
|
|
44
|
+
node_process = __toESM(node_process);
|
|
45
|
+
let node_url = require("node:url");
|
|
46
|
+
node_url = __toESM(node_url);
|
|
47
|
+
let globals = require("globals");
|
|
48
|
+
globals = __toESM(globals);
|
|
49
|
+
let eslint_merge_processors = require("eslint-merge-processors");
|
|
50
|
+
eslint_merge_processors = __toESM(eslint_merge_processors);
|
|
51
|
+
let eslint_parser_plain = require("eslint-parser-plain");
|
|
52
|
+
eslint_parser_plain = __toESM(eslint_parser_plain);
|
|
53
|
+
let eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
54
|
+
eslint_plugin_regexp = __toESM(eslint_plugin_regexp);
|
|
40
55
|
|
|
41
56
|
//#region src/configs/comments.ts
|
|
42
57
|
async function comments(options = {}) {
|
|
@@ -211,8 +226,7 @@ const parserPlain = {
|
|
|
211
226
|
* Combine array and non-array configs into a single array.
|
|
212
227
|
*/
|
|
213
228
|
async function combine(...configs$1) {
|
|
214
|
-
|
|
215
|
-
return resolved.flat();
|
|
229
|
+
return (await Promise.all(configs$1)).flat();
|
|
216
230
|
}
|
|
217
231
|
function renameRules(rules, map) {
|
|
218
232
|
return Object.fromEntries(Object.entries(rules).map(([key, value]) => {
|
|
@@ -245,9 +259,7 @@ async function ensurePackages(packages) {
|
|
|
245
259
|
if (node_process.default.env.CI || node_process.default.stdout.isTTY === false || isCwdInScope === false) return;
|
|
246
260
|
const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
|
|
247
261
|
if (nonExistingPackages.length === 0) return;
|
|
248
|
-
|
|
249
|
-
const result = await p.confirm({ message: `此配置需要软件包: ${nonExistingPackages.join(", ")}. 你想安装它们吗?` });
|
|
250
|
-
if (result) await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
262
|
+
if (await (await import("@clack/prompts")).confirm({ message: `此配置需要软件包: ${nonExistingPackages.join(", ")}. 你想安装它们吗?` })) await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
251
263
|
}
|
|
252
264
|
function isInEditorEnv() {
|
|
253
265
|
if (node_process.default.env.CI) return false;
|
|
@@ -366,10 +378,9 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
366
378
|
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
367
379
|
useTabs: indent === "tab"
|
|
368
380
|
}, options.dprintOptions || {});
|
|
369
|
-
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
370
381
|
const configs$1 = [{
|
|
371
382
|
name: "eslint/formatter/setup",
|
|
372
|
-
plugins: { format:
|
|
383
|
+
plugins: { format: await interopDefault(import("eslint-plugin-format")) }
|
|
373
384
|
}];
|
|
374
385
|
if (options.css) configs$1.push({
|
|
375
386
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
@@ -483,7 +494,7 @@ async function javascript(options = {}) {
|
|
|
483
494
|
const { isInEditor = false, overrides = {} } = options;
|
|
484
495
|
return [{
|
|
485
496
|
languageOptions: {
|
|
486
|
-
ecmaVersion:
|
|
497
|
+
ecmaVersion: "latest",
|
|
487
498
|
globals: {
|
|
488
499
|
...globals.default.browser,
|
|
489
500
|
...globals.default.es2021,
|
|
@@ -494,7 +505,7 @@ async function javascript(options = {}) {
|
|
|
494
505
|
},
|
|
495
506
|
parserOptions: {
|
|
496
507
|
ecmaFeatures: { jsx: true },
|
|
497
|
-
ecmaVersion:
|
|
508
|
+
ecmaVersion: "latest",
|
|
498
509
|
sourceType: "module"
|
|
499
510
|
},
|
|
500
511
|
sourceType: "module"
|
|
@@ -1272,6 +1283,14 @@ async function sortPackageJson() {
|
|
|
1272
1283
|
order: { type: "asc" },
|
|
1273
1284
|
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
1274
1285
|
},
|
|
1286
|
+
{
|
|
1287
|
+
order: { type: "asc" },
|
|
1288
|
+
pathPattern: "^workspaces\\.catalog$"
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
order: { type: "asc" },
|
|
1292
|
+
pathPattern: "^workspaces\\.catalogs\\.[^.]+$"
|
|
1293
|
+
},
|
|
1275
1294
|
{
|
|
1276
1295
|
order: [
|
|
1277
1296
|
"types",
|