@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.
@@ -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.12.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.2.0",
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 fsPromises from "node:fs/promises";
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 fsPromises.readFile(pathPackageJSON, "utf8");
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 fsPromises.readFile(pathESLintIgnore, "utf8")).globs();
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 fsPromises.writeFile(pathFlatConfig, eslintConfigContent);
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 fsPromises from "node:fs/promises";
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 fsPromises.readFile(pathPackageJSON, "utf8");
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 fsPromises.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
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 fsPromises from "node:fs/promises";
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 fsPromises.mkdir(dotVscodePath, { recursive: true });
15
+ if (!fs.existsSync(dotVscodePath)) await fsp.mkdir(dotVscodePath, { recursive: true });
16
16
  if (fs.existsSync(settingsPath)) {
17
- let settingsContent = await fsPromises.readFile(settingsPath, "utf8");
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 fsPromises.writeFile(settingsPath, settingsContent, "utf8");
21
+ await fsp.writeFile(settingsPath, settingsContent, "utf8");
22
22
  p.log.success(green`Updated .vscode/settings.json`);
23
23
  } else {
24
- await fsPromises.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf8");
24
+ await fsp.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf8");
25
25
  p.log.success(green`Created .vscode/settings.json`);
26
26
  }
27
27
  }
@@ -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$1 = [...GLOB_EXCLUDE];
6
- ignores$1 = typeof userIgnores === "function" ? userIgnores(ignores$1) : [...ignores$1, ...userIgnores];
5
+ let ignores = [...GLOB_EXCLUDE];
6
+ ignores = typeof userIgnores === "function" ? userIgnores(ignores) : [...ignores, ...userIgnores];
7
7
  return [{
8
- ignores: ignores$1,
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$1 = await interopDefault(import("@eslint/markdown"));
8
+ const markdown = await interopDefault(import("@eslint/markdown"));
9
9
  return [
10
10
  {
11
11
  name: "eienjs/markdown/setup",
12
- plugins: { markdown: markdown$1 }
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$1.processors.markdown, processorPassThrough])
18
+ processor: mergeProcessors([markdown.processors.markdown, processorPassThrough])
19
19
  },
20
20
  {
21
21
  files,
@@ -1,7 +1,6 @@
1
1
  import { TypedFlatConfigItem } from "../types.mjs";
2
2
 
3
3
  //#region src/configs/perfectionist.d.ts
4
-
5
4
  /**
6
5
  * Perfectionist plugin for props and items sorting.
7
6
  *
@@ -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-type",
23
- "sibling-type",
24
- "index-type",
25
- "internal-type"
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
- "object",
36
+ "ts-equals-import",
37
37
  "unknown"
38
38
  ],
39
39
  newlinesBetween: "ignore",
@@ -1,7 +1,6 @@
1
1
  import { TypedFlatConfigItem } from "../types.mjs";
2
2
 
3
3
  //#region src/configs/sort.d.ts
4
-
5
4
  /**
6
5
  * Sort package.json
7
6
  *
@@ -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$1, ignores) {
114
+ function makeParser(typeAware, files, ignores) {
115
115
  return {
116
- files: files$1,
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 fsPromises from "node:fs/promises";
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 fsPromises.stat(filePath);
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
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "1.9.0";
2
+ var version = "1.9.1";
3
3
 
4
4
  //#endregion
5
5
  export { version };