@eienjs/eslint-config 1.6.0 → 1.8.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.
@@ -1,11 +1,11 @@
1
1
  //#region src/cli/constants_generated.ts
2
2
  const versionsMap = {
3
- "@adonisjs/eslint-plugin": "^2.0.1",
4
- "@nuxt/eslint-plugin": "^1.11.0",
3
+ "@adonisjs/eslint-plugin": "^2.2.0",
4
+ "@nuxt/eslint-plugin": "^1.12.1",
5
5
  "astro-eslint-parser": "^1.2.2",
6
- "eslint": "^9.39.1",
6
+ "eslint": "^9.39.2",
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 = {}) {
@@ -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
  }
@@ -0,0 +1,7 @@
1
+ import { OptionsConfig } from "./types.mjs";
2
+
3
+ //#region src/config_presets.d.ts
4
+ declare const CONFIG_PRESET_FULL_ON: OptionsConfig;
5
+ declare const CONFIG_PRESET_FULL_OFF: OptionsConfig;
6
+ //#endregion
7
+ export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON };
@@ -0,0 +1,49 @@
1
+ //#region src/config_presets.ts
2
+ const CONFIG_PRESET_FULL_ON = {
3
+ adonisjs: true,
4
+ astro: true,
5
+ formatters: true,
6
+ gitignore: true,
7
+ imports: true,
8
+ jsdoc: true,
9
+ jsonc: true,
10
+ markdown: true,
11
+ node: true,
12
+ nuxt: true,
13
+ pnpm: true,
14
+ regexp: true,
15
+ stylistic: { experimental: true },
16
+ test: true,
17
+ toml: true,
18
+ typescript: {
19
+ erasableSyntaxOnly: true,
20
+ tsconfigPath: "tsconfig.json"
21
+ },
22
+ unicorn: true,
23
+ vue: true,
24
+ yaml: true
25
+ };
26
+ const CONFIG_PRESET_FULL_OFF = {
27
+ adonisjs: false,
28
+ astro: false,
29
+ formatters: false,
30
+ gitignore: false,
31
+ imports: false,
32
+ jsdoc: false,
33
+ jsonc: false,
34
+ markdown: false,
35
+ node: false,
36
+ nuxt: false,
37
+ pnpm: false,
38
+ regexp: false,
39
+ stylistic: false,
40
+ test: false,
41
+ toml: false,
42
+ typescript: false,
43
+ unicorn: false,
44
+ vue: false,
45
+ yaml: false
46
+ };
47
+
48
+ //#endregion
49
+ export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON };
@@ -27,6 +27,8 @@ async function adonisjs(options = {}) {
27
27
  dirs.tests = dirs.tests || `${dirs.root}/tests`;
28
28
  dirs.config = dirs.config || `${dirs.root}/config`;
29
29
  dirs.commands = dirs.commands || `${dirs.root}/commands`;
30
+ dirs.inertia = dirs.inertia || `${dirs.root}/inertia`;
31
+ dirs.types = dirs.types || `${appPath}/types`;
30
32
  const nestedGlobPattern = `**/*.${GLOB_SRC_EXT}`;
31
33
  const fileRoutes = [...Object.values(dirs).map((dir) => join(dir, nestedGlobPattern)), `${dirs.root}/ace.js`];
32
34
  const commonRulesSet = {
@@ -47,6 +49,15 @@ async function adonisjs(options = {}) {
47
49
  ...overrides
48
50
  }
49
51
  },
52
+ {
53
+ files: [join(dirs.inertia, nestedGlobPattern)],
54
+ name: "eienjs/adonisjs/inertia-rules",
55
+ rules: {
56
+ "@adonisjs/no-backend-import-in-frontend": "error",
57
+ "@adonisjs/prefer-adonisjs-inertia-form": "error",
58
+ "@adonisjs/prefer-adonisjs-inertia-link": "error"
59
+ }
60
+ },
50
61
  {
51
62
  files: fileRoutes,
52
63
  name: "eienjs/adonisjs/disables",
@@ -110,6 +121,19 @@ async function adonisjs(options = {}) {
110
121
  "@typescript-eslint/no-unsafe-return": "off",
111
122
  "@typescript-eslint/unbound-method": "off"
112
123
  }
124
+ },
125
+ {
126
+ files: [join(dirs.types, nestedGlobPattern)],
127
+ name: "eienjs/adonisjs/types-disables",
128
+ rules: {
129
+ "@eslint-community/eslint-comments/no-unlimited-disable": "off",
130
+ "@typescript-eslint/consistent-type-definitions": "off",
131
+ "@typescript-eslint/explicit-function-return-type": "off",
132
+ "@typescript-eslint/no-unsafe-assignment": "off",
133
+ "@typescript-eslint/no-unsafe-return": "off",
134
+ "no-restricted-syntax": "off",
135
+ "unused-imports/no-unused-vars": "off"
136
+ }
113
137
  }
114
138
  ];
