eslint-plugin-package-json 0.59.0 β†’ 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,11 +1,23 @@
1
1
  # Changelog
2
2
 
3
- # [0.59.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.58.0...v0.59.0) (2025-10-25)
3
+ # [0.60.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.59.1...v0.60.0) (2025-11-03)
4
+
5
+
6
+ ### Features
7
+
8
+ * **valid-author:** create more precise reports ([#1337](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1337)) ([e79ff9a](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/e79ff9ac602d85bf999686b018de6ace3a7bee36)), closes [#000](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/000)
4
9
 
10
+ ## [0.59.1](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.59.0...v0.59.1) (2025-10-30)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **deps:** update dependency validate-npm-package-name to v7 ([#1353](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1353)) ([be9970a](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/be9970a18c73521906d1564ca461d94159e88807))
15
+
16
+ # [0.59.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.58.0...v0.59.0) (2025-10-25)
5
17
 
6
18
  ### Features
7
19
 
8
- * **exports-subpaths-style:** add new rule ([#1328](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1328)) ([d1a82ed](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/d1a82edf78b7b4bd446018f1ea3bb77e1bc9c772)), closes [#1322](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1322)
20
+ - **exports-subpaths-style:** add new rule ([#1328](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1328)) ([d1a82ed](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/d1a82edf78b7b4bd446018f1ea3bb77e1bc9c772)), closes [#1322](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1322)
9
21
 
10
22
  # [0.58.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.57.0...v0.58.0) (2025-10-22)
11
23
 
package/README.md CHANGED
@@ -262,7 +262,7 @@ Thanks! πŸ—‚
262
262
  <td align="center" valign="top" width="14.28%"><a href="https://davidlj95.com"><img src="https://avatars.githubusercontent.com/u/8050648?v=4?s=100" width="100px;" alt="David LJ"/><br /><sub><b>David LJ</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=davidlj95" title="Documentation">πŸ“–</a></td>
263
263
  <td align="center" valign="top" width="14.28%"><a href="http://lishaduck.github.io"><img src="https://avatars.githubusercontent.com/u/88557639?v=4?s=100" width="100px;" alt="Eli"/><br /><sub><b>Eli</b></sub></a><br /><a href="#ideas-lishaduck" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Alishaduck" title="Bug reports">πŸ›</a></td>
264
264
  <td align="center" valign="top" width="14.28%"><a href="http://heggria.site"><img src="https://avatars.githubusercontent.com/u/34475327?v=4?s=100" width="100px;" alt="Heggria"/><br /><sub><b>Heggria</b></sub></a><br /><a href="#ideas-heggria" title="Ideas, Planning, & Feedback">πŸ€”</a></td>
265
- <td align="center" valign="top" width="14.28%"><a href="https://hirok.io"><img src="https://avatars.githubusercontent.com/u/1075694?v=4?s=100" width="100px;" alt="Hiroki Osame"/><br /><sub><b>Hiroki Osame</b></sub></a><br /><a href="#ideas-privatenumber" title="Ideas, Planning, & Feedback">πŸ€”</a></td>
265
+ <td align="center" valign="top" width="14.28%"><a href="https://hirok.io"><img src="https://avatars.githubusercontent.com/u/1075694?v=4?s=100" width="100px;" alt="Hiroki Osame"/><br /><sub><b>Hiroki Osame</b></sub></a><br /><a href="#ideas-privatenumber" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=privatenumber" title="Code">πŸ’»</a></td>
266
266
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/Zamiell"><img src="https://avatars.githubusercontent.com/u/5511220?v=4?s=100" width="100px;" alt="James"/><br /><sub><b>James</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=Zamiell" title="Code">πŸ’»</a> <a href="#ideas-Zamiell" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3AZamiell" title="Bug reports">πŸ›</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=Zamiell" title="Documentation">πŸ“–</a></td>
267
267
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/zetlen"><img src="https://avatars.githubusercontent.com/u/1643758?v=4?s=100" width="100px;" alt="James Zetlen"/><br /><sub><b>James Zetlen</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=zetlen" title="Code">πŸ’»</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Azetlen" title="Bug reports">πŸ›</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=zetlen" title="Documentation">πŸ“–</a> <a href="#infra-zetlen" title="Infrastructure (Hosting, Build-Tools, etc)">πŸš‡</a> <a href="#maintenance-zetlen" title="Maintenance">🚧</a> <a href="#tool-zetlen" title="Tools">πŸ”§</a></td>
268
268
  <td align="center" valign="top" width="14.28%"><a href="https://piranna.github.io/"><img src="https://avatars.githubusercontent.com/u/532414?v=4?s=100" width="100px;" alt="JesΓΊs LeganΓ©s-Combarro"/><br /><sub><b>JesΓΊs LeganΓ©s-Combarro</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=piranna" title="Code">πŸ’»</a></td>
package/lib/plugin.js CHANGED
@@ -7,13 +7,14 @@ import { rules } from "./rules/require-properties.js";
7
7
  import { rule as rule$5 } from "./rules/restrict-dependency-ranges.js";
8
8
  import { rule as rule$6 } from "./rules/sort-collections.js";
9
9
  import { rule as rule$7 } from "./rules/unique-dependencies.js";
10
- import { rule as rule$8 } from "./rules/valid-bin.js";
11
- import { rule as rule$9 } from "./rules/valid-local-dependency.js";
12
- import { rule as rule$10 } from "./rules/valid-name.js";
13
- import { rule as rule$11 } from "./rules/valid-package-definition.js";
10
+ import { rule as rule$8 } from "./rules/valid-author.js";
11
+ import { rule as rule$9 } from "./rules/valid-bin.js";
12
+ import { rule as rule$10 } from "./rules/valid-local-dependency.js";
13
+ import { rule as rule$11 } from "./rules/valid-name.js";
14
+ import { rule as rule$12 } from "./rules/valid-package-definition.js";
14
15
  import { rules as rules$1 } from "./rules/valid-properties.js";
15
- import { rule as rule$12 } from "./rules/valid-repository-directory.js";
16
- import { rule as rule$13 } from "./rules/valid-version.js";
16
+ import { rule as rule$13 } from "./rules/valid-repository-directory.js";
17
+ import { rule as rule$14 } from "./rules/valid-version.js";
17
18
  import { createRequire } from "node:module";
18
19
  import * as parserJsonc from "jsonc-eslint-parser";
19
20
 
@@ -30,14 +31,15 @@ const rules$2 = {
30
31
  "sort-collections": rule$6,
31
32
  "unique-dependencies": rule$7,
32
33
  ...rules$1,
33
- "valid-bin": rule$8,
34
- "valid-local-dependency": rule$9,
35
- "valid-name": rule$10,
36
- "valid-package-definition": rule$11,
37
- "valid-repository-directory": rule$12,
38
- "valid-version": rule$13
34
+ "valid-author": rule$8,
35
+ "valid-bin": rule$9,
36
+ "valid-local-dependency": rule$10,
37
+ "valid-name": rule$11,
38
+ "valid-package-definition": rule$12,
39
+ "valid-repository-directory": rule$13,
40
+ "valid-version": rule$14
39
41
  };
40
- const baseRecommendedRules = { ...Object.fromEntries(Object.entries(rules$2).filter(([, rule$14]) => rule$14.meta.docs?.recommended).map(([name$1]) => ["package-json/" + name$1, "error"])) };
42
+ const baseRecommendedRules = { ...Object.fromEntries(Object.entries(rules$2).filter(([, rule$15]) => rule$15.meta.docs?.recommended).map(([name$1]) => ["package-json/" + name$1, "error"])) };
41
43
  const recommendedRules = {
42
44
  ...baseRecommendedRules,
43
45
  "package-json/valid-package-definition": ["error", { ignoreProperties: Object.entries(baseRecommendedRules).filter(([name$1]) => name$1.startsWith("package-json/valid-") && name$1 !== "package-json/valid-package-definition").map(([name$1]) => name$1.replace("package-json/valid-", "")) }]
@@ -0,0 +1,6 @@
1
+ import { PackageJsonRuleModule } from "../createRule.js";
2
+
3
+ //#region src/rules/valid-author.d.ts
4
+ declare const rule: PackageJsonRuleModule<[], []>;
5
+ //#endregion
6
+ export { rule };
@@ -0,0 +1,39 @@
1
+ import { createRule } from "../createRule.js";
2
+ import { validateAuthor } from "package-json-validator";
3
+
4
+ //#region src/rules/valid-author.ts
5
+ const rule = createRule({
6
+ create(context) {
7
+ const reportIssues = (result, node) => {
8
+ if (result.errorMessages.length === 0) return;
9
+ if (result.issues.length) for (const issue of result.issues) context.report({
10
+ data: { error: issue.message },
11
+ messageId: "validationError",
12
+ node
13
+ });
14
+ const childrenWithIssues = result.childResults.filter((childResult) => childResult.errorMessages.length);
15
+ if (node.type === "JSONObjectExpression" && childrenWithIssues.length) for (const childResult of childrenWithIssues) {
16
+ const childNode = node.properties[childResult.index];
17
+ reportIssues(childResult, childNode);
18
+ }
19
+ };
20
+ return { "Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.value=author]"(node) {
21
+ const valueNode = node.value;
22
+ reportIssues(validateAuthor(JSON.parse(context.sourceCode.getText(valueNode))), valueNode);
23
+ } };
24
+ },
25
+ meta: {
26
+ docs: {
27
+ category: "Best Practices",
28
+ description: "Enforce that the `author` property is valid.",
29
+ recommended: true
30
+ },
31
+ messages: { validationError: `Invalid author: {{ error }}` },
32
+ schema: [],
33
+ type: "problem"
34
+ },
35
+ name: "valid-author"
36
+ });
37
+
38
+ //#endregion
39
+ export { rule };
@@ -1,7 +1,7 @@
1
1
  import { createRule } from "../createRule.js";
2
2
  import { formatErrors } from "../utils/formatErrors.js";
3
- import { kebabCase } from "change-case";
4
3
  import { validateBin } from "package-json-validator";
4
+ import { kebabCase } from "change-case";
5
5
 
6
6
  //#region src/rules/valid-bin.ts
7
7
  const rule = createRule({
@@ -1,9 +1,8 @@
1
1
  import { createSimpleValidPropertyRule } from "../utils/createSimpleValidPropertyRule.js";
2
- import { validateAuthor, validateBundleDependencies, validateConfig, validateCpu, validateDependencies, validateDescription, validateDirectories, validateExports, validateLicense, validateScripts, validateType } from "package-json-validator";
2
+ import { validateBundleDependencies, validateConfig, validateCpu, validateDependencies, validateDescription, validateDirectories, validateExports, validateLicense, validateScripts, validateType } from "package-json-validator";
3
3
 
4
4
  //#region src/rules/valid-properties.ts
5
5
  const properties = [
6
- ["author", validateAuthor],
7
6
  ["bundleDependencies", {
8
7
  aliases: ["bundledDependencies"],
9
8
  validator: validateBundleDependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-package-json",
3
- "version": "0.59.0",
3
+ "version": "0.60.0",
4
4
  "description": "Rules for consistent, readable, and valid package.json files. πŸ—‚οΈ",
5
5
  "homepage": "https://github.com/JoshuaKGoldberg/eslint-plugin-package-json#readme",
6
6
  "bugs": {
@@ -48,26 +48,26 @@
48
48
  "detect-indent": "^7.0.2",
49
49
  "detect-newline": "^4.0.1",
50
50
  "eslint-fix-utils": "~0.4.0",
51
- "package-json-validator": "~0.31.0",
51
+ "package-json-validator": "~0.32.1",
52
52
  "semver": "^7.7.3",
53
53
  "sort-object-keys": "^2.0.0",
54
54
  "sort-package-json": "^3.4.0",
55
- "validate-npm-package-name": "^6.0.2"
55
+ "validate-npm-package-name": "^7.0.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
59
59
  "@eslint/js": "9.38.0",
60
60
  "@release-it/conventional-changelog": "10.0.0",
61
61
  "@types/estree": "1.0.7",
62
- "@types/node": "22.18.0",
62
+ "@types/node": "24.9.1",
63
63
  "@types/semver": "7.7.0",
64
64
  "@types/validate-npm-package-name": "4.0.2",
65
- "@vitest/coverage-v8": "3.2.0",
65
+ "@vitest/coverage-v8": "4.0.4",
66
66
  "@vitest/eslint-plugin": "1.3.3",
67
67
  "console-fail-test": "0.5.0",
68
68
  "eslint": "9.38.0",
69
69
  "eslint-doc-generator": "2.3.0",
70
- "eslint-plugin-eslint-plugin": "7.0.0",
70
+ "eslint-plugin-eslint-plugin": "7.2.0",
71
71
  "eslint-plugin-jsdoc": "61.1.0",
72
72
  "eslint-plugin-jsonc": "2.21.0",
73
73
  "eslint-plugin-n": "17.23.1",
@@ -83,7 +83,7 @@
83
83
  "markdownlint": "0.39.0",
84
84
  "markdownlint-cli": "0.45.0",
85
85
  "prettier": "3.6.0",
86
- "prettier-plugin-curly": "0.3.1",
86
+ "prettier-plugin-curly": "0.4.0",
87
87
  "prettier-plugin-packagejson": "2.5.10",
88
88
  "prettier-plugin-sh": "0.18.0",
89
89
  "release-it": "19.0.1",
@@ -91,13 +91,13 @@
91
91
  "tsdown": "0.15.0",
92
92
  "typescript": "5.9.2",
93
93
  "typescript-eslint": "8.46.0",
94
- "vitest": "3.2.0"
94
+ "vitest": "4.0.4"
95
95
  },
96
96
  "peerDependencies": {
97
97
  "eslint": ">=8.0.0",
98
98
  "jsonc-eslint-parser": "^2.0.0"
99
99
  },
100
- "packageManager": "pnpm@10.18.0",
100
+ "packageManager": "pnpm@10.19.0",
101
101
  "engines": {
102
102
  "node": "^20.19.0 || >=22.12.0"
103
103
  },