@eienjs/eslint-config 1.6.0 → 1.7.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/cli/constants_generated.mjs +1 -1
- package/dist/cli/run.mjs +2 -2
- package/dist/cli/stages/update_eslint_files.mjs +6 -6
- package/dist/cli/stages/update_package_json.mjs +4 -4
- package/dist/cli/stages/update_vscode_settings.mjs +7 -7
- package/dist/configs/pnpm.mjs +104 -19
- package/dist/configs/stylistic.mjs +3 -1
- package/dist/configs/yaml.mjs +34 -113
- package/dist/factory.mjs +2 -1
- package/dist/node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.mjs +26 -0
- package/dist/package.mjs +1 -1
- package/dist/typegen.d.mts +16 -1
- package/dist/types.d.mts +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +10 -8
package/dist/cli/run.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import { updateEslintFiles } from "./stages/update_eslint_files.mjs";
|
|
|
4
4
|
import { updatePackageJson } from "./stages/update_package_json.mjs";
|
|
5
5
|
import { updateVscodeSettings } from "./stages/update_vscode_settings.mjs";
|
|
6
6
|
import process from "node:process";
|
|
7
|
-
import * as p from "@clack/prompts";
|
|
8
|
-
import c from "ansis";
|
|
9
7
|
import fs from "node:fs";
|
|
10
8
|
import path from "node:path";
|
|
9
|
+
import * as p from "@clack/prompts";
|
|
10
|
+
import c from "ansis";
|
|
11
11
|
|
|
12
12
|
//#region src/cli/run.ts
|
|
13
13
|
async function run(options = {}) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getEslintConfigContent } from "../utils.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import
|
|
4
|
-
import c from "ansis";
|
|
3
|
+
import fsPromises from "node:fs/promises";
|
|
5
4
|
import fs from "node:fs";
|
|
6
5
|
import path from "node:path";
|
|
7
|
-
import
|
|
6
|
+
import * as p from "@clack/prompts";
|
|
7
|
+
import c from "ansis";
|
|
8
8
|
import parse from "parse-gitignore";
|
|
9
9
|
|
|
10
10
|
//#region src/cli/stages/update_eslint_files.ts
|
|
@@ -12,13 +12,13 @@ async function updateEslintFiles(result) {
|
|
|
12
12
|
const cwd = process.cwd();
|
|
13
13
|
const pathESLintIgnore = path.join(cwd, ".eslintignore");
|
|
14
14
|
const pathPackageJSON = path.join(cwd, "package.json");
|
|
15
|
-
const pkgContent = await
|
|
15
|
+
const pkgContent = await fsPromises.readFile(pathPackageJSON, "utf8");
|
|
16
16
|
const configFileName = JSON.parse(pkgContent).type === "module" ? "eslint.config.js" : "eslint.config.mjs";
|
|
17
17
|
const pathFlatConfig = path.join(cwd, configFileName);
|
|
18
18
|
const eslintIgnores = [];
|
|
19
19
|
if (fs.existsSync(pathESLintIgnore)) {
|
|
20
20
|
p.log.step(c.cyan`Migrating existing .eslintignore`);
|
|
21
|
-
const globs = parse(await
|
|
21
|
+
const globs = parse(await fsPromises.readFile(pathESLintIgnore, "utf8")).globs();
|
|
22
22
|
for (const glob of globs) if (glob.type === "ignore") eslintIgnores.push(...glob.patterns);
|
|
23
23
|
else if (glob.type === "unignore") eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
|
|
24
24
|
}
|
|
@@ -27,7 +27,7 @@ async function updateEslintFiles(result) {
|
|
|
27
27
|
if (result.extra.includes("formatter")) configLines.push("formatters: true,");
|
|
28
28
|
for (const framework of result.frameworks) configLines.push(`${framework}: true,`);
|
|
29
29
|
const eslintConfigContent = getEslintConfigContent(configLines.map((i) => ` ${i}`).join("\n"));
|
|
30
|
-
await
|
|
30
|
+
await fsPromises.writeFile(pathFlatConfig, eslintConfigContent);
|
|
31
31
|
p.log.success(c.green`Created ${configFileName}`);
|
|
32
32
|
const files = fs.readdirSync(cwd);
|
|
33
33
|
const legacyConfig = [];
|
|
@@ -2,17 +2,17 @@ import { version } from "../../package.mjs";
|
|
|
2
2
|
import { dependenciesMap } from "../constants.mjs";
|
|
3
3
|
import { versionsMap } from "../constants_generated.mjs";
|
|
4
4
|
import process from "node:process";
|
|
5
|
+
import fsPromises from "node:fs/promises";
|
|
6
|
+
import path from "node:path";
|
|
5
7
|
import * as p from "@clack/prompts";
|
|
6
8
|
import c from "ansis";
|
|
7
|
-
import path from "node:path";
|
|
8
|
-
import fsp from "node:fs/promises";
|
|
9
9
|
|
|
10
10
|
//#region src/cli/stages/update_package_json.ts
|
|
11
11
|
async function updatePackageJson(result) {
|
|
12
12
|
const cwd = process.cwd();
|
|
13
13
|
const pathPackageJSON = path.join(cwd, "package.json");
|
|
14
14
|
p.log.step(c.cyan`Bumping @eienjs/eslint-config to v${version}`);
|
|
15
|
-
const pkgContent = await
|
|
15
|
+
const pkgContent = await fsPromises.readFile(pathPackageJSON, "utf8");
|
|
16
16
|
const pkg = JSON.parse(pkgContent);
|
|
17
17
|
pkg.devDependencies = pkg.devDependencies ?? {};
|
|
18
18
|
pkg.devDependencies["@eienjs/eslint-config"] = `^${version}`;
|
|
@@ -38,7 +38,7 @@ async function updatePackageJson(result) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
if (addedPackages.length > 0) p.note(c.dim(addedPackages.join(", ")), "Added packages");
|
|
41
|
-
await
|
|
41
|
+
await fsPromises.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
|
|
42
42
|
p.log.success(c.green`Changes wrote to package.json`);
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { vscodeSettingsString } from "../constants.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import
|
|
4
|
-
import { green } from "ansis";
|
|
3
|
+
import fsPromises from "node:fs/promises";
|
|
5
4
|
import fs from "node:fs";
|
|
6
5
|
import path from "node:path";
|
|
7
|
-
import
|
|
6
|
+
import * as p from "@clack/prompts";
|
|
7
|
+
import { green } from "ansis";
|
|
8
8
|
|
|
9
9
|
//#region src/cli/stages/update_vscode_settings.ts
|
|
10
10
|
async function updateVscodeSettings(result) {
|
|
@@ -12,16 +12,16 @@ async function updateVscodeSettings(result) {
|
|
|
12
12
|
if (!result.updateVscodeSettings) return;
|
|
13
13
|
const dotVscodePath = path.join(cwd, ".vscode");
|
|
14
14
|
const settingsPath = path.join(dotVscodePath, "settings.json");
|
|
15
|
-
if (!fs.existsSync(dotVscodePath)) await
|
|
15
|
+
if (!fs.existsSync(dotVscodePath)) await fsPromises.mkdir(dotVscodePath, { recursive: true });
|
|
16
16
|
if (fs.existsSync(settingsPath)) {
|
|
17
|
-
let settingsContent = await
|
|
17
|
+
let settingsContent = await fsPromises.readFile(settingsPath, "utf8");
|
|
18
18
|
settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
|
|
19
19
|
settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
|
|
20
20
|
settingsContent += `${vscodeSettingsString}}\n`;
|
|
21
|
-
await
|
|
21
|
+
await fsPromises.writeFile(settingsPath, settingsContent, "utf8");
|
|
22
22
|
p.log.success(green`Updated .vscode/settings.json`);
|
|
23
23
|
} else {
|
|
24
|
-
await
|
|
24
|
+
await fsPromises.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf8");
|
|
25
25
|
p.log.success(green`Created .vscode/settings.json`);
|
|
26
26
|
}
|
|
27
27
|
}
|
package/dist/configs/pnpm.mjs
CHANGED
|
@@ -7,26 +7,111 @@ async function pnpm(options) {
|
|
|
7
7
|
interopDefault(import("yaml-eslint-parser")),
|
|
8
8
|
interopDefault(import("jsonc-eslint-parser"))
|
|
9
9
|
]);
|
|
10
|
-
return [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
files: ["package.json", "**/package.json"],
|
|
13
|
+
languageOptions: { parser: jsoncParser },
|
|
14
|
+
name: "eienjs/pnpm/package-json",
|
|
15
|
+
plugins: { pnpm: pluginPnpm },
|
|
16
|
+
rules: {
|
|
17
|
+
"pnpm/json-enforce-catalog": ["error", { autofix: !options.isInEditor }],
|
|
18
|
+
"pnpm/json-prefer-workspace-settings": ["error", { autofix: !options.isInEditor }],
|
|
19
|
+
"pnpm/json-valid-catalog": ["error", { autofix: !options.isInEditor }]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
files: ["pnpm-workspace.yaml"],
|
|
24
|
+
languageOptions: { parser: yamlParser },
|
|
25
|
+
name: "eienjs/pnpm/pnpm-workspace-yaml",
|
|
26
|
+
plugins: { pnpm: pluginPnpm },
|
|
27
|
+
rules: {
|
|
28
|
+
"pnpm/yaml-enforce-settings": ["error", { settings: {
|
|
29
|
+
catalogMode: "prefer",
|
|
30
|
+
cleanupUnusedCatalogs: true,
|
|
31
|
+
shellEmulator: true,
|
|
32
|
+
trustPolicy: "no-downgrade"
|
|
33
|
+
} }],
|
|
34
|
+
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
35
|
+
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
files: ["pnpm-workspace.yaml"],
|
|
40
|
+
name: "eienjs/pnpm/pnpm-workspace-yaml-sort",
|
|
41
|
+
rules: { "yaml/sort-keys": [
|
|
42
|
+
"error",
|
|
43
|
+
{
|
|
44
|
+
order: [
|
|
45
|
+
...[
|
|
46
|
+
"cacheDir",
|
|
47
|
+
"catalogMode",
|
|
48
|
+
"cleanupUnusedCatalogs",
|
|
49
|
+
"dedupeDirectDeps",
|
|
50
|
+
"deployAllFiles",
|
|
51
|
+
"enablePrePostScripts",
|
|
52
|
+
"engineStrict",
|
|
53
|
+
"extendNodePath",
|
|
54
|
+
"hoist",
|
|
55
|
+
"hoistPattern",
|
|
56
|
+
"hoistWorkspacePackages",
|
|
57
|
+
"ignoreCompatibilityDb",
|
|
58
|
+
"ignoreDepScripts",
|
|
59
|
+
"ignoreScripts",
|
|
60
|
+
"ignoreWorkspaceRootCheck",
|
|
61
|
+
"managePackageManagerVersions",
|
|
62
|
+
"minimumReleaseAge",
|
|
63
|
+
"minimumReleaseAgeExclude",
|
|
64
|
+
"modulesDir",
|
|
65
|
+
"nodeLinker",
|
|
66
|
+
"nodeVersion",
|
|
67
|
+
"optimisticRepeatInstall",
|
|
68
|
+
"packageManagerStrict",
|
|
69
|
+
"packageManagerStrictVersion",
|
|
70
|
+
"preferSymlinkedExecutables",
|
|
71
|
+
"preferWorkspacePackages",
|
|
72
|
+
"publicHoistPattern",
|
|
73
|
+
"registrySupportsTimeField",
|
|
74
|
+
"requiredScrpts",
|
|
75
|
+
"resolutionMode",
|
|
76
|
+
"savePrefix",
|
|
77
|
+
"scriptShell",
|
|
78
|
+
"shamefullyHoist",
|
|
79
|
+
"shellEmulator",
|
|
80
|
+
"stateDir",
|
|
81
|
+
"supportedArchitectures",
|
|
82
|
+
"symlink",
|
|
83
|
+
"tag",
|
|
84
|
+
"trustPolicy",
|
|
85
|
+
"trustPolicyExclude",
|
|
86
|
+
"updateNotifier"
|
|
87
|
+
],
|
|
88
|
+
"packages",
|
|
89
|
+
"overrides",
|
|
90
|
+
"patchedDependencies",
|
|
91
|
+
"catalog",
|
|
92
|
+
"catalogs",
|
|
93
|
+
...[
|
|
94
|
+
"allowedDeprecatedVersions",
|
|
95
|
+
"allowNonAppliedPatches",
|
|
96
|
+
"configDependencies",
|
|
97
|
+
"ignoredBuiltDependencies",
|
|
98
|
+
"ignoredOptionalDependencies",
|
|
99
|
+
"neverBuiltDependencies",
|
|
100
|
+
"onlyBuiltDependencies",
|
|
101
|
+
"onlyBuiltDependenciesFile",
|
|
102
|
+
"packageExtensions",
|
|
103
|
+
"peerDependencyRules"
|
|
104
|
+
]
|
|
105
|
+
],
|
|
106
|
+
pathPattern: "^$"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
order: { type: "asc" },
|
|
110
|
+
pathPattern: ".*"
|
|
111
|
+
}
|
|
112
|
+
] }
|
|
19
113
|
}
|
|
20
|
-
|
|
21
|
-
files: ["pnpm-workspace.yaml"],
|
|
22
|
-
languageOptions: { parser: yamlParser },
|
|
23
|
-
name: "eienjs/pnpm/pnpm-workspace-yaml",
|
|
24
|
-
plugins: { pnpm: pluginPnpm },
|
|
25
|
-
rules: {
|
|
26
|
-
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
27
|
-
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
28
|
-
}
|
|
29
|
-
}];
|
|
114
|
+
];
|
|
30
115
|
}
|
|
31
116
|
|
|
32
117
|
//#endregion
|
|
@@ -3,16 +3,18 @@ import { pluginAntfu } from "../plugins.mjs";
|
|
|
3
3
|
|
|
4
4
|
//#region src/configs/stylistic.ts
|
|
5
5
|
const StylisticConfigDefaults = {
|
|
6
|
+
experimental: false,
|
|
6
7
|
indent: 2,
|
|
7
8
|
quotes: "single"
|
|
8
9
|
};
|
|
9
10
|
async function stylistic(options = {}) {
|
|
10
|
-
const { indent, maxLineLength = 120, overrides = {}, quotes } = {
|
|
11
|
+
const { experimental, indent, maxLineLength = 120, overrides = {}, quotes } = {
|
|
11
12
|
...StylisticConfigDefaults,
|
|
12
13
|
...options
|
|
13
14
|
};
|
|
14
15
|
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
15
16
|
const config = pluginStylistic.configs.customize({
|
|
17
|
+
experimental,
|
|
16
18
|
indent,
|
|
17
19
|
quotes,
|
|
18
20
|
semi: true
|
package/dist/configs/yaml.mjs
CHANGED
|
@@ -6,120 +6,41 @@ async function yaml(options = {}) {
|
|
|
6
6
|
const { files = [GLOB_YAML], overrides = {}, stylistic = true } = options;
|
|
7
7
|
const { indent = 2, quotes = "single" } = typeof stylistic === "boolean" ? {} : stylistic;
|
|
8
8
|
const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
|
|
9
|
-
return [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"yaml/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} : {},
|
|
43
|
-
...overrides
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
files: ["pnpm-workspace.yaml"],
|
|
48
|
-
name: "eienjs/yaml/pnpm-workspace",
|
|
49
|
-
rules: { "yaml/sort-keys": [
|
|
50
|
-
"error",
|
|
51
|
-
{
|
|
52
|
-
order: [
|
|
53
|
-
...[
|
|
54
|
-
"cacheDir",
|
|
55
|
-
"catalogMode",
|
|
56
|
-
"cleanupUnusedCatalogs",
|
|
57
|
-
"dedupeDirectDeps",
|
|
58
|
-
"deployAllFiles",
|
|
59
|
-
"enablePrePostScripts",
|
|
60
|
-
"engineStrict",
|
|
61
|
-
"extendNodePath",
|
|
62
|
-
"hoist",
|
|
63
|
-
"hoistPattern",
|
|
64
|
-
"hoistWorkspacePackages",
|
|
65
|
-
"ignoreCompatibilityDb",
|
|
66
|
-
"ignoreDepScripts",
|
|
67
|
-
"ignoreScripts",
|
|
68
|
-
"ignoreWorkspaceRootCheck",
|
|
69
|
-
"managePackageManagerVersions",
|
|
70
|
-
"minimumReleaseAge",
|
|
71
|
-
"minimumReleaseAgeExclude",
|
|
72
|
-
"modulesDir",
|
|
73
|
-
"nodeLinker",
|
|
74
|
-
"nodeVersion",
|
|
75
|
-
"optimisticRepeatInstall",
|
|
76
|
-
"packageManagerStrict",
|
|
77
|
-
"packageManagerStrictVersion",
|
|
78
|
-
"preferSymlinkedExecutables",
|
|
79
|
-
"preferWorkspacePackages",
|
|
80
|
-
"publicHoistPattern",
|
|
81
|
-
"registrySupportsTimeField",
|
|
82
|
-
"requiredScrpts",
|
|
83
|
-
"resolutionMode",
|
|
84
|
-
"savePrefix",
|
|
85
|
-
"scriptShell",
|
|
86
|
-
"shamefullyHoist",
|
|
87
|
-
"shellEmulator",
|
|
88
|
-
"stateDir",
|
|
89
|
-
"supportedArchitectures",
|
|
90
|
-
"symlink",
|
|
91
|
-
"tag",
|
|
92
|
-
"trustPolicy",
|
|
93
|
-
"trustPolicyExclude",
|
|
94
|
-
"updateNotifier"
|
|
95
|
-
],
|
|
96
|
-
"packages",
|
|
97
|
-
"overrides",
|
|
98
|
-
"patchedDependencies",
|
|
99
|
-
"catalog",
|
|
100
|
-
"catalogs",
|
|
101
|
-
...[
|
|
102
|
-
"allowedDeprecatedVersions",
|
|
103
|
-
"allowNonAppliedPatches",
|
|
104
|
-
"configDependencies",
|
|
105
|
-
"ignoredBuiltDependencies",
|
|
106
|
-
"ignoredOptionalDependencies",
|
|
107
|
-
"neverBuiltDependencies",
|
|
108
|
-
"onlyBuiltDependencies",
|
|
109
|
-
"onlyBuiltDependenciesFile",
|
|
110
|
-
"packageExtensions",
|
|
111
|
-
"peerDependencyRules"
|
|
112
|
-
]
|
|
113
|
-
],
|
|
114
|
-
pathPattern: "^$"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
order: { type: "asc" },
|
|
118
|
-
pathPattern: ".*"
|
|
119
|
-
}
|
|
120
|
-
] }
|
|
9
|
+
return [{
|
|
10
|
+
name: "eienjs/yaml/setup",
|
|
11
|
+
plugins: { yaml: pluginYaml }
|
|
12
|
+
}, {
|
|
13
|
+
files,
|
|
14
|
+
languageOptions: { parser: parserYaml },
|
|
15
|
+
name: "eienjs/yaml/rules",
|
|
16
|
+
rules: {
|
|
17
|
+
"@stylistic/spaced-comment": "off",
|
|
18
|
+
"yaml/block-mapping": "error",
|
|
19
|
+
"yaml/block-sequence": "error",
|
|
20
|
+
"yaml/no-empty-key": "error",
|
|
21
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
22
|
+
"yaml/no-irregular-whitespace": "error",
|
|
23
|
+
"yaml/plain-scalar": "error",
|
|
24
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
25
|
+
...stylistic ? {
|
|
26
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
27
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
28
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
29
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
30
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
31
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
32
|
+
"yaml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
33
|
+
"yaml/key-spacing": "error",
|
|
34
|
+
"yaml/no-tab-indent": "error",
|
|
35
|
+
"yaml/quotes": ["error", {
|
|
36
|
+
avoidEscape: true,
|
|
37
|
+
prefer: quotes === "backtick" ? "single" : quotes
|
|
38
|
+
}],
|
|
39
|
+
"yaml/spaced-comment": "error"
|
|
40
|
+
} : {},
|
|
41
|
+
...overrides
|
|
121
42
|
}
|
|
122
|
-
];
|
|
43
|
+
}];
|
|
123
44
|
}
|
|
124
45
|
|
|
125
46
|
//#endregion
|
package/dist/factory.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { findUpSync } from "./node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.mjs";
|
|
1
2
|
import { interopDefault, isInEditorEnv } from "./utils.mjs";
|
|
2
3
|
import { adonisjs } from "./configs/adonisjs.mjs";
|
|
3
4
|
import { astro } from "./configs/astro.mjs";
|
|
@@ -50,7 +51,7 @@ const defaultPluginRenaming = {
|
|
|
50
51
|
"yml": "yaml"
|
|
51
52
|
};
|
|
52
53
|
function eienjs(options = {}) {
|
|
53
|
-
const { adonisjs: enableAdonisjs = false, astro: enableAstro = false, componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, nuxt: enableNuxt = false, pnpm: enableCatalogs =
|
|
54
|
+
const { adonisjs: enableAdonisjs = false, astro: enableAstro = false, componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, nuxt: enableNuxt = false, pnpm: enableCatalogs = Boolean(findUpSync("pnpm-workspace.yaml")), regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
54
55
|
let { isInEditor } = options;
|
|
55
56
|
if (isInEditor == null) {
|
|
56
57
|
isInEditor = isInEditorEnv();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import fsPromises from "node:fs/promises";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
|
|
7
|
+
//#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
8
|
+
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
9
|
+
function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
10
|
+
let directory = path.resolve(toPath(cwd) ?? "");
|
|
11
|
+
const { root } = path.parse(directory);
|
|
12
|
+
stopAt = path.resolve(directory, toPath(stopAt) ?? root);
|
|
13
|
+
const isAbsoluteName = path.isAbsolute(name);
|
|
14
|
+
while (directory) {
|
|
15
|
+
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
16
|
+
try {
|
|
17
|
+
const stats = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
18
|
+
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
19
|
+
} catch {}
|
|
20
|
+
if (directory === stopAt || directory === root) break;
|
|
21
|
+
directory = path.dirname(directory);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { findUpSync };
|
package/dist/package.mjs
CHANGED
package/dist/typegen.d.mts
CHANGED
|
@@ -3921,6 +3921,11 @@ interface RuleOptions {
|
|
|
3921
3921
|
* @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm/src/rules/json/json-valid-catalog.test.ts
|
|
3922
3922
|
*/
|
|
3923
3923
|
'pnpm/json-valid-catalog'?: Linter.RuleEntry<PnpmJsonValidCatalog>;
|
|
3924
|
+
/**
|
|
3925
|
+
* Enforce settings in `pnpm-workspace.yaml`
|
|
3926
|
+
* @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm/src/rules/yaml/yaml-enforce-settings.test.ts
|
|
3927
|
+
*/
|
|
3928
|
+
'pnpm/yaml-enforce-settings'?: Linter.RuleEntry<PnpmYamlEnforceSettings>;
|
|
3924
3929
|
/**
|
|
3925
3930
|
* Disallow duplicate catalog items in `pnpm-workspace.yaml`
|
|
3926
3931
|
* @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm/src/rules/yaml/yaml-no-duplicate-catalog-item.test.ts
|
|
@@ -13683,6 +13688,16 @@ type PnpmJsonValidCatalog = [] | [{
|
|
|
13683
13688
|
enforceNoConflict?: boolean;
|
|
13684
13689
|
fields?: unknown[];
|
|
13685
13690
|
}];
|
|
13691
|
+
// ----- pnpm/yaml-enforce-settings -----
|
|
13692
|
+
type PnpmYamlEnforceSettings = [] | [{
|
|
13693
|
+
autofix?: boolean;
|
|
13694
|
+
settings?: {
|
|
13695
|
+
[k: string]: unknown | undefined;
|
|
13696
|
+
};
|
|
13697
|
+
requiredFields?: string[];
|
|
13698
|
+
forbiddenFields?: string[];
|
|
13699
|
+
[k: string]: unknown | undefined;
|
|
13700
|
+
}];
|
|
13686
13701
|
// ----- pnpm/yaml-no-duplicate-catalog-item -----
|
|
13687
13702
|
type PnpmYamlNoDuplicateCatalogItem = [] | [{
|
|
13688
13703
|
allow?: string[];
|
|
@@ -15879,6 +15894,6 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
|
|
|
15879
15894
|
onlyEquality?: boolean;
|
|
15880
15895
|
}];
|
|
15881
15896
|
// Names of all the configs
|
|
15882
|
-
type ConfigNames = 'eienjs/gitignore' | 'eienjs/ignores' | 'eienjs/javascript/setup' | 'eienjs/javascript/rules' | 'eienjs/eslint-comments/rules' | 'eienjs/node/rules' | 'eienjs/jsdoc/rules' | 'eienjs/imports/rules' | 'eienjs/command/rules' | 'eienjs/perfectionist/setup' | 'eienjs/imports/rules' | 'eienjs/unicorn/rules' | 'eienjs/unicorn/special-rules' | 'eienjs/typescript/setup' | 'eienjs/typescript/parser' | 'eienjs/typescript/type-aware-parser' | 'eienjs/typescript/rules' | 'eienjs/typescript/rules-type-aware' | 'eienjs/typescript/disables' | 'eienjs/typescript/erasable-syntax-only' | 'eienjs/stylistic/rules' | 'eienjs/regexp/rules' | 'eienjs/test/setup' | 'eienjs/test/rules' | 'eienjs/vue/setup' | 'eienjs/vue/rules' | 'eienjs/vue/composables-disables' | 'eienjs/astro/setup' | 'eienjs/astro/rules' | 'eienjs/adonisjs/rules' | 'eienjs/adonisjs/disables' | 'eienjs/adonisjs/database-disables' | 'eienjs/adonisjs/bin-disables' | 'eienjs/adonisjs/commands-disables' | 'eienjs/adonisjs/middleware-disables' | 'eienjs/adonisjs/exceptions-disables' | 'eienjs/adonisjs/controllers-disables' | 'eienjs/adonisjs/config-disables' | 'eienjs/adonisjs/providers-disables' | 'eienjs/adonisjs/tests-disables' | 'eienjs/nuxt/setup' | 'eienjs/nuxt/vue/single-root' | 'eienjs/nuxt/rules' | 'eienjs/nuxt/utils-disables' | 'eienjs/nuxt/sort-config' | 'eienjs/nuxt/vue/rules' | 'eienjs/jsonc/setup' | 'eienjs/jsonc/rules' | 'eienjs/sort/package-json' | 'eienjs/sort/tsconfig-json' | 'eienjs/pnpm/package-json' | 'eienjs/pnpm/pnpm-workspace-yaml' | 'eienjs/yaml
|
|
15897
|
+
type ConfigNames = 'eienjs/gitignore' | 'eienjs/ignores' | 'eienjs/javascript/setup' | 'eienjs/javascript/rules' | 'eienjs/eslint-comments/rules' | 'eienjs/node/rules' | 'eienjs/jsdoc/rules' | 'eienjs/imports/rules' | 'eienjs/command/rules' | 'eienjs/perfectionist/setup' | 'eienjs/imports/rules' | 'eienjs/unicorn/rules' | 'eienjs/unicorn/special-rules' | 'eienjs/typescript/setup' | 'eienjs/typescript/parser' | 'eienjs/typescript/type-aware-parser' | 'eienjs/typescript/rules' | 'eienjs/typescript/rules-type-aware' | 'eienjs/typescript/disables' | 'eienjs/typescript/erasable-syntax-only' | 'eienjs/stylistic/rules' | 'eienjs/regexp/rules' | 'eienjs/test/setup' | 'eienjs/test/rules' | 'eienjs/vue/setup' | 'eienjs/vue/rules' | 'eienjs/vue/composables-disables' | 'eienjs/astro/setup' | 'eienjs/astro/rules' | 'eienjs/adonisjs/rules' | 'eienjs/adonisjs/disables' | 'eienjs/adonisjs/database-disables' | 'eienjs/adonisjs/bin-disables' | 'eienjs/adonisjs/commands-disables' | 'eienjs/adonisjs/middleware-disables' | 'eienjs/adonisjs/exceptions-disables' | 'eienjs/adonisjs/controllers-disables' | 'eienjs/adonisjs/config-disables' | 'eienjs/adonisjs/providers-disables' | 'eienjs/adonisjs/tests-disables' | 'eienjs/nuxt/setup' | 'eienjs/nuxt/vue/single-root' | 'eienjs/nuxt/rules' | 'eienjs/nuxt/utils-disables' | 'eienjs/nuxt/sort-config' | 'eienjs/nuxt/vue/rules' | 'eienjs/jsonc/setup' | 'eienjs/jsonc/rules' | 'eienjs/sort/package-json' | 'eienjs/sort/tsconfig-json' | 'eienjs/pnpm/package-json' | 'eienjs/pnpm/pnpm-workspace-yaml' | 'eienjs/pnpm/pnpm-workspace-yaml-sort' | 'eienjs/yaml/setup' | 'eienjs/yaml/rules' | 'eienjs/toml/setup' | 'eienjs/toml/rules' | 'eienjs/markdown/setup' | 'eienjs/markdown/processor' | 'eienjs/markdown/parser' | 'eienjs/markdown/disables' | 'eienjs/formatter/setup' | 'eienjs/formatter/css' | 'eienjs/formatter/scss' | 'eienjs/formatter/less' | 'eienjs/formatter/html' | 'eienjs/formatter/xml' | 'eienjs/formatter/svg' | 'eienjs/formatter/markdown' | 'eienjs/formatter/astro' | 'eienjs/formatter/astro/disables' | 'eienjs/disables/scripts' | 'eienjs/disables/cli' | 'eienjs/disables/bin' | 'eienjs/disables/dts' | 'eienjs/disables/cjs' | 'eienjs/disables/config-files' | 'eienjs/disables/json' | 'eienjs/disables/yaml' | 'eienjs/disables/toml' | 'eienjs/disables/astro' | 'eienjs/disables/deploy-tools';
|
|
15883
15898
|
//#endregion
|
|
15884
15899
|
export { ConfigNames, RuleOptions };
|
package/dist/types.d.mts
CHANGED
|
@@ -257,7 +257,7 @@ interface OptionsHasTypeScript {
|
|
|
257
257
|
interface OptionsStylistic {
|
|
258
258
|
stylistic?: boolean | StylisticConfig;
|
|
259
259
|
}
|
|
260
|
-
interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes'> {
|
|
260
|
+
interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'experimental'> {
|
|
261
261
|
maxLineLength?: number;
|
|
262
262
|
}
|
|
263
263
|
interface OptionsOverrides {
|
package/dist/utils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eienjs/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.7.0",
|
|
5
5
|
"description": "EienJS ESLint Config",
|
|
6
6
|
"author": "Fernando Isidro <luffynando@gmail.com> (https://github.com/luffynando/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"eslint": "^9.39.1",
|
|
44
44
|
"eslint-plugin-astro": "^1.5.0",
|
|
45
45
|
"eslint-plugin-erasable-syntax-only": "^0.4.0",
|
|
46
|
-
"eslint-plugin-format": "^1.0
|
|
46
|
+
"eslint-plugin-format": "^1.1.0",
|
|
47
47
|
"prettier-plugin-astro": "^0.14.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
@@ -89,12 +89,12 @@
|
|
|
89
89
|
"eslint-plugin-antfu": "^3.1.1",
|
|
90
90
|
"eslint-plugin-command": "^3.3.1",
|
|
91
91
|
"eslint-plugin-import-lite": "^0.3.0",
|
|
92
|
-
"eslint-plugin-jsdoc": "^61.4.
|
|
92
|
+
"eslint-plugin-jsdoc": "^61.4.2",
|
|
93
93
|
"eslint-plugin-jsonc": "^2.21.0",
|
|
94
94
|
"eslint-plugin-n": "^17.23.1",
|
|
95
95
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
96
96
|
"eslint-plugin-perfectionist": "^4.15.1",
|
|
97
|
-
"eslint-plugin-pnpm": "^1.
|
|
97
|
+
"eslint-plugin-pnpm": "^1.4.1",
|
|
98
98
|
"eslint-plugin-regexp": "^2.10.0",
|
|
99
99
|
"eslint-plugin-toml": "^0.12.0",
|
|
100
100
|
"eslint-plugin-unicorn": "^62.0.0",
|
|
@@ -113,8 +113,8 @@
|
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@adonisjs/eslint-plugin": "^2.0.1",
|
|
116
|
-
"@commitlint/cli": "^20.
|
|
117
|
-
"@commitlint/config-conventional": "^20.
|
|
116
|
+
"@commitlint/cli": "^20.2.0",
|
|
117
|
+
"@commitlint/config-conventional": "^20.2.0",
|
|
118
118
|
"@eslint/config-inspector": "^1.4.2",
|
|
119
119
|
"@nuxt/eslint-plugin": "^1.11.0",
|
|
120
120
|
"@prettier/plugin-xml": "^3.4.2",
|
|
@@ -124,12 +124,14 @@
|
|
|
124
124
|
"eslint": "^9.39.1",
|
|
125
125
|
"eslint-plugin-astro": "^1.5.0",
|
|
126
126
|
"eslint-plugin-erasable-syntax-only": "^0.4.0",
|
|
127
|
-
"eslint-plugin-format": "^1.0
|
|
127
|
+
"eslint-plugin-format": "^1.1.0",
|
|
128
128
|
"eslint-typegen": "^2.3.0",
|
|
129
|
+
"find-up-simple": "^1.0.1",
|
|
129
130
|
"husky": "^9.1.7",
|
|
130
131
|
"np": "^10.2.0",
|
|
132
|
+
"pnpm-workspace-yaml": "^1.4.1",
|
|
131
133
|
"prettier-plugin-astro": "^0.14.1",
|
|
132
|
-
"tsdown": "^0.
|
|
134
|
+
"tsdown": "^0.17.0",
|
|
133
135
|
"tsx": "^4.21.0",
|
|
134
136
|
"typescript": "^5.9.3"
|
|
135
137
|
},
|