115
139
  }
@@ -1,6 +1,6 @@
1
- import { OptionsIsInEditor, TypedFlatConfigItem } from "../types.mjs";
1
+ import { OptionsPnpm, TypedFlatConfigItem } from "../types.mjs";
2
2
 
3
3
  //#region src/configs/pnpm.d.ts
4
- declare function pnpm(options: OptionsIsInEditor): Promise<TypedFlatConfigItem[]>;
4
+ declare function pnpm(options: OptionsPnpm): Promise<TypedFlatConfigItem[]>;
5
5
  //#endregion
6
6
  export { pnpm };
@@ -1,32 +1,130 @@
1
+ import { findUp } from "../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.mjs";
1
2
  import { interopDefault } from "../utils.mjs";
3
+ import { readFile } from "node:fs/promises";
2
4
 
3
5
  //#region src/configs/pnpm.ts
6
+ async function detectCatalogUsage() {
7
+ const workspaceFile = await findUp("pnpm-workspace.yaml");
8
+ if (!workspaceFile) return false;
9
+ const yaml = await readFile(workspaceFile, "utf8");
10
+ return yaml.includes("catalog:") || yaml.includes("catalogs:");
11
+ }
4
12
  async function pnpm(options) {
5
- const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
13
+ const [pluginPnpm, pluginYaml, yamlParser, jsoncParser] = await Promise.all([
6
14
  interopDefault(import("eslint-plugin-pnpm")),
15
+ interopDefault(import("eslint-plugin-yml")),
7
16
  interopDefault(import("yaml-eslint-parser")),
8
17
  interopDefault(import("jsonc-eslint-parser"))
9
18
  ]);
10
- return [{
19
+ const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml = true } = options;
20
+ const configs = [];
21
+ if (json) configs.push({
11
22
  files: ["package.json", "**/package.json"],
12
23
  languageOptions: { parser: jsoncParser },
13
24
  name: "eienjs/pnpm/package-json",
14
25
  plugins: { pnpm: pluginPnpm },
15
26
  rules: {
16
- "pnpm/json-enforce-catalog": ["error", { autofix: !options.isInEditor }],
17
- "pnpm/json-prefer-workspace-settings": ["error", { autofix: !options.isInEditor }],
18
- "pnpm/json-valid-catalog": ["error", { autofix: !options.isInEditor }]
27
+ ...catalogs ? { "pnpm/json-enforce-catalog": ["error", {
28
+ autofix: !isInEditor,
29
+ ignores: ["@types/vscode"]
30
+ }] } : {},
31
+ "pnpm/json-prefer-workspace-settings": ["error", { autofix: !isInEditor }],
32
+ "pnpm/json-valid-catalog": ["error", { autofix: !isInEditor }]
19
33
  }
20
- }, {
34
+ });
35
+ if (yaml) configs.push({
21
36
  files: ["pnpm-workspace.yaml"],
22
37
  languageOptions: { parser: yamlParser },
23
38
  name: "eienjs/pnpm/pnpm-workspace-yaml",
24
39
  plugins: { pnpm: pluginPnpm },
25
40
  rules: {
41
+ "pnpm/yaml-enforce-settings": ["error", { settings: {
42
+ shellEmulator: true,
43
+ trustPolicy: "no-downgrade"
44
+ } }],
26
45
  "pnpm/yaml-no-duplicate-catalog-item": "error",
27
46
  "pnpm/yaml-no-unused-catalog-item": "error"
28
47
  }
29
- }];
48
+ });
49
+ if (sort) configs.push({
50
+ files: ["pnpm-workspace.yaml"],
51
+ languageOptions: { parser: yamlParser },
52
+ name: "eienjs/pnpm/pnpm-workspace-yaml-sort",
53
+ plugins: { yaml: pluginYaml },
54
+ rules: { "yaml/sort-keys": [
55
+ "error",
56
+ {
57
+ order: [
58
+ ...[
59
+ "cacheDir",
60
+ "catalogMode",
61
+ "cleanupUnusedCatalogs",
62
+ "dedupeDirectDeps",
63
+ "deployAllFiles",
64
+ "enablePrePostScripts",
65
+ "engineStrict",
66
+ "extendNodePath",
67
+ "hoist",
68
+ "hoistPattern",
69
+ "hoistWorkspacePackages",
70
+ "ignoreCompatibilityDb",
71
+ "ignoreDepScripts",
72
+ "ignoreScripts",
73
+ "ignoreWorkspaceRootCheck",
74
+ "managePackageManagerVersions",
75
+ "minimumReleaseAge",
76
+ "minimumReleaseAgeExclude",
77
+ "modulesDir",
78
+ "nodeLinker",
79
+ "nodeVersion",
80
+ "optimisticRepeatInstall",
81
+ "packageManagerStrict",
82
+ "packageManagerStrictVersion",
83
+ "preferSymlinkedExecutables",
84
+ "preferWorkspacePackages",
85
+ "publicHoistPattern",
86
+ "registrySupportsTimeField",
87
+ "requiredScripts",
88
+ "resolutionMode",
89
+ "savePrefix",
90
+ "scriptShell",
91
+ "shamefullyHoist",
92
+ "shellEmulator",
93
+ "stateDir",
94
+ "supportedArchitectures",
95
+ "symlink",
96
+ "tag",
97
+ "trustPolicy",
98
+ "trustPolicyExclude",
99
+ "updateNotifier"
100
+ ],
101
+ "packages",
102
+ "overrides",
103
+ "patchedDependencies",
104
+ "catalog",
105
+ "catalogs",
106
+ ...[
107
+ "allowedDeprecatedVersions",
108
+ "allowNonAppliedPatches",
109
+ "configDependencies",
110
+ "ignoredBuiltDependencies",
111
+ "ignoredOptionalDependencies",
112
+ "neverBuiltDependencies",
113
+ "onlyBuiltDependencies",
114
+ "onlyBuiltDependenciesFile",
115
+ "packageExtensions",
116
+ "peerDependencyRules"
117
+ ]
118
+ ],
119
+ pathPattern: "^$"
120
+ },
121
+ {
122
+ order: { type: "asc" },
123
+ pathPattern: ".*"
124
+ }
125
+ ] }
126
+ });
127
+ return configs;
30
128
  }
