@so1ve/eslint-config 3.22.2 → 3.23.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.d.ts → index.d.mts} +37 -5
- package/dist/{index.js → index.mjs} +165 -67
- package/package.json +11 -9
|
@@ -400,6 +400,11 @@ interface RuleOptions {
|
|
|
400
400
|
* @deprecated
|
|
401
401
|
*/
|
|
402
402
|
'comma-style'?: Linter.RuleEntry<CommaStyle>;
|
|
403
|
+
/**
|
|
404
|
+
* Comment-as-command for one-off codemod with ESLint
|
|
405
|
+
* @see https://github.com/antfu/eslint-plugin-command
|
|
406
|
+
*/
|
|
407
|
+
'command/command'?: Linter.RuleEntry<[]>;
|
|
403
408
|
/**
|
|
404
409
|
* Enforce a maximum cyclomatic complexity allowed in a program
|
|
405
410
|
* @see https://eslint.org/docs/latest/rules/complexity
|
|
@@ -16288,7 +16293,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
|
|
|
16288
16293
|
onlyEquality?: boolean;
|
|
16289
16294
|
}];
|
|
16290
16295
|
// Names of all the configs
|
|
16291
|
-
type ConfigNames = '
|
|
16296
|
+
type ConfigNames = 'so1ve/ignores' | 'so1ve/javascript/setup' | 'so1ve/javascript/rules' | 'so1ve/javascript/regexp' | 'so1ve/javascript/cli' | 'so1ve/comments/setup' | 'so1ve/comments/rules' | 'so1ve/node/setup' | 'so1ve/node/rules' | 'so1ve/only-error' | 'so1ve/promise/setup' | 'so1ve/promise/rules' | 'so1ve/sort-imports/setup' | 'so1ve/sort-imports/rules' | 'so1ve/imports/setup' | 'so1ve/imports/rules' | 'so1ve/imports/rules/dts' | 'so1ve/unicorn/setup' | 'so1ve/unicorn/rules' | 'so1ve/command/rules' | 'so1ve/pnpm/package-json' | 'so1ve/pnpm/pnpm-workspace-yaml' | 'so1ve/yaml/pnpm-workspace-yaml-sort' | 'so1ve/html/setup' | 'so1ve/html/rules' | 'so1ve/typescript/setup' | 'so1ve/typescript/rules' | 'so1ve/typescript/rules/type-aware' | 'so1ve/typescript/rules/dts' | 'so1ve/typescript/rules/js' | 'so1ve/test/setup' | 'so1ve/test/rules' | 'antfu/astro/setup' | 'antfu/astro/rules' | 'so1ve/vue/setup' | 'so1ve/vue/rules' | 'so1ve/solid/setup' | 'so1ve/solid/rules' | 'so1ve/formatting/setup' | 'so1ve/formatting/rules' | 'so1ve/formatting/rules/sort-package-json' | 'so1ve/formatting/rules/sort-tsconfig' | 'so1ve/formatting/rules/test' | 'so1ve/perfectionist/setup' | 'so1ve/perfectionist/rules' | 'so1ve/jsonc/setup' | 'so1ve/jsonc/rules' | 'so1ve/toml/setup' | 'so1ve/toml/rules' | 'so1ve/yaml/setup' | 'so1ve/yaml/rules' | 'so1ve/mdx/setup' | 'so1ve/mdx/rules';
|
|
16292
16297
|
//#endregion
|
|
16293
16298
|
//#region src/types.d.ts
|
|
16294
16299
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -16319,6 +16324,24 @@ interface OptionsTypeScriptParserOptions {
|
|
|
16319
16324
|
interface OptionsHasTypeScript {
|
|
16320
16325
|
typescript?: boolean;
|
|
16321
16326
|
}
|
|
16327
|
+
interface OptionsPnpm {
|
|
16328
|
+
/**
|
|
16329
|
+
* Requires catalogs usage
|
|
16330
|
+
*/
|
|
16331
|
+
catalogs?: boolean;
|
|
16332
|
+
/**
|
|
16333
|
+
* Enable linting for package.json
|
|
16334
|
+
*
|
|
16335
|
+
* @default true
|
|
16336
|
+
*/
|
|
16337
|
+
json?: boolean;
|
|
16338
|
+
/**
|
|
16339
|
+
* Enable linting for pnpm-workspace.yaml
|
|
16340
|
+
*
|
|
16341
|
+
* @default true
|
|
16342
|
+
*/
|
|
16343
|
+
yaml?: boolean;
|
|
16344
|
+
}
|
|
16322
16345
|
interface OptionsOverrides {
|
|
16323
16346
|
overrides?: TypedFlatConfigItem["rules"];
|
|
16324
16347
|
}
|
|
@@ -16333,11 +16356,20 @@ interface Options extends OptionsComponentExts {
|
|
|
16333
16356
|
*/
|
|
16334
16357
|
gitignore?: boolean | FlatGitignoreOptions;
|
|
16335
16358
|
/**
|
|
16359
|
+
* Extend the global ignores.
|
|
16360
|
+
*
|
|
16361
|
+
* Passing an array to extends the ignores.
|
|
16362
|
+
* Passing a function to modify the default ignores.
|
|
16363
|
+
*
|
|
16364
|
+
* @default []
|
|
16365
|
+
*/
|
|
16366
|
+
ignores?: string[] | ((originals: string[]) => string[]);
|
|
16367
|
+
/**
|
|
16336
16368
|
* Enable pnpm catalogs support.
|
|
16337
16369
|
*
|
|
16338
16370
|
* @default false
|
|
16339
16371
|
*/
|
|
16340
|
-
pnpm?: boolean;
|
|
16372
|
+
pnpm?: boolean | OptionsPnpm;
|
|
16341
16373
|
/**
|
|
16342
16374
|
* Core rules. Can't be disabled.
|
|
16343
16375
|
*/
|
|
@@ -16450,7 +16482,7 @@ declare function formatting(options?: Options): Promise<TypedFlatConfigItem[]>;
|
|
|
16450
16482
|
declare function html(): Promise<TypedFlatConfigItem[]>;
|
|
16451
16483
|
//#endregion
|
|
16452
16484
|
//#region src/configs/ignores.d.ts
|
|
16453
|
-
declare
|
|
16485
|
+
declare function ignores(userIgnores?: string[] | ((originals: string[]) => string[])): TypedFlatConfigItem[];
|
|
16454
16486
|
//#endregion
|
|
16455
16487
|
//#region src/configs/imports.d.ts
|
|
16456
16488
|
declare const imports: (options?: Options) => TypedFlatConfigItem[];
|
|
@@ -16479,7 +16511,7 @@ declare const onlyError: () => TypedFlatConfigItem[];
|
|
|
16479
16511
|
declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
|
|
16480
16512
|
//#endregion
|
|
16481
16513
|
//#region src/configs/pnpm.d.ts
|
|
16482
|
-
declare function pnpm(): Promise<TypedFlatConfigItem[]>;
|
|
16514
|
+
declare function pnpm(options: OptionsPnpm): Promise<TypedFlatConfigItem[]>;
|
|
16483
16515
|
//#endregion
|
|
16484
16516
|
//#region src/configs/promise.d.ts
|
|
16485
16517
|
declare const promise: () => TypedFlatConfigItem[];
|
|
@@ -16596,4 +16628,4 @@ declare function interopDefault<T>(m: MaybePromise<T>): Promise<T extends {
|
|
|
16596
16628
|
default: infer U;
|
|
16597
16629
|
} ? U : T>;
|
|
16598
16630
|
//#endregion
|
|
16599
|
-
export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, MaybeArray, MaybePromise, Options, OptionsComponentExts, OptionsHasTypeScript, OptionsOverrides, OptionsTypeScriptParserOptions, ResolvedOptions, Rules, TypedFlatConfigItem, astro, command, comments, defaultPluginRenaming, formatting, getOverrides, html, ignores, imports, interopDefault, javascript, jsonc, mdx, node, onlyError, perfectionist, pnpm, promise, renameRules, so1ve, solid, sortImports, test, toml, typescript$1 as typescript, unicorn, vue, yaml };
|
|
16631
|
+
export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, MaybeArray, MaybePromise, Options, OptionsComponentExts, OptionsHasTypeScript, OptionsOverrides, OptionsPnpm, OptionsTypeScriptParserOptions, ResolvedOptions, Rules, TypedFlatConfigItem, astro, command, comments, defaultPluginRenaming, formatting, getOverrides, html, ignores, imports, interopDefault, javascript, jsonc, mdx, node, onlyError, perfectionist, pnpm, promise, renameRules, so1ve, solid, sortImports, test, toml, typescript$1 as typescript, unicorn, vue, yaml };
|
|
@@ -13,8 +13,12 @@ import * as pluginRegexp from "eslint-plugin-regexp";
|
|
|
13
13
|
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
14
14
|
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
15
15
|
import globals from "globals";
|
|
16
|
+
import fs from "node:fs/promises";
|
|
17
|
+
import process$1 from "node:process";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
19
|
+
import fs$1 from "node:fs";
|
|
20
|
+
import path from "node:path";
|
|
16
21
|
import tseslint from "typescript-eslint";
|
|
17
|
-
import fs from "node:fs";
|
|
18
22
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
19
23
|
import { isPackageExists } from "local-pkg";
|
|
20
24
|
|
|
@@ -414,10 +418,14 @@ async function html() {
|
|
|
414
418
|
|
|
415
419
|
//#endregion
|
|
416
420
|
//#region src/configs/ignores.ts
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
ignores:
|
|
420
|
-
|
|
421
|
+
function ignores(userIgnores = []) {
|
|
422
|
+
let ignores$1 = [...GLOB_EXCLUDE];
|
|
423
|
+
ignores$1 = typeof userIgnores === "function" ? userIgnores(ignores$1) : [...ignores$1, ...userIgnores];
|
|
424
|
+
return [{
|
|
425
|
+
name: "so1ve/ignores",
|
|
426
|
+
ignores: ignores$1
|
|
427
|
+
}];
|
|
428
|
+
}
|
|
421
429
|
|
|
422
430
|
//#endregion
|
|
423
431
|
//#region src/configs/imports.ts
|
|
@@ -935,31 +943,153 @@ async function perfectionist() {
|
|
|
935
943
|
}];
|
|
936
944
|
}
|
|
937
945
|
|
|
946
|
+
//#endregion
|
|
947
|
+
//#region ../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
948
|
+
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
949
|
+
async function findUp(name, { cwd = process$1.cwd(), type = "file", stopAt } = {}) {
|
|
950
|
+
let directory = path.resolve(toPath(cwd) ?? "");
|
|
951
|
+
const { root } = path.parse(directory);
|
|
952
|
+
stopAt = path.resolve(directory, toPath(stopAt ?? root));
|
|
953
|
+
const isAbsoluteName = path.isAbsolute(name);
|
|
954
|
+
while (directory) {
|
|
955
|
+
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
956
|
+
try {
|
|
957
|
+
const stats = await fs.stat(filePath);
|
|
958
|
+
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
|
|
959
|
+
} catch {}
|
|
960
|
+
if (directory === stopAt || directory === root) break;
|
|
961
|
+
directory = path.dirname(directory);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
function findUpSync(name, { cwd = process$1.cwd(), type = "file", stopAt } = {}) {
|
|
965
|
+
let directory = path.resolve(toPath(cwd) ?? "");
|
|
966
|
+
const { root } = path.parse(directory);
|
|
967
|
+
stopAt = path.resolve(directory, toPath(stopAt) ?? root);
|
|
968
|
+
const isAbsoluteName = path.isAbsolute(name);
|
|
969
|
+
while (directory) {
|
|
970
|
+
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
971
|
+
try {
|
|
972
|
+
const stats = fs$1.statSync(filePath, { throwIfNoEntry: false });
|
|
973
|
+
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
974
|
+
} catch {}
|
|
975
|
+
if (directory === stopAt || directory === root) break;
|
|
976
|
+
directory = path.dirname(directory);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
938
980
|
//#endregion
|
|
939
981
|
//#region src/configs/pnpm.ts
|
|
940
|
-
async function
|
|
982
|
+
async function detectCatalogUsage() {
|
|
983
|
+
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
984
|
+
if (!workspaceFile) return false;
|
|
985
|
+
const yaml$1 = await fs.readFile(workspaceFile, "utf-8");
|
|
986
|
+
return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
|
|
987
|
+
}
|
|
988
|
+
async function pnpm(options) {
|
|
989
|
+
const { catalogs = await detectCatalogUsage(), json = true, yaml: yaml$1 = true } = options;
|
|
941
990
|
const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
|
|
942
991
|
interopDefault(import("eslint-plugin-pnpm")),
|
|
943
|
-
interopDefault(import("yaml-eslint-parser")),
|
|
944
|
-
interopDefault(import("jsonc-eslint-parser"))
|
|
992
|
+
yaml$1 ? interopDefault(import("yaml-eslint-parser")) : void 0,
|
|
993
|
+
json ? interopDefault(import("jsonc-eslint-parser")) : void 0
|
|
945
994
|
]);
|
|
946
|
-
|
|
995
|
+
const configs = [];
|
|
996
|
+
if (json) configs.push({
|
|
947
997
|
files: ["package.json", "**/package.json"],
|
|
948
998
|
languageOptions: { parser: jsoncParser },
|
|
949
999
|
name: "so1ve/pnpm/package-json",
|
|
950
1000
|
plugins: { pnpm: pluginPnpm },
|
|
951
1001
|
rules: {
|
|
952
|
-
"pnpm/json-enforce-catalog": "error",
|
|
1002
|
+
...catalogs && { "pnpm/json-enforce-catalog": ["error", { ignores: ["@types/vscode"] }] },
|
|
953
1003
|
"pnpm/json-prefer-workspace-settings": "error",
|
|
954
1004
|
"pnpm/json-valid-catalog": "error"
|
|
955
1005
|
}
|
|
956
|
-
}
|
|
1006
|
+
});
|
|
1007
|
+
if (yaml$1) configs.push({
|
|
957
1008
|
files: ["pnpm-workspace.yaml"],
|
|
958
1009
|
languageOptions: { parser: yamlParser },
|
|
959
1010
|
name: "so1ve/pnpm/pnpm-workspace-yaml",
|
|
960
1011
|
plugins: { pnpm: pluginPnpm },
|
|
961
|
-
rules: {
|
|
962
|
-
|
|
1012
|
+
rules: {
|
|
1013
|
+
"pnpm/yaml-enforce-settings": ["error", { settings: { shellEmulator: true } }],
|
|
1014
|
+
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
1015
|
+
}
|
|
1016
|
+
}, {
|
|
1017
|
+
files: ["pnpm-workspace.yaml"],
|
|
1018
|
+
name: "so1ve/yaml/pnpm-workspace-yaml-sort",
|
|
1019
|
+
rules: { "yaml/sort-keys": [
|
|
1020
|
+
"error",
|
|
1021
|
+
{
|
|
1022
|
+
order: [
|
|
1023
|
+
...[
|
|
1024
|
+
"cacheDir",
|
|
1025
|
+
"catalogMode",
|
|
1026
|
+
"cleanupUnusedCatalogs",
|
|
1027
|
+
"dedupeDirectDeps",
|
|
1028
|
+
"deployAllFiles",
|
|
1029
|
+
"enablePrePostScripts",
|
|
1030
|
+
"engineStrict",
|
|
1031
|
+
"extendNodePath",
|
|
1032
|
+
"hoist",
|
|
1033
|
+
"hoistPattern",
|
|
1034
|
+
"hoistWorkspacePackages",
|
|
1035
|
+
"ignoreCompatibilityDb",
|
|
1036
|
+
"ignoreDepScripts",
|
|
1037
|
+
"ignoreScripts",
|
|
1038
|
+
"ignoreWorkspaceRootCheck",
|
|
1039
|
+
"managePackageManagerVersions",
|
|
1040
|
+
"minimumReleaseAge",
|
|
1041
|
+
"minimumReleaseAgeExclude",
|
|
1042
|
+
"modulesDir",
|
|
1043
|
+
"nodeLinker",
|
|
1044
|
+
"nodeVersion",
|
|
1045
|
+
"optimisticRepeatInstall",
|
|
1046
|
+
"packageManagerStrict",
|
|
1047
|
+
"packageManagerStrictVersion",
|
|
1048
|
+
"preferSymlinkedExecutables",
|
|
1049
|
+
"preferWorkspacePackages",
|
|
1050
|
+
"publicHoistPattern",
|
|
1051
|
+
"registrySupportsTimeField",
|
|
1052
|
+
"requiredScripts",
|
|
1053
|
+
"resolutionMode",
|
|
1054
|
+
"savePrefix",
|
|
1055
|
+
"scriptShell",
|
|
1056
|
+
"shamefullyHoist",
|
|
1057
|
+
"shellEmulator",
|
|
1058
|
+
"stateDir",
|
|
1059
|
+
"supportedArchitectures",
|
|
1060
|
+
"symlink",
|
|
1061
|
+
"tag",
|
|
1062
|
+
"trustPolicy",
|
|
1063
|
+
"trustPolicyExclude",
|
|
1064
|
+
"updateNotifier"
|
|
1065
|
+
],
|
|
1066
|
+
"packages",
|
|
1067
|
+
"overrides",
|
|
1068
|
+
"patchedDependencies",
|
|
1069
|
+
...[
|
|
1070
|
+
"allowedDeprecatedVersions",
|
|
1071
|
+
"allowNonAppliedPatches",
|
|
1072
|
+
"configDependencies",
|
|
1073
|
+
"ignoredBuiltDependencies",
|
|
1074
|
+
"ignoredOptionalDependencies",
|
|
1075
|
+
"neverBuiltDependencies",
|
|
1076
|
+
"onlyBuiltDependencies",
|
|
1077
|
+
"onlyBuiltDependenciesFile",
|
|
1078
|
+
"packageExtensions",
|
|
1079
|
+
"peerDependencyRules"
|
|
1080
|
+
],
|
|
1081
|
+
"catalog",
|
|
1082
|
+
"catalogs"
|
|
1083
|
+
],
|
|
1084
|
+
pathPattern: "^$"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
order: { type: "asc" },
|
|
1088
|
+
pathPattern: ".*"
|
|
1089
|
+
}
|
|
1090
|
+
] }
|
|
1091
|
+
});
|
|
1092
|
+
return configs;
|
|
963
1093
|
}
|
|
964
1094
|
|
|
965
1095
|
//#endregion
|
|
@@ -1549,57 +1679,21 @@ async function vue({ overrides, typescript: typescript$1 } = {}) {
|
|
|
1549
1679
|
//#region src/configs/yaml.ts
|
|
1550
1680
|
async function yaml({ overrides } = {}) {
|
|
1551
1681
|
const [parserYaml, pluginYaml] = await Promise.all([interopDefault(import("yaml-eslint-parser")), interopDefault(import("eslint-plugin-yml"))]);
|
|
1552
|
-
return [
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
{
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
rules:
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
"yaml/no-empty-document": "off",
|
|
1566
|
-
...overrides
|
|
1567
|
-
}
|
|
1568
|
-
},
|
|
1569
|
-
{
|
|
1570
|
-
files: ["pnpm-workspace.yaml"],
|
|
1571
|
-
name: "so1ve/yaml/pnpm-workspace",
|
|
1572
|
-
rules: { "yaml/sort-keys": [
|
|
1573
|
-
"error",
|
|
1574
|
-
{
|
|
1575
|
-
order: [
|
|
1576
|
-
"packages",
|
|
1577
|
-
"overrides",
|
|
1578
|
-
"patchedDependencies",
|
|
1579
|
-
"hoistPattern",
|
|
1580
|
-
"allowedDeprecatedVersions",
|
|
1581
|
-
"allowNonAppliedPatches",
|
|
1582
|
-
"configDependencies",
|
|
1583
|
-
"ignoredBuiltDependencies",
|
|
1584
|
-
"ignoredOptionalDependencies",
|
|
1585
|
-
"neverBuiltDependencies",
|
|
1586
|
-
"onlyBuiltDependencies",
|
|
1587
|
-
"onlyBuiltDependenciesFile",
|
|
1588
|
-
"packageExtensions",
|
|
1589
|
-
"peerDependencyRules",
|
|
1590
|
-
"supportedArchitectures",
|
|
1591
|
-
"catalog",
|
|
1592
|
-
"catalogs"
|
|
1593
|
-
],
|
|
1594
|
-
pathPattern: "^$"
|
|
1595
|
-
},
|
|
1596
|
-
{
|
|
1597
|
-
order: { type: "asc" },
|
|
1598
|
-
pathPattern: ".*"
|
|
1599
|
-
}
|
|
1600
|
-
] }
|
|
1682
|
+
return [{
|
|
1683
|
+
name: "so1ve/yaml/setup",
|
|
1684
|
+
plugins: { yaml: pluginYaml }
|
|
1685
|
+
}, {
|
|
1686
|
+
name: "so1ve/yaml/rules",
|
|
1687
|
+
languageOptions: { parser: parserYaml },
|
|
1688
|
+
files: [GLOB_YAML],
|
|
1689
|
+
rules: {
|
|
1690
|
+
...renameRules(pluginYaml.configs.prettier.rules, { yml: "yaml" }),
|
|
1691
|
+
...renameRules(pluginYaml.configs.recommended.rules, { yml: "yaml" }),
|
|
1692
|
+
"style/spaced-comment": "off",
|
|
1693
|
+
"yaml/no-empty-document": "off",
|
|
1694
|
+
...overrides
|
|
1601
1695
|
}
|
|
1602
|
-
];
|
|
1696
|
+
}];
|
|
1603
1697
|
}
|
|
1604
1698
|
|
|
1605
1699
|
//#endregion
|
|
@@ -1632,13 +1726,17 @@ const defaultPluginRenaming = {
|
|
|
1632
1726
|
* Construct an array of ESLint flat config items.
|
|
1633
1727
|
*/
|
|
1634
1728
|
function so1ve(options = {}, ...userConfigs) {
|
|
1635
|
-
const { astro: enableAstro = isPackageExists("astro"), componentExts = [], gitignore: enableGitignore = true, pnpm:
|
|
1729
|
+
const { astro: enableAstro = isPackageExists("astro"), componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], pnpm: enablePnpm = !!findUpSync("pnpm-workspace.yaml"), solid: enableSolid = isPackageExists("solid-js"), typescript: enableTypeScript = isPackageExists("typescript"), vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
1636
1730
|
const configs = [];
|
|
1637
1731
|
if (enableGitignore) if (typeof enableGitignore === "boolean") {
|
|
1638
|
-
if (fs.existsSync(".gitignore")) configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
1732
|
+
if (fs$1.existsSync(".gitignore")) configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
1639
1733
|
} else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
1640
|
-
configs.push(ignores(), javascript({ overrides: getOverrides(options, "javascript") }), comments(), node(), onlyError(), promise(), sortImports(), imports(), unicorn(), command());
|
|
1641
|
-
if (
|
|
1734
|
+
configs.push(ignores(userIgnores), javascript({ overrides: getOverrides(options, "javascript") }), comments(), node(), onlyError(), promise(), sortImports(), imports(), unicorn(), command());
|
|
1735
|
+
if (enablePnpm) configs.push(pnpm({
|
|
1736
|
+
json: options.jsonc !== false,
|
|
1737
|
+
yaml: options.yaml !== false,
|
|
1738
|
+
...typeof enablePnpm === "boolean" ? {} : enablePnpm
|
|
1739
|
+
}));
|
|
1642
1740
|
if (enableVue) componentExts.push("vue");
|
|
1643
1741
|
if (options.html ?? true) configs.push(html());
|
|
1644
1742
|
if (enableTypeScript) configs.push(typescript({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@so1ve/eslint-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.23.0",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Ray's eslint config.",
|
|
@@ -18,13 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"exports": {
|
|
21
|
-
".":
|
|
22
|
-
|
|
23
|
-
"import": "./dist/index.js"
|
|
24
|
-
}
|
|
21
|
+
".": "./dist/index.mjs",
|
|
22
|
+
"./package.json": "./package.json"
|
|
25
23
|
},
|
|
26
|
-
"
|
|
27
|
-
"
|
|
24
|
+
"main": "./dist/index.mjs",
|
|
25
|
+
"module": "./dist/index.mjs",
|
|
26
|
+
"types": "./dist/index.d.mts",
|
|
28
27
|
"files": [
|
|
29
28
|
"dist"
|
|
30
29
|
],
|
|
@@ -77,8 +76,11 @@
|
|
|
77
76
|
"typescript-eslint": "^8.50.1",
|
|
78
77
|
"vue-eslint-parser": "^10.2.0",
|
|
79
78
|
"yaml-eslint-parser": "^1.3.2",
|
|
80
|
-
"@so1ve/eslint-plugin": "3.
|
|
81
|
-
"@so1ve/eslint-plugin-sort-imports": "3.
|
|
79
|
+
"@so1ve/eslint-plugin": "3.23.0",
|
|
80
|
+
"@so1ve/eslint-plugin-sort-imports": "3.23.0"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"find-up-simple": "^1.0.1"
|
|
82
84
|
},
|
|
83
85
|
"peerDependencies": {
|
|
84
86
|
"eslint": "^9.39.2",
|