@eienjs/eslint-config 1.5.2 → 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.
@@ -62,12 +62,12 @@ const extraOptions = [{
62
62
  }];
63
63
  const extra = extraOptions.map(({ value }) => value);
64
64
  const dependenciesMap = {
65
+ adonisjs: ["@adonisjs/eslint-plugin"],
65
66
  astro: ["eslint-plugin-astro", "astro-eslint-parser"],
66
67
  formatter: ["eslint-plugin-format"],
67
68
  formatterAstro: ["prettier-plugin-astro"],
68
- vue: [],
69
- adonisjs: ["@adonisjs/eslint-plugin"],
70
- nuxt: ["@nuxt/eslint-plugin"]
69
+ nuxt: ["@nuxt/eslint-plugin"],
70
+ vue: []
71
71
  };
72
72
 
73
73
  //#endregion
@@ -1,11 +1,11 @@
1
1
  //#region src/cli/constants_generated.ts
2
2
  const versionsMap = {
3
3
  "@adonisjs/eslint-plugin": "^2.0.1",
4
- "@nuxt/eslint-plugin": "^1.10.0",
4
+ "@nuxt/eslint-plugin": "^1.11.0",
5
5
  "astro-eslint-parser": "^1.2.2",
6
6
  "eslint": "^9.39.1",
7
7
  "eslint-plugin-astro": "^1.5.0",
8
- "eslint-plugin-format": "^1.0.2",
8
+ "eslint-plugin-format": "^1.1.0",
9
9
  "prettier-plugin-astro": "^0.14.1"
10
10
  };