31
129
 
32
130
  //#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
@@ -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
- 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
- ...[
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 = false, regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
54
+ const { adonisjs: enableAdonisjs = false, astro: enableAstro = false, componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, node: enableNode = 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();
@@ -70,10 +71,12 @@ function eienjs(options = {}) {
70
71
  configs.push(ignores(userIgnores), javascript({
71
72
  isInEditor,
72
73
  overrides: getOverrides(options, "javascript")
73
- }), comments(), node(), jsdoc({ stylistic: stylisticOptions }), imports({ stylistic: stylisticOptions }), command(), perfectionist());
74
- if (enableImports) configs.push(imports(enableImports === true ? { stylistic: stylisticOptions } : {
74
+ }), comments(), command(), perfectionist());
75
+ if (enableNode) configs.push(node());
76
+ if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
77
+ if (enableImports) configs.push(imports({
75
78
  stylistic: stylisticOptions,
76
- ...enableImports
79
+ ...resolveSubOptions(options, "imports")
77
80
  }));
78
81
  if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
79
82
  if (enableVue) componentExts.push("vue");
@@ -115,7 +118,15 @@ function eienjs(options = {}) {
115
118
  overrides: getOverrides(options, "jsonc"),
116
119
  stylistic: stylisticOptions
117
120
  }), sortPackageJson(), sortTsconfig());
118
- if (enableCatalogs) configs.push(pnpm({ isInEditor }));
121
+ if (enableCatalogs) {
122
+ const optionsPnpm = resolveSubOptions(options, "pnpm");
123
+ configs.push(pnpm({
124
+ isInEditor,
125
+ json: options.jsonc !== false,
126
+ yaml: options.yaml !== false,
127
+ ...optionsPnpm
128
+ }));
129
+ }
119
130
  if (options.yaml ?? true) configs.push(yaml({
120
131
  overrides: getOverrides(options, "yaml"),
121
132
  stylistic: stylisticOptions
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ConfigNames } from "./typegen.mjs";
2
- import { Awaitable, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsErasableSyntaxOnly, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsNuxt, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsTypescriptWithErasableSyntaxOnly, OptionsVue, Rules, StylisticConfig, TypedFlatConfigItem } from "./types.mjs";
2
+ import { Awaitable, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsErasableSyntaxOnly, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsNuxt, OptionsOverrides, OptionsPnpm, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsTypescriptWithErasableSyntaxOnly, OptionsVue, Rules, StylisticConfig, TypedFlatConfigItem } from "./types.mjs";
3
3
  import { ResolvedOptions, defaultPluginRenaming, eienjs, getOverrides, resolveSubOptions } from "./factory.mjs";
4
+ import { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON } from "./config_presets.mjs";
4
5
  import { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML } from "./globs.mjs";
5
6
  import { combine, ensurePackages, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, toArray } from "./utils.mjs";
6
- export { Awaitable, ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsErasableSyntaxOnly, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsNuxt, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsTypescriptWithErasableSyntaxOnly, OptionsVue, ResolvedOptions, Rules, StylisticConfig, TypedFlatConfigItem, combine, eienjs as default, defaultPluginRenaming, eienjs, ensurePackages, getOverrides, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, resolveSubOptions, toArray };
7
+ export { Awaitable, CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsErasableSyntaxOnly, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsNuxt, OptionsOverrides, OptionsPnpm, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsTypescriptWithErasableSyntaxOnly, OptionsVue, ResolvedOptions, Rules, StylisticConfig, TypedFlatConfigItem, combine, eienjs as default, defaultPluginRenaming, eienjs, ensurePackages, getOverrides, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, resolveSubOptions, toArray };
package/dist/index.mjs CHANGED
@@ -1,9 +1,10 @@
1
1
  import { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML } from "./globs.mjs";
2
2
  import { combine, ensurePackages, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, toArray } from "./utils.mjs";
3
3
  import { defaultPluginRenaming, eienjs, getOverrides, resolveSubOptions } from "./factory.mjs";
4
+ import { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON } from "./config_presets.mjs";
4
5
 
5
6
  //#region src/index.ts
6
7
  var src_default = eienjs;
7
8
 
8
9
  //#endregion
9
- export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, combine, src_default as default, defaultPluginRenaming, eienjs, ensurePackages, getOverrides, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, resolveSubOptions, toArray };
10
+ export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_EXTS, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, combine, src_default as default, defaultPluginRenaming, eienjs, ensurePackages, getOverrides, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, parserPlain, resolveSubOptions, toArray };
@@ -0,0 +1,41 @@
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
+ async function findUp(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 = await fsPromises.stat(filePath);
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
+ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
25
+ let directory = path.resolve(toPath(cwd) ?? "");
26
+ const { root } = path.parse(directory);
27
+ stopAt = path.resolve(directory, toPath(stopAt) ?? root);
28
+ const isAbsoluteName = path.isAbsolute(name);
29
+ while (directory) {
30
+ const filePath = isAbsoluteName ? name : path.join(directory, name);
31
+ try {
32
+ const stats = fs.statSync(filePath, { throwIfNoEntry: false });
33
+ if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
34
+ } catch {}
35
+ if (directory === stopAt || directory === root) break;
36
+ directory = path.dirname(directory);
37
+ }
38
+ }
39
+
40
+ //#endregion
41
+ export { findUp, findUpSync };
package/dist/package.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "1.6.0";
2
+ var version = "1.8.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };
@@ -3,6 +3,21 @@ import { Linter } from "eslint";
3
3
  //#region src/typegen.d.ts
4
4
 
5
5
  interface RuleOptions {
6
+ /**
7
+ * Disallow importing backend code in frontend (Inertia) files
8
+ * @see https://github.com/adonisjs/eslint-plugin-adonisjs#no-backend-import-in-frontend
9
+ */
10
+ '@adonisjs/no-backend-import-in-frontend'?: Linter.RuleEntry<AdonisjsNoBackendImportInFrontend>;
11
+ /**
12
+ * Prefer the typesafe @adonisjs/inertia Form component over the @inertiajs Form component
13
+ * @see https://github.com/adonisjs/eslint-plugin-adonisjs#prefer-adonisjs-inertia-form
14
+ */
15
+ '@adonisjs/prefer-adonisjs-inertia-form'?: Linter.RuleEntry<[]>;
16
+ /**
17
+ * Prefer the typesafe @adonisjs/inertia Link component over the @inertiajs Link component
18
+ * @see https://github.com/adonisjs/eslint-plugin-adonisjs#prefer-adonisjs-inertia-link
19
+ */
20
+ '@adonisjs/prefer-adonisjs-inertia-link'?: Linter.RuleEntry<[]>;
6
21
  /**
7
22
  * (Needed for HMR) Prefer lazy controller import over standard import
8
23
  * @see https://github.com/adonisjs/eslint-plugin-adonisjs#prefer-lazy-controller-import
@@ -1003,6 +1018,11 @@ interface RuleOptions {
1003
1018
  * @see https://typescript-eslint.io/rules/no-useless-constructor
1004
1019
  */
1005
1020
  '@typescript-eslint/no-useless-constructor'?: Linter.RuleEntry<[]>;
1021
+ /**
1022
+ * Disallow default values that will never be used
1023
+ * @see https://typescript-eslint.io/rules/no-useless-default-assignment
1024
+ */
1025
+ '@typescript-eslint/no-useless-default-assignment'?: Linter.RuleEntry<[]>;
1006
1026
  /**
1007
1027
  * Disallow empty exports that don't change anything in a module file
1008
1028
  * @see https://typescript-eslint.io/rules/no-useless-empty-export
@@ -1837,6 +1857,11 @@ interface RuleOptions {
1837
1857
  * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/consistent-type-specifier-style/README.md
1838
1858
  */
1839
1859
  'import/consistent-type-specifier-style'?: Linter.RuleEntry<ImportConsistentTypeSpecifierStyle>;
1860
+ /**
1861
+ * Ensure all exports appear after other statements.
1862
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/exports-last/README.md
1863
+ */
1864
+ 'import/exports-last'?: Linter.RuleEntry<[]>;
1840
1865
  /**
1841
1866
  * Ensure all imports appear before other statements.
1842
1867
  * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/first/README.md
@@ -3739,6 +3764,11 @@ interface RuleOptions {
3739
3764
  * @deprecated
3740
3765
  */
3741
3766
  'nonblock-statement-body-position'?: Linter.RuleEntry<NonblockStatementBodyPosition>;
3767
+ /**
3768
+ * Disallow setting `test` key in Nuxt config
3769
+ * @see https://eslint.nuxt.com/packages/plugin#nuxtno-nuxt-config-test-key
3770
+ */
3771
+ 'nuxt/no-nuxt-config-test-key'?: Linter.RuleEntry<[]>;
3742
3772
  /**
3743
3773
  * Prefer recommended order of Nuxt config properties
3744
3774
  * @see https://eslint.nuxt.com/packages/plugin#nuxtnuxt-config-keys-order
@@ -3921,6 +3951,11 @@ interface RuleOptions {
3921
3951
  * @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm/src/rules/json/json-valid-catalog.test.ts
3922
3952
  */
3923
3953
  'pnpm/json-valid-catalog'?: Linter.RuleEntry<PnpmJsonValidCatalog>;
3954
+ /**
3955
+ * Enforce settings in `pnpm-workspace.yaml`
3956
+ * @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm/src/rules/yaml/yaml-enforce-settings.test.ts
3957
+ */
3958
+ 'pnpm/yaml-enforce-settings'?: Linter.RuleEntry<PnpmYamlEnforceSettings>;
3924
3959
  /**
3925
3960
  * Disallow duplicate catalog items in `pnpm-workspace.yaml`
3926
3961
  * @see https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm/src/rules/yaml/yaml-no-duplicate-catalog-item.test.ts
@@ -4713,6 +4748,11 @@ interface RuleOptions {
4713
4748
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md
4714
4749
  */
4715
4750
  'test/no-test-return-statement'?: Linter.RuleEntry<[]>;
4751
+ /**
4752
+ * Disallow unnecessary async function wrapper for expected promises
4753
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-unneeded-async-expect-function.md
4754
+ */
4755
+ 'test/no-unneeded-async-expect-function'?: Linter.RuleEntry<[]>;
4716
4756
  /**
4717
4757
  * Enforce padding around `afterAll` blocks
4718
4758
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-after-all-blocks.md
@@ -4883,6 +4923,11 @@ interface RuleOptions {
4883
4923
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-contain.md
4884
4924
  */
4885
4925
  'test/prefer-to-contain'?: Linter.RuleEntry<[]>;
4926
+ /**
4927
+ * Suggest using `toHaveBeenCalledTimes()`
4928
+ * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-been-called-times.md
4929
+ */
4930
+ 'test/prefer-to-have-been-called-times'?: Linter.RuleEntry<[]>;
4886
4931
  /**
4887
4932
  * enforce using toHaveLength()
4888
4933
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-length.md
@@ -4908,11 +4953,6 @@ interface RuleOptions {
4908
4953
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
4909
4954
  */
4910
4955
  'test/require-hook'?: Linter.RuleEntry<TestRequireHook>;
4911
- /**
4912
- * require usage of import in vi.mock()
4913
- * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-import-vi-mock.md
4914
- */
4915
- 'test/require-import-vi-mock'?: Linter.RuleEntry<[]>;
4916
4956
  /**
4917
4957
  * require local Test Context for concurrent snapshot tests
4918
4958
  * @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md
@@ -7231,6 +7271,10 @@ interface RuleOptions {
7231
7271
  'yoda'?: Linter.RuleEntry<Yoda>;
7232
7272
  }
7233
7273
  /* ======= Declarations ======= */
7274
+ // ----- @adonisjs/no-backend-import-in-frontend -----
7275
+ type AdonisjsNoBackendImportInFrontend = [] | [{
7276
+ allowed?: string[];
7277
+ }];
7234
7278
  // ----- @eslint-community/eslint-comments/disable-enable-pair -----
7235
7279
  type EslintCommunityEslintCommentsDisableEnablePair = [] | [{
7236
7280
  allowWholeFile?: boolean;
@@ -13683,6 +13727,15 @@ type PnpmJsonValidCatalog = [] | [{
13683
13727
  enforceNoConflict?: boolean;
13684
13728
  fields?: unknown[];
13685
13729
  }];
13730
+ // ----- pnpm/yaml-enforce-settings -----
13731
+ type PnpmYamlEnforceSettings = [] | [{
13732
+ autofix?: boolean;
13733
+ settings?: {
13734
+ [k: string]: unknown | undefined;
13735
+ };
13736
+ requiredFields?: string[];
13737
+ forbiddenFields?: string[];
13738
+ }];
13686
13739
  // ----- pnpm/yaml-no-duplicate-catalog-item -----
13687
13740
  type PnpmYamlNoDuplicateCatalogItem = [] | [{
13688
13741
  allow?: string[];
@@ -15879,6 +15932,6 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
15879
15932
  onlyEquality?: boolean;
15880
15933
  }];
15881
15934
  // 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/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';
15935
+ type ConfigNames = 'eienjs/gitignore' | 'eienjs/ignores' | 'eienjs/javascript/setup' | 'eienjs/javascript/rules' | 'eienjs/eslint-comments/rules' | 'eienjs/command/rules' | 'eienjs/perfectionist/setup' | 'eienjs/node/rules' | 'eienjs/jsdoc/rules' | '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/inertia-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/adonisjs/types-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
15936
  //#endregion
15884
15937
  export { ConfigNames, RuleOptions };
package/dist/types.d.mts CHANGED
@@ -131,6 +131,8 @@ interface OptionsAdonisJS extends OptionsOverrides {
131
131
  tests?: string;
132
132
  config?: string;
133
133
  commands?: string;
134
+ inertia?: string;
135
+ types?: string;
134
136
  };
135
137
  }
136
138
  interface OptionsVue extends OptionsOverrides {
@@ -257,7 +259,7 @@ interface OptionsHasTypeScript {
257
259
  interface OptionsStylistic {
258
260
  stylistic?: boolean | StylisticConfig;
259
261
  }
260
- interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes'> {
262
+ interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'experimental'> {
261
263
  maxLineLength?: number;
262
264
  }
263
265
  interface OptionsOverrides {
@@ -278,6 +280,32 @@ interface OptionsRegExp {
278
280
  interface OptionsIsInEditor {
279
281
  isInEditor?: boolean;
280
282
  }
283
+ interface OptionsPnpm extends OptionsIsInEditor {
284
+ /**
285
+ * Requires catalogs usage
286
+ *
287
+ * Detects automatically based if `catalogs` is used in the pnpm-workspace.yaml file
288
+ */
289
+ catalogs?: boolean;
290
+ /**
291
+ * Enable linting for package.json, will install the jsonc parser
292
+ *
293
+ * @default true
294
+ */
295
+ json?: boolean;
296
+ /**
297
+ * Enable linting for pnpm-workspace.yaml, will install the yaml parser
298
+ *
299
+ * @default true
300
+ */
301
+ yaml?: boolean;
302
+ /**
303
+ * Sort entries in pnpm-workspace.yaml
304
+ *
305
+ * @default false
306
+ */
307
+ sort?: boolean;
308
+ }
281
309
  interface OptionsConfig extends OptionsComponentExts {
282
310
  /**
283
311
  * Enable gitignore support.
@@ -301,6 +329,18 @@ interface OptionsConfig extends OptionsComponentExts {
301
329
  * Core rules. Can't be disabled.
302
330
  */
303
331
  javascript?: OptionsOverrides;
332
+ /**
333
+ * Enable Node.js rules
334
+ *
335
+ * @default true
336
+ */
337
+ node?: boolean;
338
+ /**
339
+ * Enable JSDoc rules
340
+ *
341
+ * @default true
342
+ */
343
+ jsdoc?: boolean;
304
344
  /**
305
345
  * Enable TypeScript support.
306
346
  *
@@ -395,7 +435,7 @@ interface OptionsConfig extends OptionsComponentExts {
395
435
  * @experimental
396
436
  * @default false
397
437
  */
398
- pnpm?: boolean;
438
+ pnpm?: boolean | OptionsPnpm;
399
439
  /**
400
440
  * Use external formatters to format files.
401
441
  *
@@ -432,4 +472,4 @@ interface OptionsConfig extends OptionsComponentExts {
432
472
  nuxt?: boolean | OptionsNuxt;
433
473
  }
434
474
  //#endregion
435
- export { Awaitable, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsErasableSyntaxOnly, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsNuxt, OptionsOverrides, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsTypescriptWithErasableSyntaxOnly, OptionsVue, Rules, StylisticConfig, TypedFlatConfigItem };
475
+ export { Awaitable, OptionsAdonisJS, OptionsComponentExts, OptionsConfig, OptionsErasableSyntaxOnly, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsNuxt, OptionsOverrides, OptionsPnpm, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsTypescriptWithErasableSyntaxOnly, OptionsVue, Rules, StylisticConfig, TypedFlatConfigItem };
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.6.0",
4
+ "version": "1.8.0",
5
5
  "description": "EienJS ESLint Config",
6
6
  "author": "Fernando Isidro <luffynando@gmail.com> (https://github.com/luffynando/)",
7
7
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "main": "./dist/index.mjs",
28
28
  "module": "./dist/index.mjs",
29
29
  "types": "./dist/index.d.mts",
30
- "bin": "./bin/index.js",
30
+ "bin": "./bin/index.mjs",
31
31
  "files": [
32
32
  "bin",
33
33
  "dist"
@@ -36,14 +36,14 @@
36
36
  "node": ">=20.19"
37
37
  },
38
38
  "peerDependencies": {
39
- "@adonisjs/eslint-plugin": "^2.0.1",
40
- "@nuxt/eslint-plugin": "^1.11.0",
39
+ "@adonisjs/eslint-plugin": "^2.2.0",
40
+ "@nuxt/eslint-plugin": "^1.12.1",
41
41
  "@prettier/plugin-xml": "^3.4.2",
42
42
  "astro-eslint-parser": "^1.2.2",
43
- "eslint": "^9.39.1",
43
+ "eslint": "^9.39.2",
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,58 +78,60 @@
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.48.1",
82
- "@typescript-eslint/parser": "^8.48.1",
83
- "@vitest/eslint-plugin": "^1.5.1",
81
+ "@typescript-eslint/eslint-plugin": "^8.50.0",
82
+ "@typescript-eslint/parser": "^8.50.0",
83
+ "@vitest/eslint-plugin": "^1.6.1",
84
84
  "ansis": "^4.2.0",
85
85
  "cac": "^6.7.14",
86
86
  "eslint-config-flat-gitignore": "^2.1.0",
87
87
  "eslint-flat-config-utils": "^2.1.4",
88
88
  "eslint-merge-processors": "^2.0.0",
89
89
  "eslint-plugin-antfu": "^3.1.1",
90
- "eslint-plugin-command": "^3.3.1",
91
- "eslint-plugin-import-lite": "^0.3.0",
92
- "eslint-plugin-jsdoc": "^61.4.1",
90
+ "eslint-plugin-command": "^3.4.0",
91
+ "eslint-plugin-import-lite": "^0.4.0",
92
+ "eslint-plugin-jsdoc": "^61.5.0",
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.3",
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
102
  "eslint-plugin-vue": "^10.6.2",
103
- "eslint-plugin-yml": "^1.19.0",
103
+ "eslint-plugin-yml": "^1.19.1",
104
104
  "eslint-processor-vue-blocks": "^2.0.0",
105
105
  "globals": "^16.5.0",
106
- "jsonc-eslint-parser": "^2.4.1",
106
+ "jsonc-eslint-parser": "^2.4.2",
107
107
  "local-pkg": "^1.1.2",
108
108
  "parse-gitignore": "^2.0.0",
109
109
  "pathe": "^2.0.3",
110
- "toml-eslint-parser": "^0.10.0",
110
+ "toml-eslint-parser": "^0.10.1",
111
111
  "vue-eslint-parser": "^10.2.0",
112
112
  "yaml-eslint-parser": "^1.3.2"
113
113
  },
114
114
  "devDependencies": {
115
- "@adonisjs/eslint-plugin": "^2.0.1",
116
- "@commitlint/cli": "^20.1.0",
117
- "@commitlint/config-conventional": "^20.0.0",
115
+ "@adonisjs/eslint-plugin": "^2.2.0",
116
+ "@commitlint/cli": "^20.2.0",
117
+ "@commitlint/config-conventional": "^20.2.0",
118
118
  "@eslint/config-inspector": "^1.4.2",
119
- "@nuxt/eslint-plugin": "^1.11.0",
119
+ "@nuxt/eslint-plugin": "^1.12.1",
120
120
  "@prettier/plugin-xml": "^3.4.2",
121
- "@types/node": "^24.10.1",
121
+ "@types/node": "^24.10.4",
122
122
  "astro-eslint-parser": "^1.2.2",
123
123
  "auto-changelog": "^2.5.0",
124
- "eslint": "^9.39.1",
124
+ "eslint": "^9.39.2",
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.3",
131
133
  "prettier-plugin-astro": "^0.14.1",
132
- "tsdown": "^0.16.8",
134
+ "tsdown": "^0.18.2",
133
135
  "tsx": "^4.21.0",
134
136
  "typescript": "^5.9.3"
135
137
  },
File without changes