@eienjs/eslint-config 1.9.0 → 1.9.1
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 +2 -2
- package/dist/cli/stages/update_eslint_files.mjs +4 -4
- package/dist/cli/stages/update_package_json.mjs +3 -3
- package/dist/cli/stages/update_vscode_settings.mjs +5 -5
- package/dist/configs/ignores.mjs +3 -3
- package/dist/configs/markdown.mjs +3 -3
- package/dist/configs/perfectionist.d.mts +0 -1
- package/dist/configs/perfectionist.mjs +12 -12
- package/dist/configs/sort.d.mts +0 -1
- package/dist/configs/typescript.mjs +2 -2
- package/dist/node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.mjs +2 -2
- package/dist/package.mjs +1 -1
- package/dist/typegen.d.mts +1910 -1941
- package/package.json +28 -30
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
//#region src/cli/constants_generated.ts
|
|
2
2
|
const versionsMap = {
|
|
3
3
|
"@adonisjs/eslint-plugin": "^2.2.1",
|
|
4
|
-
"@nuxt/eslint-plugin": "^1.
|
|
4
|
+
"@nuxt/eslint-plugin": "^1.13.0",
|
|
5
5
|
"astro-eslint-parser": "^1.2.2",
|
|
6
6
|
"eslint": "^9.39.2",
|
|
7
7
|
"eslint-plugin-astro": "^1.5.0",
|
|
8
|
-
"eslint-plugin-format": "^1.
|
|
8
|
+
"eslint-plugin-format": "^1.3.1",
|
|
9
9
|
"prettier-plugin-astro": "^0.14.1"
|
|
10
10
|
};
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getEslintConfigContent } from "../utils.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import * as p from "@clack/prompts";
|
|
@@ -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 fsp.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 fsp.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 fsp.writeFile(pathFlatConfig, eslintConfigContent);
|
|
31
31
|
p.log.success(c.green`Created ${configFileName}`);
|
|
32
32
|
const files = fs.readdirSync(cwd);
|
|
33
33
|
const legacyConfig = [];
|
|
@@ -2,7 +2,7 @@ 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
|
|
5
|
+
import fsp from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import * as p from "@clack/prompts";
|
|
8
8
|
import c from "ansis";
|
|
@@ -12,7 +12,7 @@ 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 fsp.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 fsp.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
|
|
42
42
|
p.log.success(c.green`Changes wrote to package.json`);
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { vscodeSettingsString } from "../constants.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import * as p from "@clack/prompts";
|
|
@@ -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 fsp.mkdir(dotVscodePath, { recursive: true });
|
|
16
16
|
if (fs.existsSync(settingsPath)) {
|
|
17
|
-
let settingsContent = await
|
|
17
|
+
let settingsContent = await fsp.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 fsp.writeFile(settingsPath, settingsContent, "utf8");
|
|
22
22
|
p.log.success(green`Updated .vscode/settings.json`);
|
|
23
23
|
} else {
|
|
24
|
-
await
|
|
24
|
+
await fsp.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf8");
|
|
25
25
|
p.log.success(green`Created .vscode/settings.json`);
|
|
26
26
|
}
|
|
27
27
|
}
|
package/dist/configs/ignores.mjs
CHANGED
|
@@ -2,10 +2,10 @@ import { GLOB_EXCLUDE } from "../globs.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/configs/ignores.ts
|
|
4
4
|
function ignores(userIgnores = []) {
|
|
5
|
-
let ignores
|
|
6
|
-
ignores
|
|
5
|
+
let ignores = [...GLOB_EXCLUDE];
|
|
6
|
+
ignores = typeof userIgnores === "function" ? userIgnores(ignores) : [...ignores, ...userIgnores];
|
|
7
7
|
return [{
|
|
8
|
-
ignores
|
|
8
|
+
ignores,
|
|
9
9
|
name: "eienjs/ignores"
|
|
10
10
|
}];
|
|
11
11
|
}
|
|
@@ -5,17 +5,17 @@ import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
|
5
5
|
//#region src/configs/markdown.ts
|
|
6
6
|
async function markdown(options = {}) {
|
|
7
7
|
const { componentExts = [], files = [GLOB_MARKDOWN], overrides = {} } = options;
|
|
8
|
-
const markdown
|
|
8
|
+
const markdown = await interopDefault(import("@eslint/markdown"));
|
|
9
9
|
return [
|
|
10
10
|
{
|
|
11
11
|
name: "eienjs/markdown/setup",
|
|
12
|
-
plugins: { markdown
|
|
12
|
+
plugins: { markdown }
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
files,
|
|
16
16
|
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
17
17
|
name: "eienjs/markdown/processor",
|
|
18
|
-
processor: mergeProcessors([markdown
|
|
18
|
+
processor: mergeProcessors([markdown.processors.markdown, processorPassThrough])
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
files,
|
|
@@ -17,23 +17,23 @@ function perfectionist() {
|
|
|
17
17
|
}],
|
|
18
18
|
"perfectionist/sort-imports": ["error", {
|
|
19
19
|
groups: [
|
|
20
|
-
"type",
|
|
20
|
+
"type-import",
|
|
21
21
|
[
|
|
22
|
-
"parent
|
|
23
|
-
"sibling
|
|
24
|
-
"index
|
|
25
|
-
"internal
|
|
22
|
+
"type-parent",
|
|
23
|
+
"type-sibling",
|
|
24
|
+
"type-index",
|
|
25
|
+
"type-internal"
|
|
26
26
|
],
|
|
27
|
-
"builtin",
|
|
28
|
-
"external",
|
|
29
|
-
"internal",
|
|
27
|
+
"value-builtin",
|
|
28
|
+
"value-external",
|
|
29
|
+
"value-internal",
|
|
30
30
|
[
|
|
31
|
-
"parent",
|
|
32
|
-
"sibling",
|
|
33
|
-
"index"
|
|
31
|
+
"value-parent",
|
|
32
|
+
"value-sibling",
|
|
33
|
+
"value-index"
|
|
34
34
|
],
|
|
35
35
|
"side-effect",
|
|
36
|
-
"
|
|
36
|
+
"ts-equals-import",
|
|
37
37
|
"unknown"
|
|
38
38
|
],
|
|
39
39
|
newlinesBetween: "ignore",
|
package/dist/configs/sort.d.mts
CHANGED
|
@@ -111,9 +111,9 @@ async function typescript(options = {}) {
|
|
|
111
111
|
"no-implied-eval": "off"
|
|
112
112
|
};
|
|
113
113
|
const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
|
|
114
|
-
function makeParser(typeAware, files
|
|
114
|
+
function makeParser(typeAware, files, ignores) {
|
|
115
115
|
return {
|
|
116
|
-
files
|
|
116
|
+
files,
|
|
117
117
|
...ignores ? { ignores } : {},
|
|
118
118
|
languageOptions: {
|
|
119
119
|
parser: parserTs,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
|
-
import
|
|
2
|
+
import fsp from "node:fs/promises";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -14,7 +14,7 @@ async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {})
|
|
|
14
14
|
while (directory) {
|
|
15
15
|
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
16
16
|
try {
|
|
17
|
-
const stats = await
|
|
17
|
+
const stats = await fsp.stat(filePath);
|
|
18
18
|
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
|
|
19
19
|
} catch {}
|
|
20
20
|
if (directory === stopAt || directory === root) break;
|
package/dist/package.mjs
CHANGED