11
11
 
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 = {}) {
@@ -26,11 +26,14 @@ async function run(options = {}) {
26
26
  };
27
27
  if (!argSkipPrompt) {
28
28
  result = await p.group({
29
- uncommittedConfirmed: async () => {
30
- if (isGitClean()) return true;
31
- return p.confirm({
32
- initialValue: false,
33
- message: "There are uncommitted changes in the current repository, are you sure to continue?"
29
+ extra: async ({ results }) => {
30
+ const isArgExtraValid = argExtra?.length && argExtra.filter((element) => !extra.includes(element)).length === 0;
31
+ if (!results.uncommittedConfirmed || isArgExtraValid) return;
32
+ const message = argExtra ? `"${argExtra.toString()}" isn't a valid extra util. Please choose from below: ` : "Select a extra utils:";
33
+ return p.multiselect({
34
+ message: c.reset(message),
35
+ options: extraOptions,
36
+ required: false
34
37
  });
35
38
  },
36
39
  frameworks: async ({ results }) => {
@@ -43,14 +46,11 @@ async function run(options = {}) {
43
46
  required: false
44
47
  });
45
48
  },
46
- extra: async ({ results }) => {
47
- const isArgExtraValid = argExtra?.length && argExtra.filter((element) => !extra.includes(element)).length === 0;
48
- if (!results.uncommittedConfirmed || isArgExtraValid) return;
49
- const message = argExtra ? `"${argExtra.toString()}" isn't a valid extra util. Please choose from below: ` : "Select a extra utils:";
50
- return p.multiselect({
51
- message: c.reset(message),
52
- options: extraOptions,
53
- required: false
49
+ uncommittedConfirmed: async () => {
50
+ if (isGitClean()) return true;
51
+ return p.confirm({
52
+ initialValue: false,
53
+ message: "There are uncommitted changes in the current repository, are you sure to continue?"
54
54
  });
55
55
  },
56
56
  updateVscodeSettings: async ({ results }) => {
@@ -1,10 +1,10 @@
1
1
  import { getEslintConfigContent } from "../utils.mjs";
2
2
  import process from "node:process";
3
- import * as p from "@clack/prompts";
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 fsp from "node:fs/promises";
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 fsp.readFile(pathPackageJSON, "utf8");
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 fsp.readFile(pathESLintIgnore, "utf8")).globs();
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 fsp.writeFile(pathFlatConfig, eslintConfigContent);
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 fsp.readFile(pathPackageJSON, "utf8");
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 fsp.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
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 * as p from "@clack/prompts";
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 fsp from "node:fs/promises";
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 fsp.mkdir(dotVscodePath, { recursive: true });
15
+ if (!fs.existsSync(dotVscodePath)) await fsPromises.mkdir(dotVscodePath, { recursive: true });
16
16
  if (fs.existsSync(settingsPath)) {
17
- let settingsContent = await fsp.readFile(settingsPath, "utf8");
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 fsp.writeFile(settingsPath, settingsContent, "utf8");
21
+ await fsPromises.writeFile(settingsPath, settingsContent, "utf8");
22
22
  p.log.success(green`Updated .vscode/settings.json`);
23
23
  } else {
24
- await fsp.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf8");
24
+ await fsPromises.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf8");
25
25
  p.log.success(green`Created .vscode/settings.json`);
26
26
  }
27
27
  }
@@ -4,7 +4,7 @@ import { join } from "pathe";
4
4
 
5
5
  //#region src/configs/adonisjs.ts
6
6
  async function adonisjs(options = {}) {
7
- const { overrides = {}, dirs = {} } = options;
7
+ const { dirs = {}, overrides = {} } = options;
8
8
  await ensurePackages(["@adonisjs/eslint-plugin"]);
9
9
  const pluginAdonisJS = await interopDefault(import("@adonisjs/eslint-plugin"));
10
10
  dirs.root = dirs.root || ".";
@@ -30,11 +30,11 @@ async function adonisjs(options = {}) {
30
30
  const nestedGlobPattern = `**/*.${GLOB_SRC_EXT}`;
31
31
  const fileRoutes = [...Object.values(dirs).map((dir) => join(dir, nestedGlobPattern)), `${dirs.root}/ace.js`];
32
32
  const commonRulesSet = {
33
- "@typescript-eslint/require-await": "off",
34
33
  "@typescript-eslint/explicit-function-return-type": "off",
35
34
  "@typescript-eslint/explicit-module-boundary-types": "off",
36
35
  "@typescript-eslint/no-floating-promises": "off",
37
36
  "@typescript-eslint/no-unsafe-return": "off",
37
+ "@typescript-eslint/require-await": "off",
38
38
  "unicorn/no-anonymous-default-export": "off"
39
39
  };
40
40
  return [
@@ -103,12 +103,12 @@ async function adonisjs(options = {}) {
103
103
  files: [join(dirs.tests, nestedGlobPattern)],
104
104
  name: "eienjs/adonisjs/tests-disables",
105
105
  rules: {
106
- "@typescript-eslint/unbound-method": "off",
107
106
  "@typescript-eslint/explicit-function-return-type": "off",
108
107
  "@typescript-eslint/explicit-module-boundary-types": "off",
109
- "@typescript-eslint/no-unsafe-assignment": "off",
110
108
  "@typescript-eslint/no-explicit-any": "off",
111
- "@typescript-eslint/no-unsafe-return": "off"
109
+ "@typescript-eslint/no-unsafe-assignment": "off",
110
+ "@typescript-eslint/no-unsafe-return": "off",
111
+ "@typescript-eslint/unbound-method": "off"
112
112
  }
113
113
  }
114
114
  ];
@@ -7,20 +7,20 @@ function disables() {
7
7
  files: [`**/scripts/${GLOB_SRC}`],
8
8
  name: "eienjs/disables/scripts",
9
9
  rules: {
10
- "antfu/no-top-level-await": "off",
11
- "no-console": "off",
12
10
  "@typescript-eslint/explicit-function-return-type": "off",
13
- "@typescript-eslint/no-deprecated": "off"
11
+ "@typescript-eslint/no-deprecated": "off",
12
+ "antfu/no-top-level-await": "off",
13
+ "no-console": "off"
14
14
  }
15
15
  },
16
16
  {
17
17
  files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
18
18
  name: "eienjs/disables/cli",
19
19
  rules: {
20
+ "@typescript-eslint/no-unnecessary-condition": "off",
20
21
  "antfu/no-top-level-await": "off",
21
22
  "no-console": "off",
22
- "unicorn/no-process-exit": "off",
23
- "@typescript-eslint/no-unnecessary-condition": "off"
23
+ "unicorn/no-process-exit": "off"
24
24
  }
25
25
  },
26
26
  {
@@ -49,9 +49,9 @@ function disables() {
49
49
  files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
50
50
  name: "eienjs/disables/config-files",
51
51
  rules: {
52
+ "@typescript-eslint/explicit-function-return-type": "off",
52
53
  "antfu/no-top-level-await": "off",
53
- "no-console": "off",
54
- "@typescript-eslint/explicit-function-return-type": "off"
54
+ "no-console": "off"
55
55
  }
56
56
  },
57
57
  {
@@ -65,8 +65,8 @@ function javascript(options = {}) {
65
65
  "info",
66
66
  "table"
67
67
  ] }],
68
- "no-constant-binary-expression": "error",
69
68
  "no-const-assign": "error",
69
+ "no-constant-binary-expression": "error",
70
70
  "no-control-regex": "error",
71
71
  "no-debugger": "error",
72
72
  "no-delete-var": "error",
@@ -31,22 +31,10 @@ async function markdown(options = {}) {
31
31
  languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
32
32
  name: "eienjs/markdown/disables",
33
33
  rules: {
34
- "antfu/no-top-level-await": "off",
35
- "no-alert": "off",
36
- "no-console": "off",
37
- "no-labels": "off",
38
- "no-lone-blocks": "off",
39
- "no-restricted-syntax": "off",
40
- "no-undef": "off",
41
- "no-unused-expressions": "off",
42
- "no-unused-labels": "off",
43
- "no-unused-vars": "off",
44
- "unicode-bom": "off",
45
- "n/prefer-global/process": "off",
46
34
  "@stylistic/comma-dangle": "off",
47
35
  "@stylistic/eol-last": "off",
48
- "@stylistic/padding-line-between-statements": "off",
49
36
  "@stylistic/max-len": "off",
37
+ "@stylistic/padding-line-between-statements": "off",
50
38
  "@typescript-eslint/consistent-type-imports": "off",
51
39
  "@typescript-eslint/explicit-function-return-type": "off",
52
40
  "@typescript-eslint/no-namespace": "off",
@@ -55,6 +43,18 @@ async function markdown(options = {}) {
55
43
  "@typescript-eslint/no-unused-expressions": "off",
56
44
  "@typescript-eslint/no-unused-vars": "off",
57
45
  "@typescript-eslint/no-use-before-define": "off",
46
+ "antfu/no-top-level-await": "off",
47
+ "n/prefer-global/process": "off",
48
+ "no-alert": "off",
49
+ "no-console": "off",
50
+ "no-labels": "off",
51
+ "no-lone-blocks": "off",
52
+ "no-restricted-syntax": "off",
53
+ "no-undef": "off",
54
+ "no-unused-expressions": "off",
55
+ "no-unused-labels": "off",
56
+ "no-unused-vars": "off",
57
+ "unicode-bom": "off",
58
58
  "unused-imports/no-unused-imports": "off",
59
59
  "unused-imports/no-unused-vars": "off",
60
60
  ...overrides
@@ -4,7 +4,7 @@ import { join } from "pathe";
4
4
 
5
5
  //#region src/configs/nuxt.ts
6
6
  async function nuxt(options = {}) {
7
- const { overrides = {}, dirs = {}, version = 4, stylistic = true } = options;
7
+ const { dirs = {}, overrides = {}, stylistic = true, version = 4 } = options;
8
8
  const { sortConfigKeys = Boolean(stylistic) } = options;
9
9
  await ensurePackages(["@nuxt/eslint-plugin"]);
10
10
  const pluginNuxt = await interopDefault(import("@nuxt/eslint-plugin"));
@@ -67,9 +67,9 @@ async function nuxt(options = {}) {
67
67
  ];
68
68
  return [
69
69
  {
70
+ languageOptions: { globals: { $fetch: "readonly" } },
70
71
  name: "eienjs/nuxt/setup",
71
- plugins: { nuxt: pluginNuxt },
72
- languageOptions: { globals: { $fetch: "readonly" } }
72
+ plugins: { nuxt: pluginNuxt }
73
73
  },
74
74
  ...fileSingleRoot.length > 0 ? [{
75
75
  files: fileSingleRoot,
@@ -98,7 +98,7 @@ async function nuxt(options = {}) {
98
98
  name: "eienjs/nuxt/vue/rules",
99
99
  rules: {
100
100
  "vue/multiline-html-element-content-newline": ["error", {
101
- ignoreWhenEmpty: true,
101
+ allowEmptyLines: false,
102
102
  ignores: [
103
103
  "pre",
104
104
  "textarea",
@@ -110,11 +110,10 @@ async function nuxt(options = {}) {
110
110
  "ULink",
111
111
  ...INLINE_ELEMENTS
112
112
  ],
113
- allowEmptyLines: false
113
+ ignoreWhenEmpty: true
114
114
  }],
115
115
  "vue/singleline-html-element-content-newline": ["error", {
116
- ignoreWhenNoAttributes: true,
117
- ignoreWhenEmpty: true,
116
+ externalIgnores: [],
118
117
  ignores: [
119
118
  "pre",
120
119
  "textarea",
@@ -126,7 +125,8 @@ async function nuxt(options = {}) {
126
125
  "ULink",
127
126
  ...INLINE_ELEMENTS
128
127
  ],
129
- externalIgnores: []
128
+ ignoreWhenEmpty: true,
129
+ ignoreWhenNoAttributes: true
130
130
  }]
131
131
  }
132
132
  }] : []
@@ -1,6 +1,6 @@
1
- import { TypedFlatConfigItem } from "../types.mjs";
1
+ import { OptionsIsInEditor, TypedFlatConfigItem } from "../types.mjs";
2
2
 
3
3
  //#region src/configs/pnpm.d.ts
4
- declare function pnpm(): Promise<TypedFlatConfigItem[]>;
4
+ declare function pnpm(options: OptionsIsInEditor): Promise<TypedFlatConfigItem[]>;
5
5
  //#endregion
6
6
  export { pnpm };
@@ -1,32 +1,117 @@
1
1
  import { interopDefault } from "../utils.mjs";
2
2
 
3
3
  //#region src/configs/pnpm.ts
4
- async function pnpm() {
4
+ async function pnpm(options) {
5
5
  const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
6
6
  interopDefault(import("eslint-plugin-pnpm")),
7
7
  interopDefault(import("yaml-eslint-parser")),
8
8
  interopDefault(import("jsonc-eslint-parser"))
9
9
  ]);
10
- return [{
11
- files: ["package.json", "**/package.json"],
12
- languageOptions: { parser: jsoncParser },
13
- name: "eienjs/pnpm/package-json",
14
- plugins: { pnpm: pluginPnpm },
15
- rules: {
16
- "pnpm/json-enforce-catalog": "error",
17
- "pnpm/json-prefer-workspace-settings": "error",
18
- "pnpm/json-valid-catalog": "error"
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, overrides = {}, quotes, maxLineLength = 120 } = {
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
@@ -20,19 +22,23 @@ async function stylistic(options = {}) {
20
22
  return [{
21
23
  name: "eienjs/stylistic/rules",
22
24
  plugins: {
23
- "antfu": pluginAntfu,
24
- "@stylistic": pluginStylistic
25
+ "@stylistic": pluginStylistic,
26
+ "antfu": pluginAntfu
25
27
  },
26
28
  rules: {
27
29
  ...config.rules,
28
- "antfu/consistent-chaining": "error",
29
- "antfu/consistent-list-newline": "error",
30
30
  "@stylistic/arrow-parens": ["error", "always"],
31
31
  "@stylistic/brace-style": [
32
32
  "error",
33
33
  "1tbs",
34
34
  { allowSingleLine: true }
35
35
  ],
36
+ "@stylistic/comma-spacing": "error",
37
+ "@stylistic/generator-star-spacing": ["error", {
38
+ after: true,
39
+ before: false
40
+ }],
41
+ "@stylistic/lines-between-class-members": ["error", "always"],
36
42
  "@stylistic/max-len": ["warn", {
37
43
  code: maxLineLength,
38
44
  ignoreComments: true
@@ -41,8 +47,8 @@ async function stylistic(options = {}) {
41
47
  "error",
42
48
  {
43
49
  blankLine: "always",
44
- prev: "*",
45
- next: ["interface", "type"]
50
+ next: ["interface", "type"],
51
+ prev: "*"
46
52
  },
47
53
  {
48
54
  blankLine: "always",
@@ -50,11 +56,6 @@ async function stylistic(options = {}) {
50
56
  prev: "*"
51
57
  }
52
58
  ],
53
- "@stylistic/lines-between-class-members": ["error", "always"],
54
- "@stylistic/generator-star-spacing": ["error", {
55
- after: true,
56
- before: false
57
- }],
58
59
  "@stylistic/quote-props": ["error", "consistent"],
59
60
  "@stylistic/quotes": [
60
61
  "error",
@@ -62,11 +63,12 @@ async function stylistic(options = {}) {
62
63
  { avoidEscape: true }
63
64
  ],
64
65
  "@stylistic/semi": "error",
65
- "@stylistic/comma-spacing": "error",
66
66
  "@stylistic/yield-star-spacing": ["error", {
67
67
  after: true,
68
68
  before: false
69
69
  }],
70
+ "antfu/consistent-chaining": "error",
71
+ "antfu/consistent-list-newline": "error",
70
72
  ...overrides
71
73
  }
72
74
  }];
@@ -20,6 +20,10 @@ async function test(options = {}) {
20
20
  files,
21
21
  name: "eienjs/test/rules",
22
22
  rules: {
23
+ "@typescript-eslint/explicit-function-return-type": "off",
24
+ "antfu/no-top-level-await": "off",
25
+ "n/prefer-global/process": "off",
26
+ "no-unused-expressions": "off",
23
27
  "test/consistent-test-it": ["error", {
24
28
  fn: "test",
25
29
  withinDescribe: "test"
@@ -29,10 +33,6 @@ async function test(options = {}) {
29
33
  "test/no-only-tests": isInEditor ? "warn" : "error",
30
34
  "test/prefer-hooks-in-order": "error",
31
35
  "test/prefer-lowercase-title": "error",
32
- "antfu/no-top-level-await": "off",
33
- "no-unused-expressions": "off",
34
- "n/prefer-global/process": "off",
35
- "@typescript-eslint/explicit-function-return-type": "off",
36
36
  ...overrides
37
37
  }
38
38
  }];
@@ -5,7 +5,7 @@ import process from "node:process";
5
5
 
6
6
  //#region src/configs/typescript.ts
7
7
  async function typescript(options = {}) {
8
- const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, stylistic = true, erasableSyntaxOnly = false } = options;
8
+ const { componentExts = [], erasableSyntaxOnly = false, overrides = {}, overridesTypeAware = {}, parserOptions = {}, stylistic = true } = options;
9
9
  const files = options.files ?? [
10
10
  GLOB_TS,
11
11
  GLOB_TSX,
@@ -18,8 +18,6 @@ async function typescript(options = {}) {
18
18
  const isTypeAware = Boolean(tsconfigPath);
19
19
  const isErasableSyntaxOnly = Boolean(erasableSyntaxOnly);
20
20
  const typeAwareRules = {
21
- "dot-notation": "off",
22
- "no-implied-eval": "off",
23
21
  "@typescript-eslint/await-thenable": "error",
24
22
  "@typescript-eslint/consistent-type-exports": ["error", { fixMixedExportsWithInlineTypeSpecifier: true }],
25
23
  "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
@@ -69,13 +67,13 @@ async function typescript(options = {}) {
69
67
  selector: "interface"
70
68
  },
71
69
  {
72
- selector: "variable",
73
70
  format: [
74
71
  "camelCase",
75
72
  "UPPER_CASE",
76
73
  "PascalCase"
77
74
  ],
78
- leadingUnderscore: "allow"
75
+ leadingUnderscore: "allow",
76
+ selector: "variable"
79
77
  }
80
78
  ],
81
79
  "@typescript-eslint/no-floating-promises": "error",
@@ -88,6 +86,15 @@ async function typescript(options = {}) {
88
86
  "@typescript-eslint/no-unsafe-call": "error",
89
87
  "@typescript-eslint/no-unsafe-member-access": "error",
90
88
  "@typescript-eslint/no-unsafe-return": "error",
89
+ "@typescript-eslint/no-unused-vars": ["error", {
90
+ "args": "all",
91
+ "argsIgnorePattern": "^_",
92
+ "caughtErrors": "all",
93
+ "caughtErrorsIgnorePattern": "^_",
94
+ "destructuredArrayIgnorePattern": "^_",
95
+ "ignoreRestSiblings": true,
96
+ "varsIgnorePattern": "^_"
97
+ }],
91
98
  "@typescript-eslint/prefer-nullish-coalescing": ["error", { ignorePrimitives: { string: true } }],
92
99
  "@typescript-eslint/prefer-optional-chain": "error",
93
100
  "@typescript-eslint/prefer-string-starts-ends-with": "error",
@@ -96,15 +103,8 @@ async function typescript(options = {}) {
96
103
  "@typescript-eslint/restrict-template-expressions": "error",
97
104
  "@typescript-eslint/return-await": ["error", "in-try-catch"],
98
105
  "@typescript-eslint/switch-exhaustiveness-check": ["error", { considerDefaultExhaustiveForUnions: true }],
99
- "@typescript-eslint/no-unused-vars": ["error", {
100
- "args": "all",
101
- "argsIgnorePattern": "^_",
102
- "caughtErrors": "all",
103
- "caughtErrorsIgnorePattern": "^_",
104
- "destructuredArrayIgnorePattern": "^_",
105
- "varsIgnorePattern": "^_",
106
- "ignoreRestSiblings": true
107
- }]
106
+ "dot-notation": "off",
107
+ "no-implied-eval": "off"
108
108
  };
109
109
  const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
110
110
  function makeParser(typeAware, files$1, ignores) {
@@ -132,8 +132,8 @@ async function typescript(options = {}) {
132
132
  const rules = [{
133
133
  name: "eienjs/typescript/setup",
134
134
  plugins: {
135
- "antfu": pluginAntfu,
136
- "@typescript-eslint": pluginTs
135
+ "@typescript-eslint": pluginTs,
136
+ "antfu": pluginAntfu
137
137
  }
138
138
  }];
139
139
  if (isTypeAware) rules.push(makeParser(false, files), makeParser(true, filesTypeAware, ignoresTypeAware));
@@ -145,10 +145,6 @@ async function typescript(options = {}) {
145
145
  ...pluginTs.configs["eslint-recommended"].overrides?.[0].rules,
146
146
  ...pluginTs.configs.strict.rules,
147
147
  ...stylistic ? pluginTs.configs.stylistic.rules : {},
148
- "no-dupe-class-members": "off",
149
- "no-redeclare": "off",
150
- "no-use-before-define": "off",
151
- "no-useless-constructor": "off",
152
148
  "@typescript-eslint/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
153
149
  "@typescript-eslint/consistent-type-assertions": "error",
154
150
  "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
@@ -177,8 +173,8 @@ async function typescript(options = {}) {
177
173
  "caughtErrors": "all",
178
174
  "caughtErrorsIgnorePattern": "^_",
179
175
  "destructuredArrayIgnorePattern": "^_",
180
- "varsIgnorePattern": "^_",
181
- "ignoreRestSiblings": true
176
+ "ignoreRestSiblings": true,
177
+ "varsIgnorePattern": "^_"
182
178
  }],
183
179
  "@typescript-eslint/no-use-before-define": ["error", {
184
180
  classes: false,
@@ -189,6 +185,10 @@ async function typescript(options = {}) {
189
185
  "@typescript-eslint/no-wrapper-object-types": "error",
190
186
  "@typescript-eslint/triple-slash-reference": "off",
191
187
  "@typescript-eslint/unified-signatures": "off",
188
+ "no-dupe-class-members": "off",
189
+ "no-redeclare": "off",
190
+ "no-use-before-define": "off",
191
+ "no-useless-constructor": "off",
192
192
  ...overrides
193
193
  }
194
194
  });
@@ -9,26 +9,26 @@ function unicorn(options = {}) {
9
9
  plugins: { unicorn: pluginUnicorn },
10
10
  rules: {
11
11
  ...pluginUnicorn.configs.recommended.rules,
12
- "unicorn/no-this-assignment": "off",
13
12
  "unicorn/consistent-destructuring": "error",
14
13
  "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
14
+ "unicorn/expiring-todo-comments": "off",
15
+ "unicorn/filename-case": "off",
16
+ "unicorn/no-array-reduce": "off",
15
17
  "unicorn/no-null": "off",
16
18
  "unicorn/no-static-only-class": "off",
19
+ "unicorn/no-thenable": "off",
20
+ "unicorn/no-this-assignment": "off",
17
21
  "unicorn/numeric-separators-style": "off",
18
22
  "unicorn/prefer-dom-node-append": "off",
19
23
  "unicorn/prefer-dom-node-dataset": "off",
20
24
  "unicorn/prefer-dom-node-remove": "off",
21
25
  "unicorn/prefer-dom-node-text-content": "off",
26
+ "unicorn/prefer-export-from": "off",
22
27
  "unicorn/prefer-modern-dom-apis": "off",
23
28
  "unicorn/prefer-query-selector": "off",
24
29
  "unicorn/prefer-switch": ["error", { emptyDefaultCase: "do-nothing-comment" }],
25
- "unicorn/prevent-abbreviations": "off",
26
- "unicorn/no-thenable": "off",
27
- "unicorn/expiring-todo-comments": "off",
28
- "unicorn/no-array-reduce": "off",
29
- "unicorn/prefer-export-from": "off",
30
30
  "unicorn/prefer-top-level-await": "off",
31
- "unicorn/filename-case": "off",
31
+ "unicorn/prevent-abbreviations": "off",
32
32
  ...overrides
33
33
  }
34
34
  }, {
@@ -4,7 +4,7 @@ import { mergeProcessors } from "eslint-merge-processors";
4
4
 
5
5
  //#region src/configs/vue.ts
6
6
  async function vue(options = {}) {
7
- const { files = [GLOB_VUE], overrides = {}, stylistic = true, typescript, componentNameInTemplateCasingOnlyRegistered = false, componentNameInTemplateCasingIgnores = [], componentNameInTemplateCasingGlobals = [] } = options;
7
+ const { componentNameInTemplateCasingGlobals = [], componentNameInTemplateCasingIgnores = [], componentNameInTemplateCasingOnlyRegistered = false, files = [GLOB_VUE], overrides = {}, stylistic = true, typescript } = options;
8
8
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
9
9
  const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
10
10
  const [pluginVue, parserVue, processorVueBlocks] = await Promise.all([
@@ -77,9 +77,9 @@ async function vue(options = {}) {
77
77
  "error",
78
78
  "PascalCase",
79
79
  {
80
- registeredComponentsOnly: componentNameInTemplateCasingOnlyRegistered,
80
+ globals: componentNameInTemplateCasingGlobals,
81
81
  ignores: componentNameInTemplateCasingIgnores,
82
- globals: componentNameInTemplateCasingGlobals
82
+ registeredComponentsOnly: componentNameInTemplateCasingOnlyRegistered
83
83
  }
84
84
  ],
85
85
  "vue/component-options-name-casing": ["error", "PascalCase"],
@@ -186,11 +186,11 @@ async function vue(options = {}) {
186
186
  "vue/space-in-parens": ["error", "never"],
187
187
  "vue/template-curly-spacing": "error"
188
188
  } : {},
189
- "antfu/no-top-level-await": "off",
190
- "n/prefer-global/process": "off",
189
+ "@stylistic/max-len": "off",
191
190
  "@typescript-eslint/explicit-function-return-type": "off",
192
191
  "@typescript-eslint/naming-convention": "off",
193
- "@stylistic/max-len": "off",
192
+ "antfu/no-top-level-await": "off",
193
+ "n/prefer-global/process": "off",
194
194
  ...overrides
195
195
  }
196
196
  },
@@ -6,77 +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
- name: "eienjs/yaml/setup",
12
- plugins: { yaml: pluginYaml }
13
- },
14
- {
15
- files,
16
- languageOptions: { parser: parserYaml },
17
- name: "eienjs/yaml/rules",
18
- rules: {
19
- "@stylistic/spaced-comment": "off",
20
- "yaml/block-mapping": "error",
21
- "yaml/block-sequence": "error",
22
- "yaml/no-empty-key": "error",
23
- "yaml/no-empty-sequence-entry": "error",
24
- "yaml/no-irregular-whitespace": "error",
25
- "yaml/plain-scalar": "error",
26
- "yaml/vue-custom-block/no-parsing-error": "error",
27
- ...stylistic ? {
28
- "yaml/block-mapping-question-indicator-newline": "error",
29
- "yaml/block-sequence-hyphen-indicator-newline": "error",
30
- "yaml/flow-mapping-curly-newline": "error",
31
- "yaml/flow-mapping-curly-spacing": "error",
32
- "yaml/flow-sequence-bracket-newline": "error",
33
- "yaml/flow-sequence-bracket-spacing": "error",
34
- "yaml/indent": ["error", indent === "tab" ? 2 : indent],
35
- "yaml/key-spacing": "error",
36
- "yaml/no-tab-indent": "error",
37
- "yaml/quotes": ["error", {
38
- avoidEscape: true,
39
- prefer: quotes === "backtick" ? "single" : quotes
40
- }],
41
- "yaml/spaced-comment": "error"
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
- "packages",
54
- "overrides",
55
- "patchedDependencies",
56
- "hoistPattern",
57
- "catalog",
58
- "catalogs",
59
- "allowedDeprecatedVersions",
60
- "allowNonAppliedPatches",
61
- "configDependencies",
62
- "ignoredBuiltDependencies",
63
- "ignoredOptionalDependencies",
64
- "neverBuiltDependencies",
65
- "onlyBuiltDependencies",
66
- "onlyBuiltDependenciesFile",
67
- "packageExtensions",
68
- "peerDependencyRules",
69
- "supportedArchitectures"
70
- ],
71
- pathPattern: "^$"
72
- },
73
- {
74
- order: { type: "asc" },
75
- pathPattern: ".*"
76
- }
77
- ] }
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
78
42
  }
79
- ];
43
+ }];
80
44
  }
81
45
 
82
46
  //#endregion
@@ -9,7 +9,7 @@ declare const defaultPluginRenaming: {
9
9
  vitest: string;
10
10
  yml: string;
11
11
  };
12
- declare function eienjs(options?: OptionsConfig & Omit<TypedFlatConfigItem, 'files'>): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
12
+ declare function eienjs(options?: OptionsConfig & Omit<TypedFlatConfigItem, 'files' | 'ignores'>): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
13
13
  type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
14
14
  declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
15
15
  declare function getOverrides(options: OptionsConfig, key: keyof OptionsConfig): Partial<Linter.RulesRecord & RuleOptions>;
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 { astro: enableAstro = false, componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, pnpm: enableCatalogs = false, regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, vue: enableVue = VuePackages.some((i) => isPackageExists(i)), adonisjs: enableAdonisjs = false, nuxt: enableNuxt = false } = options;
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();
@@ -80,8 +81,8 @@ function eienjs(options = {}) {
80
81
  if (enableTypeScript) configs.push(typescript({
81
82
  ...typescriptOptions,
82
83
  componentExts,
83
- stylistic: stylisticOptions,
84
- overrides: getOverrides(options, "typescript")
84
+ overrides: getOverrides(options, "typescript"),
85
+ stylistic: stylisticOptions
85
86
  }));
86
87
  if (stylisticOptions) configs.push(stylistic({
87
88
  ...stylisticOptions,
@@ -115,7 +116,7 @@ function eienjs(options = {}) {
115
116
  overrides: getOverrides(options, "jsonc"),
116
117
  stylistic: stylisticOptions
117
118
  }), sortPackageJson(), sortTsconfig());
118
- if (enableCatalogs) configs.push(pnpm());
119
+ if (enableCatalogs) configs.push(pnpm({ isInEditor }));
119
120
  if (options.yaml ?? true) configs.push(yaml({
120
121
  overrides: getOverrides(options, "yaml"),
121
122
  stylistic: stylisticOptions
@@ -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
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "1.5.2";
2
+ var version = "1.7.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };
@@ -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
@@ -4562,6 +4567,11 @@ interface RuleOptions {
4562
4567
  * @deprecated
4563
4568
  */
4564
4569
  'template-tag-spacing'?: Linter.RuleEntry<TemplateTagSpacing>;
4570
+ /**
4571
+ * enforce using `.each` or `.for` consistently
4572
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-each-for.md
4573
+ */
4574
+ 'test/consistent-each-for'?: Linter.RuleEntry<TestConsistentEachFor>;
4565
4575
  /**
4566
4576
  * require test file pattern
4567
4577
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
@@ -4784,7 +4794,7 @@ interface RuleOptions {
4784
4794
  */
4785
4795
  'test/prefer-each'?: Linter.RuleEntry<[]>;
4786
4796
  /**
4787
- * enforce using the built-in quality matchers
4797
+ * enforce using the built-in equality matchers
4788
4798
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-equality-matcher.md
4789
4799
  */
4790
4800
  'test/prefer-equality-matcher'?: Linter.RuleEntry<[]>;
@@ -4903,6 +4913,11 @@ interface RuleOptions {
4903
4913
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
4904
4914
  */
4905
4915
  'test/require-hook'?: Linter.RuleEntry<TestRequireHook>;
4916
+ /**
4917
+ * require usage of import in vi.mock()
4918
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-import-vi-mock.md
4919
+ */
4920
+ 'test/require-import-vi-mock'?: Linter.RuleEntry<[]>;
4906
4921
  /**
4907
4922
  * require local Test Context for concurrent snapshot tests
4908
4923
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md
@@ -6267,6 +6282,11 @@ interface RuleOptions {
6267
6282
  * @see https://eslint.vuejs.org/rules/no-duplicate-attributes.html
6268
6283
  */
6269
6284
  'vue/no-duplicate-attributes'?: Linter.RuleEntry<VueNoDuplicateAttributes>;
6285
+ /**
6286
+ * disallow duplication of class names in class attributes
6287
+ * @see https://eslint.vuejs.org/rules/no-duplicate-class-names.html
6288
+ */
6289
+ 'vue/no-duplicate-class-names'?: Linter.RuleEntry<[]>;
6270
6290
  /**
6271
6291
  * disallow the `<template>` `<script>` `<style>` block to be empty
6272
6292
  * @see https://eslint.vuejs.org/rules/no-empty-component-block.html
@@ -13668,6 +13688,16 @@ type PnpmJsonValidCatalog = [] | [{
13668
13688
  enforceNoConflict?: boolean;
13669
13689
  fields?: unknown[];
13670
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
+ }];
13671
13701
  // ----- pnpm/yaml-no-duplicate-catalog-item -----
13672
13702
  type PnpmYamlNoDuplicateCatalogItem = [] | [{
13673
13703
  allow?: string[];
@@ -13958,6 +13988,13 @@ type SwitchColonSpacing = [] | [{
13958
13988
  type TemplateCurlySpacing = [] | [("always" | "never")];
13959
13989
  // ----- template-tag-spacing -----
13960
13990
  type TemplateTagSpacing = [] | [("always" | "never")];
13991
+ // ----- test/consistent-each-for -----
13992
+ type TestConsistentEachFor = [] | [{
13993
+ test?: ("each" | "for");
13994
+ it?: ("each" | "for");
13995
+ describe?: ("each" | "for");
13996
+ suite?: ("each" | "for");
13997
+ }];
13961
13998
  // ----- test/consistent-test-filename -----
13962
13999
  type TestConsistentTestFilename = [] | [{
13963
14000
  pattern?: string;
@@ -15857,6 +15894,6 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
15857
15894
  onlyEquality?: boolean;
15858
15895
  }];
15859
15896
  // Names of all the configs
15860
- 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/setup' | 'eienjs/yaml/rules' | 'eienjs/yaml/pnpm-workspace' | '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';
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';
15861
15898
  //#endregion
15862
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
@@ -1,6 +1,6 @@
1
- import { isPackageExists } from "local-pkg";
2
1
  import process from "node:process";
3
2
  import { fileURLToPath } from "node:url";
3
+ import { isPackageExists } from "local-pkg";
4
4
 
5
5
  //#region src/utils.ts
6
6
  const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eienjs/eslint-config",
3
3
  "type": "module",
4
- "version": "1.5.2",
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",
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@adonisjs/eslint-plugin": "^2.0.1",
40
- "@nuxt/eslint-plugin": "^1.10.0",
40
+ "@nuxt/eslint-plugin": "^1.11.0",
41
41
  "@prettier/plugin-xml": "^3.4.2",
42
42
  "astro-eslint-parser": "^1.2.2",
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.2",
46
+ "eslint-plugin-format": "^1.1.0",
47
47
  "prettier-plugin-astro": "^0.14.1"
48
48
  },
49
49
  "peerDependenciesMeta": {
@@ -78,9 +78,9 @@
78
78
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
79
79
  "@eslint/markdown": "^7.5.1",
80
80
  "@stylistic/eslint-plugin": "^5.6.1",
81
- "@typescript-eslint/eslint-plugin": "^8.47.0",
82
- "@typescript-eslint/parser": "^8.47.0",
83
- "@vitest/eslint-plugin": "^1.4.3",
81
+ "@typescript-eslint/eslint-plugin": "^8.48.1",
82
+ "@typescript-eslint/parser": "^8.48.1",
83
+ "@vitest/eslint-plugin": "^1.5.1",
84
84
  "ansis": "^4.2.0",
85
85
  "cac": "^6.7.14",
86
86
  "eslint-config-flat-gitignore": "^2.1.0",
@@ -89,17 +89,17 @@
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.0",
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.3.0",
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",
101
101
  "eslint-plugin-unused-imports": "^4.3.0",
102
- "eslint-plugin-vue": "^10.5.1",
102
+ "eslint-plugin-vue": "^10.6.2",
103
103
  "eslint-plugin-yml": "^1.19.0",
104
104
  "eslint-processor-vue-blocks": "^2.0.0",
105
105
  "globals": "^16.5.0",
@@ -109,14 +109,14 @@
109
109
  "pathe": "^2.0.3",
110
110
  "toml-eslint-parser": "^0.10.0",
111
111
  "vue-eslint-parser": "^10.2.0",
112
- "yaml-eslint-parser": "^1.3.0"
112
+ "yaml-eslint-parser": "^1.3.2"
113
113
  },
114
114
  "devDependencies": {
115
115
  "@adonisjs/eslint-plugin": "^2.0.1",
116
- "@commitlint/cli": "^20.1.0",
117
- "@commitlint/config-conventional": "^20.0.0",
118
- "@eslint/config-inspector": "^1.4.1",
119
- "@nuxt/eslint-plugin": "^1.10.0",
116
+ "@commitlint/cli": "^20.2.0",
117
+ "@commitlint/config-conventional": "^20.2.0",
118
+ "@eslint/config-inspector": "^1.4.2",
119
+ "@nuxt/eslint-plugin": "^1.11.0",
120
120
  "@prettier/plugin-xml": "^3.4.2",
121
121
  "@types/node": "^24.10.1",
122
122
  "astro-eslint-parser": "^1.2.2",
@@ -124,13 +124,15 @@
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.2",
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.16.6",
133
- "tsx": "^4.20.6",
134
+ "tsdown": "^0.17.0",
135
+ "tsx": "^4.21.0",
134
136
  "typescript": "^5.9.3"
135
137
  },
136
138
  "resolutions": {