eslint-plugin-package-json 1.0.0-beta.5 → 1.0.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,5 +1,69 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.0](https://github.com/michaelfaith/eslint-plugin-package-json/compare/v0.91.2...v1.0.0) (2026-05-17)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * add `valid-browser` rule ([#1763](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1763))
9
+ * add `valid-bugs` rule ([#1644](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1644))
10
+ * add `valid-funding` rule ([#1643](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1643))
11
+ * add `valid-gypfile` rule ([#1765](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1765))
12
+ * add `valid-libc` rule ([#1764](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1764))
13
+ * add `valid-packageManager` rule ([#1640](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1640))
14
+ * add `valid-peerDependenciesMeta-relationship` rule ([#1767](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1767))
15
+ * add `valid-peerDependenciesMeta` rule ([#1766](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1766))
16
+ * drop `legacy-recommended` rc-based config ([#1579](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1579))
17
+ * drop support for eslint v8 ([#1589](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1589))
18
+ * **order-properties:** remove legacy order option
19
+ * remove `valid-package-definition` rule ([#1707](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1707))
20
+ * update node engines to `^22.22.2 || >=24.15.0` ([#1824](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1824))
21
+ * **valid-name:** refactor to align with other `valid-` rules ([#1821](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1821))
22
+
23
+ ### 🚀 Features
24
+
25
+ * add `require-browser` rule ([#1835](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1835)) ([56433d0](https://github.com/michaelfaith/eslint-plugin-package-json/commit/56433d0b3ae784a14e700074b678a271804f1e3e))
26
+ * add `require-config` rule ([#1834](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1834)) ([24f4eb0](https://github.com/michaelfaith/eslint-plugin-package-json/commit/24f4eb004749ecc953a5ebbc090a256608538f3c))
27
+ * add `require-gypfile` rule ([#1836](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1836)) ([d6cc291](https://github.com/michaelfaith/eslint-plugin-package-json/commit/d6cc29190bf3377b6541efa0f6a477012e68b3af))
28
+ * add `require-libc` rule ([#1837](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1837)) ([53a208e](https://github.com/michaelfaith/eslint-plugin-package-json/commit/53a208e786fd5ade05a16d00cf90eb5c1121f7d4))
29
+ * add `valid-browser` rule ([#1763](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1763)) ([6cb438b](https://github.com/michaelfaith/eslint-plugin-package-json/commit/6cb438bb5c68af1062a5d7a26131795b7aa9a24b))
30
+ * add `valid-bugs` rule ([#1644](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1644)) ([f981fa3](https://github.com/michaelfaith/eslint-plugin-package-json/commit/f981fa38ab4f1630c6db0933d859974d0a6ec0b3))
31
+ * add `valid-funding` rule ([#1643](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1643)) ([5b3c77d](https://github.com/michaelfaith/eslint-plugin-package-json/commit/5b3c77da9b8edcd659a1fd9b3e51d1e43803aa5e))
32
+ * add `valid-gypfile` rule ([#1765](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1765)) ([c14f624](https://github.com/michaelfaith/eslint-plugin-package-json/commit/c14f624137fa11f42f6b5d97357043a94408edd7))
33
+ * add `valid-libc` rule ([#1764](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1764)) ([4dd5e9c](https://github.com/michaelfaith/eslint-plugin-package-json/commit/4dd5e9c251e2b4e68571080cfe9fbfeb030b1775))
34
+ * add `valid-packageManager` rule ([#1640](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1640)) ([9a65480](https://github.com/michaelfaith/eslint-plugin-package-json/commit/9a65480cb55a4d03043916def549cfd7fc4b604b))
35
+ * add `valid-peerDependenciesMeta-relationship` rule ([#1767](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1767)) ([7fc3f0d](https://github.com/michaelfaith/eslint-plugin-package-json/commit/7fc3f0d17ab9be57b3fc118746a38caf9395db18))
36
+ * add `valid-peerDependenciesMeta` rule ([#1766](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1766)) ([8731609](https://github.com/michaelfaith/eslint-plugin-package-json/commit/873160958c77caa6b479053a2fad2b41dacc18fe))
37
+ * **order-properties:** remove legacy order option ([935f6dc](https://github.com/michaelfaith/eslint-plugin-package-json/commit/935f6dccccdfe7d61deb43e083647a0a1dc8e953))
38
+ * remove `valid-package-definition` rule ([#1707](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1707)) ([a4a5b86](https://github.com/michaelfaith/eslint-plugin-package-json/commit/a4a5b86e94b1fd41da8b113f49c96a8149e30fa6))
39
+ * update node engines to `^22.22.2 || >=24.15.0` ([#1824](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1824)) ([ce1aa5e](https://github.com/michaelfaith/eslint-plugin-package-json/commit/ce1aa5e222cd17cd25baa9ebf2221642ddc6ed79))
40
+ * **valid-name:** refactor to align with other `valid-` rules ([#1821](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1821)) ([2104e75](https://github.com/michaelfaith/eslint-plugin-package-json/commit/2104e75e70eee219d57309e50f1812f8d144a11e))
41
+ * **valid-version:** refactor to align with other valid- rules ([#1827](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1827)) ([958c105](https://github.com/michaelfaith/eslint-plugin-package-json/commit/958c10558d4186c9885588c2e7da23e5644d98a6))
42
+
43
+
44
+ ### 🩹 Bug Fixes
45
+
46
+ * improve report range for `require-` rules ([#1840](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1840)) ([1f03c6a](https://github.com/michaelfaith/eslint-plugin-package-json/commit/1f03c6ac732ffae7d29177411a6cbc6798b813da))
47
+
48
+ ## [1.0.0-beta.6](https://github.com/michaelfaith/eslint-plugin-package-json/compare/v1.0.0-beta.5...v1.0.0-beta.6) (2026-05-02)
49
+
50
+
51
+ ### ⚠ BREAKING CHANGES
52
+
53
+ * add `valid-peerDependenciesMeta-relationship` rule ([#1767](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1767))
54
+ * add `valid-peerDependenciesMeta` rule ([#1766](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1766))
55
+ * add `valid-gypfile` rule ([#1765](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1765))
56
+ * add `valid-browser` rule ([#1763](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1763))
57
+ * add `valid-libc` rule ([#1764](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1764))
58
+
59
+ ### 🚀 Features
60
+
61
+ * add `valid-browser` rule ([#1763](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1763)) ([6cb438b](https://github.com/michaelfaith/eslint-plugin-package-json/commit/6cb438bb5c68af1062a5d7a26131795b7aa9a24b))
62
+ * add `valid-gypfile` rule ([#1765](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1765)) ([c14f624](https://github.com/michaelfaith/eslint-plugin-package-json/commit/c14f624137fa11f42f6b5d97357043a94408edd7))
63
+ * add `valid-libc` rule ([#1764](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1764)) ([4dd5e9c](https://github.com/michaelfaith/eslint-plugin-package-json/commit/4dd5e9c251e2b4e68571080cfe9fbfeb030b1775))
64
+ * add `valid-peerDependenciesMeta-relationship` rule ([#1767](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1767)) ([7fc3f0d](https://github.com/michaelfaith/eslint-plugin-package-json/commit/7fc3f0d17ab9be57b3fc118746a38caf9395db18))
65
+ * add `valid-peerDependenciesMeta` rule ([#1766](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1766)) ([8731609](https://github.com/michaelfaith/eslint-plugin-package-json/commit/873160958c77caa6b479053a2fad2b41dacc18fe))
66
+
3
67
  ## [1.0.0-beta.5](https://github.com/michaelfaith/eslint-plugin-package-json/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2026-04-28)
4
68
 
5
69
 
package/LICENSE.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # MIT License
2
2
 
3
+ Copyright © 2026 michael faith
4
+
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
5
7
  'Software'), to deal in the Software without restriction, including
package/README.md CHANGED
@@ -1,4 +1,12 @@
1
- <h1 align="center">eslint-plugin-package-json</h1>
1
+ <p align="center">
2
+ <img
3
+ src="https://raw.githubusercontent.com/michaelfaith/eslint-plugin-package-json/main/site/src/assets/logo/logo.svg"
4
+ alt="Logo Image"
5
+ height="240"
6
+ />
7
+ </>
8
+
9
+ <h1 align="center">ESLint Plugin: Package JSON</h1>
2
10
 
3
11
  <p align="center">
4
12
  Rules for consistent, readable, and valid package.json files.
@@ -11,20 +19,17 @@
11
19
  <a href="#contributors" target="_blank"><img alt="👪 All Contributors: 42" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-42-21bb42.svg" /></a>
12
20
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
13
21
  <!-- prettier-ignore-end -->
14
- <a href="https://github.com/michaelfaith/eslint-plugin-package-json/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
15
22
  <a href="https://codecov.io/gh/michaelfaith/eslint-plugin-package-json" target="_blank"><img alt="🧪 Coverage" src="https://img.shields.io/codecov/c/github/michaelfaith/eslint-plugin-package-json?label=%F0%9F%A7%AA%20coverage" /></a>
16
23
  <a href="https://github.com/michaelfaith/eslint-plugin-package-json/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg" /></a>
17
24
  <a href="http://npmjs.com/package/eslint-plugin-package-json" target="_blank"><img alt="📦 npm version" src="https://img.shields.io/npm/v/eslint-plugin-package-json?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
18
- <img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
19
25
  </p>
20
26
 
21
27
  ## Getting Started
22
28
 
23
- See [Getting Started](https://github.com/michaelfaith/eslint-plugin-package-json/blob/main/docs/getting-started.md) for details.
29
+ See [Getting Started](https://eslint-plugin-package-json.dev/getting-started) for details.
24
30
 
25
31
  ## Supported Rules
26
32
 
27
- <!-- prettier-ignore-start -->
28
33
  <!-- begin auto-generated rules list -->
29
34
 
30
35
  💼 Configurations enabled in.\
@@ -34,96 +39,104 @@ See [Getting Started](https://github.com/michaelfaith/eslint-plugin-package-json
34
39
  🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
35
40
  💡 Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
36
41
 
37
- | Name                          | Description | 💼 | 🔧 | 💡 |
38
- | :--------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--- | :- | :- |
39
- | [bin-name-casing](docs/rules/bin-name-casing.md) | Enforce that names for bin properties are in kebab case. | 🎨 | | 💡 |
40
- | [exports-subpaths-style](docs/rules/exports-subpaths-style.md) | Enforce consistent format for the exports field (implicit or explicit subpaths). | 🎨 | 🔧 | |
41
- | [no-empty-fields](docs/rules/no-empty-fields.md) | Reports on unnecessary empty arrays and objects. | ✅ 📦 | | 💡 |
42
- | [no-redundant-files](docs/rules/no-redundant-files.md) | Prevents adding unnecessary / redundant files. | ✅ 📦 | | 💡 |
43
- | [no-redundant-publishConfig](docs/rules/no-redundant-publishConfig.md) | Warns when publishConfig.access is used in unscoped packages. | ✅ 📦 | | 💡 |
44
- | [order-properties](docs/rules/order-properties.md) | Package properties should be declared in standard order | 🎨 | 🔧 | |
45
- | [repository-shorthand](docs/rules/repository-shorthand.md) | Enforce either object or shorthand declaration for repository. | ✅ 📦 | 🔧 | |
46
- | [require-attribution](docs/rules/require-attribution.md) | Ensures that proper attribution is included, requiring that either `author` or `contributors` is defined, and that if `contributors` is present, it should include at least one contributor. | ✅ 📦 | | 💡 |
47
- | [require-author](docs/rules/require-author.md) | Requires the `author` property to be present. | | | |
48
- | [require-bin](docs/rules/require-bin.md) | Requires the `bin` property to be present. | | | |
49
- | [require-bugs](docs/rules/require-bugs.md) | Requires the `bugs` property to be present. | | | |
50
- | [require-bundleDependencies](docs/rules/require-bundleDependencies.md) | Requires the `bundleDependencies` property to be present. | | | |
51
- | [require-contributors](docs/rules/require-contributors.md) | Requires the `contributors` property to be present. | | | |
52
- | [require-cpu](docs/rules/require-cpu.md) | Requires the `cpu` property to be present. | | | |
53
- | [require-dependencies](docs/rules/require-dependencies.md) | Requires the `dependencies` property to be present. | | | |
54
- | [require-description](docs/rules/require-description.md) | Requires the `description` property to be present. | ✅ 📦 | | |
55
- | [require-devDependencies](docs/rules/require-devDependencies.md) | Requires the `devDependencies` property to be present. | | | |
56
- | [require-devEngines](docs/rules/require-devEngines.md) | Requires the `devEngines` property to be present. | | | |
57
- | [require-directories](docs/rules/require-directories.md) | Requires the `directories` property to be present. | | | |
58
- | [require-engines](docs/rules/require-engines.md) | Requires the `engines` property to be present. | | | |
59
- | [require-exports](docs/rules/require-exports.md) | Requires the `exports` property to be present. | ✅ 📦 | | |
60
- | [require-files](docs/rules/require-files.md) | Requires the `files` property to be present. | ✅ 📦 | | |
61
- | [require-funding](docs/rules/require-funding.md) | Requires the `funding` property to be present. | | | |
62
- | [require-homepage](docs/rules/require-homepage.md) | Requires the `homepage` property to be present. | | | |
63
- | [require-keywords](docs/rules/require-keywords.md) | Requires the `keywords` property to be present. | | | |
64
- | [require-license](docs/rules/require-license.md) | Requires the `license` property to be present. | ✅ 📦 | | |
65
- | [require-main](docs/rules/require-main.md) | Requires the `main` property to be present. | | | |
66
- | [require-man](docs/rules/require-man.md) | Requires the `man` property to be present. | | | |
67
- | [require-module](docs/rules/require-module.md) | Requires the `module` property to be present. | | | |
68
- | [require-name](docs/rules/require-name.md) | Requires the `name` property to be present. | ✅ 📦 | | |
69
- | [require-optionalDependencies](docs/rules/require-optionalDependencies.md) | Requires the `optionalDependencies` property to be present. | | | |
70
- | [require-os](docs/rules/require-os.md) | Requires the `os` property to be present. | | | |
71
- | [require-packageManager](docs/rules/require-packageManager.md) | Requires the `packageManager` property to be present. | | | |
72
- | [require-peerDependencies](docs/rules/require-peerDependencies.md) | Requires the `peerDependencies` property to be present. | | | |
73
- | [require-private](docs/rules/require-private.md) | Requires the `private` property to be present. | | 🔧 | |
74
- | [require-publishConfig](docs/rules/require-publishConfig.md) | Requires the `publishConfig` property to be present. | | | |
75
- | [require-repository](docs/rules/require-repository.md) | Requires the `repository` property to be present. | ✅ 📦 | | |
76
- | [require-scripts](docs/rules/require-scripts.md) | Requires the `scripts` property to be present. | | | |
77
- | [require-sideEffects](docs/rules/require-sideEffects.md) | Requires the `sideEffects` property to be present. | ✅ 📦 | | |
78
- | [require-type](docs/rules/require-type.md) | Requires the `type` property to be present. | ✅ 📦 | 🔧 | |
79
- | [require-types](docs/rules/require-types.md) | Requires the `types` property to be present. | | | |
80
- | [require-version](docs/rules/require-version.md) | Requires the `version` property to be present. | ✅ 📦 | | |
81
- | [restrict-dependency-ranges](docs/rules/restrict-dependency-ranges.md) | Restricts the range of dependencies to allow or disallow specific types of ranges. | | | 💡 |
82
- | [restrict-private-properties](docs/rules/restrict-private-properties.md) | Disallows unnecessary properties in private packages. | | 🔧 | 💡 |
83
- | [restrict-top-level-properties](docs/rules/restrict-top-level-properties.md) | Disallows specified top-level properties in package.json. | | | 💡 |
84
- | [scripts-name-casing](docs/rules/scripts-name-casing.md) | Enforce that names for `scripts` are in kebab case (optionally separated by colons). | 🎨 | | 💡 |
85
- | [sort-collections](docs/rules/sort-collections.md) | Selected collections must be in a consistent order (lexicographical for most; lifecycle-aware for scripts). | ✅ 📦 | 🔧 | |
86
- | [specify-peers-locally](docs/rules/specify-peers-locally.md) | Requires that all peer dependencies are also declared as dev dependencies | ✅ 📦 | | 💡 |
87
- | [unique-dependencies](docs/rules/unique-dependencies.md) | Checks a dependency isn't specified more than once (i.e. in `dependencies` and `devDependencies`) | ✅ 📦 | | 💡 |
88
- | [valid-author](docs/rules/valid-author.md) | Enforce that the `author` property is valid. | 📦 | | |
89
- | [valid-bin](docs/rules/valid-bin.md) | Enforce that the `bin` property is valid. | ✅ 📦 | | |
90
- | [valid-bugs](docs/rules/valid-bugs.md) | Enforce that the `bugs` property is valid. | ✅ 📦 | | |
91
- | [valid-bundleDependencies](docs/rules/valid-bundleDependencies.md) | Enforce that the `bundleDependencies` (also: `bundledDependencies`) property is valid. | ✅ 📦 | | |
92
- | [valid-config](docs/rules/valid-config.md) | Enforce that the `config` property is valid. | ✅ 📦 | | |
93
- | [valid-contributors](docs/rules/valid-contributors.md) | Enforce that the `contributors` property is valid. | ✅ 📦 | | |
94
- | [valid-cpu](docs/rules/valid-cpu.md) | Enforce that the `cpu` property is valid. | ✅ 📦 | | |
95
- | [valid-dependencies](docs/rules/valid-dependencies.md) | Enforce that the `dependencies` property is valid. | ✅ 📦 | | |
96
- | [valid-description](docs/rules/valid-description.md) | Enforce that the `description` property is valid. | ✅ 📦 | | |
97
- | [valid-devDependencies](docs/rules/valid-devDependencies.md) | Enforce that the `devDependencies` property is valid. | ✅ 📦 | | |
98
- | [valid-devEngines](docs/rules/valid-devEngines.md) | Enforce that the `devEngines` property is valid. | ✅ 📦 | | |
99
- | [valid-directories](docs/rules/valid-directories.md) | Enforce that the `directories` property is valid. | ✅ 📦 | | |
100
- | [valid-engines](docs/rules/valid-engines.md) | Enforce that the `engines` property is valid. | ✅ 📦 | | |
101
- | [valid-exports](docs/rules/valid-exports.md) | Enforce that the `exports` property is valid. | ✅ 📦 | | |
102
- | [valid-files](docs/rules/valid-files.md) | Enforce that the `files` property is valid. | ✅ 📦 | | |
103
- | [valid-funding](docs/rules/valid-funding.md) | Enforce that the `funding` property is valid. | ✅ 📦 | | |
104
- | [valid-homepage](docs/rules/valid-homepage.md) | Enforce that the `homepage` property is valid. | ✅ 📦 | | |
105
- | [valid-keywords](docs/rules/valid-keywords.md) | Enforce that the `keywords` property is valid. | ✅ 📦 | | |
106
- | [valid-license](docs/rules/valid-license.md) | Enforce that the `license` property is valid. | ✅ 📦 | | |
107
- | [valid-main](docs/rules/valid-main.md) | Enforce that the `main` property is valid. | ✅ 📦 | | |
108
- | [valid-man](docs/rules/valid-man.md) | Enforce that the `man` property is valid. | ✅ 📦 | | |
109
- | [valid-module](docs/rules/valid-module.md) | Enforce that the `module` property is valid. | ✅ 📦 | | |
110
- | [valid-name](docs/rules/valid-name.md) | Enforce that package names are valid npm package names | ✅ 📦 | | |
111
- | [valid-optionalDependencies](docs/rules/valid-optionalDependencies.md) | Enforce that the `optionalDependencies` property is valid. | ✅ 📦 | | |
112
- | [valid-os](docs/rules/valid-os.md) | Enforce that the `os` property is valid. | ✅ 📦 | | |
113
- | [valid-packageManager](docs/rules/valid-packageManager.md) | Enforce that the `packageManager` property is valid. | ✅ 📦 | | |
114
- | [valid-peerDependencies](docs/rules/valid-peerDependencies.md) | Enforce that the `peerDependencies` property is valid. | ✅ 📦 | | |
115
- | [valid-private](docs/rules/valid-private.md) | Enforce that the `private` property is valid. | ✅ 📦 | | |
116
- | [valid-publishConfig](docs/rules/valid-publishConfig.md) | Enforce that the `publishConfig` property is valid. | ✅ 📦 | | |
117
- | [valid-repository](docs/rules/valid-repository.md) | Enforce that the `repository` property is valid. | ✅ 📦 | | |
118
- | [valid-repository-directory](docs/rules/valid-repository-directory.md) | Enforce that if repository directory is specified, it matches the path to the package.json file | ✅ 📦 | | 💡 |
119
- | [valid-scripts](docs/rules/valid-scripts.md) | Enforce that the `scripts` property is valid. | ✅ 📦 | | |
120
- | [valid-sideEffects](docs/rules/valid-sideEffects.md) | Enforce that the `sideEffects` property is valid. | ✅ 📦 | | |
121
- | [valid-type](docs/rules/valid-type.md) | Enforce that the `type` property is valid. | ✅ 📦 | | |
122
- | [valid-version](docs/rules/valid-version.md) | Enforce that package versions are valid semver specifiers | ✅ 📦 | | |
123
- | [valid-workspaces](docs/rules/valid-workspaces.md) | Enforce that the `workspaces` property is valid. | ✅ 📦 | | |
42
+ | Name                                    | Description | 💼 | 🔧 | 💡 |
43
+ | :------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---- | :-- | :-- |
44
+ | [bin-name-casing](https://eslint-plugin-package-json.dev/rules/bin-name-casing) | Enforce that names for bin properties are in kebab case. | 🎨 | | 💡 |
45
+ | [exports-subpaths-style](https://eslint-plugin-package-json.dev/rules/exports-subpaths-style) | Enforce consistent format for the exports field (implicit or explicit subpaths). | 🎨 | 🔧 | |
46
+ | [no-empty-fields](https://eslint-plugin-package-json.dev/rules/no-empty-fields) | Reports on unnecessary empty arrays and objects. | ✅ 📦 | | 💡 |
47
+ | [no-redundant-files](https://eslint-plugin-package-json.dev/rules/no-redundant-files) | Prevents adding unnecessary / redundant files. | ✅ 📦 | | 💡 |
48
+ | [no-redundant-publishConfig](https://eslint-plugin-package-json.dev/rules/no-redundant-publishConfig) | Warns when publishConfig.access is used in unscoped packages. | ✅ 📦 | | 💡 |
49
+ | [order-properties](https://eslint-plugin-package-json.dev/rules/order-properties) | Package properties should be declared in standard order | 🎨 | 🔧 | |
50
+ | [repository-shorthand](https://eslint-plugin-package-json.dev/rules/repository-shorthand) | Enforce either object or shorthand declaration for repository. | ✅ 📦 | 🔧 | |
51
+ | [require-attribution](https://eslint-plugin-package-json.dev/rules/require-attribution) | Ensures that proper attribution is included, requiring that either `author` or `contributors` is defined, and that if `contributors` is present, it should include at least one contributor. | ✅ 📦 | | 💡 |
52
+ | [require-author](https://eslint-plugin-package-json.dev/rules/require-properties/require-author) | Requires the `author` property to be present. | | | |
53
+ | [require-bin](https://eslint-plugin-package-json.dev/rules/require-properties/require-bin) | Requires the `bin` property to be present. | | | |
54
+ | [require-browser](https://eslint-plugin-package-json.dev/rules/require-properties/require-browser) | Requires the `browser` property to be present. | | | |
55
+ | [require-bugs](https://eslint-plugin-package-json.dev/rules/require-properties/require-bugs) | Requires the `bugs` property to be present. | | | |
56
+ | [require-bundleDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-bundleDependencies) | Requires the `bundleDependencies` property to be present. | | | |
57
+ | [require-config](https://eslint-plugin-package-json.dev/rules/require-properties/require-config) | Requires the `config` property to be present. | | | |
58
+ | [require-contributors](https://eslint-plugin-package-json.dev/rules/require-properties/require-contributors) | Requires the `contributors` property to be present. | | | |
59
+ | [require-cpu](https://eslint-plugin-package-json.dev/rules/require-properties/require-cpu) | Requires the `cpu` property to be present. | | | |
60
+ | [require-dependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-dependencies) | Requires the `dependencies` property to be present. | | | |
61
+ | [require-description](https://eslint-plugin-package-json.dev/rules/require-properties/require-description) | Requires the `description` property to be present. | ✅ 📦 | | |
62
+ | [require-devDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-devDependencies) | Requires the `devDependencies` property to be present. | | | |
63
+ | [require-devEngines](https://eslint-plugin-package-json.dev/rules/require-properties/require-devEngines) | Requires the `devEngines` property to be present. | | | |
64
+ | [require-directories](https://eslint-plugin-package-json.dev/rules/require-properties/require-directories) | Requires the `directories` property to be present. | | | |
65
+ | [require-engines](https://eslint-plugin-package-json.dev/rules/require-properties/require-engines) | Requires the `engines` property to be present. | | | |
66
+ | [require-exports](https://eslint-plugin-package-json.dev/rules/require-properties/require-exports) | Requires the `exports` property to be present. | ✅ 📦 | | |
67
+ | [require-files](https://eslint-plugin-package-json.dev/rules/require-properties/require-files) | Requires the `files` property to be present. | ✅ 📦 | | |
68
+ | [require-funding](https://eslint-plugin-package-json.dev/rules/require-properties/require-funding) | Requires the `funding` property to be present. | | | |
69
+ | [require-gypfile](https://eslint-plugin-package-json.dev/rules/require-properties/require-gypfile) | Requires the `gypfile` property to be present. | | | |
70
+ | [require-homepage](https://eslint-plugin-package-json.dev/rules/require-properties/require-homepage) | Requires the `homepage` property to be present. | | | |
71
+ | [require-keywords](https://eslint-plugin-package-json.dev/rules/require-properties/require-keywords) | Requires the `keywords` property to be present. | | | |
72
+ | [require-libc](https://eslint-plugin-package-json.dev/rules/require-properties/require-libc) | Requires the `libc` property to be present. | | | |
73
+ | [require-license](https://eslint-plugin-package-json.dev/rules/require-properties/require-license) | Requires the `license` property to be present. | ✅ 📦 | | |
74
+ | [require-main](https://eslint-plugin-package-json.dev/rules/require-properties/require-main) | Requires the `main` property to be present. | | | |
75
+ | [require-man](https://eslint-plugin-package-json.dev/rules/require-properties/require-man) | Requires the `man` property to be present. | | | |
76
+ | [require-module](https://eslint-plugin-package-json.dev/rules/require-properties/require-module) | Requires the `module` property to be present. | | | |
77
+ | [require-name](https://eslint-plugin-package-json.dev/rules/require-properties/require-name) | Requires the `name` property to be present. | ✅ 📦 | | |
78
+ | [require-optionalDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-optionalDependencies) | Requires the `optionalDependencies` property to be present. | | | |
79
+ | [require-os](https://eslint-plugin-package-json.dev/rules/require-properties/require-os) | Requires the `os` property to be present. | | | |
80
+ | [require-packageManager](https://eslint-plugin-package-json.dev/rules/require-properties/require-packageManager) | Requires the `packageManager` property to be present. | | | |
81
+ | [require-peerDependencies](https://eslint-plugin-package-json.dev/rules/require-properties/require-peerDependencies) | Requires the `peerDependencies` property to be present. | | | |
82
+ | [require-private](https://eslint-plugin-package-json.dev/rules/require-properties/require-private) | Requires the `private` property to be present. | | 🔧 | |
83
+ | [require-publishConfig](https://eslint-plugin-package-json.dev/rules/require-properties/require-publishConfig) | Requires the `publishConfig` property to be present. | | | |
84
+ | [require-repository](https://eslint-plugin-package-json.dev/rules/require-properties/require-repository) | Requires the `repository` property to be present. | ✅ 📦 | | |
85
+ | [require-scripts](https://eslint-plugin-package-json.dev/rules/require-properties/require-scripts) | Requires the `scripts` property to be present. | | | |
86
+ | [require-sideEffects](https://eslint-plugin-package-json.dev/rules/require-properties/require-sideEffects) | Requires the `sideEffects` property to be present. | 📦 | | |
87
+ | [require-type](https://eslint-plugin-package-json.dev/rules/require-properties/require-type) | Requires the `type` property to be present. | 📦 | 🔧 | |
88
+ | [require-types](https://eslint-plugin-package-json.dev/rules/require-properties/require-types) | Requires the `types` property to be present. | | | |
89
+ | [require-version](https://eslint-plugin-package-json.dev/rules/require-properties/require-version) | Requires the `version` property to be present. | 📦 | | |
90
+ | [restrict-dependency-ranges](https://eslint-plugin-package-json.dev/rules/restrict-dependency-ranges) | Restricts the range of dependencies to allow or disallow specific types of ranges. | | | 💡 |
91
+ | [restrict-private-properties](https://eslint-plugin-package-json.dev/rules/restrict-private-properties) | Disallows unnecessary properties in private packages. | | 🔧 | 💡 |
92
+ | [restrict-top-level-properties](https://eslint-plugin-package-json.dev/rules/restrict-top-level-properties) | Disallows specified top-level properties in package.json. | | | 💡 |
93
+ | [scripts-name-casing](https://eslint-plugin-package-json.dev/rules/scripts-name-casing) | Enforce that names for `scripts` are in kebab case (optionally separated by colons). | 🎨 | | 💡 |
94
+ | [sort-collections](https://eslint-plugin-package-json.dev/rules/sort-collections) | Selected collections must be in a consistent order (lexicographical for most; lifecycle-aware for scripts). | ✅ 📦 | 🔧 | |
95
+ | [specify-peers-locally](https://eslint-plugin-package-json.dev/rules/specify-peers-locally) | Requires that all peer dependencies are also declared as dev dependencies | ✅ 📦 | | 💡 |
96
+ | [unique-dependencies](https://eslint-plugin-package-json.dev/rules/unique-dependencies) | Checks a dependency isn't specified more than once (i.e. in `dependencies` and `devDependencies`) | ✅ 📦 | | 💡 |
97
+ | [valid-author](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-author) | Enforce that the `author` property is valid. | ✅ 📦 | | |
98
+ | [valid-bin](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-bin) | Enforce that the `bin` property is valid. | ✅ 📦 | | |
99
+ | [valid-browser](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-browser) | Enforce that the `browser` property is valid. | ✅ 📦 | | |
100
+ | [valid-bugs](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-bugs) | Enforce that the `bugs` property is valid. | ✅ 📦 | | |
101
+ | [valid-bundleDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-bundleDependencies) | Enforce that the `bundleDependencies` (also `bundledDependencies`) property is valid. | ✅ 📦 | | |
102
+ | [valid-config](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-config) | Enforce that the `config` property is valid. | ✅ 📦 | | |
103
+ | [valid-contributors](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-contributors) | Enforce that the `contributors` property is valid. | ✅ 📦 | | |
104
+ | [valid-cpu](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-cpu) | Enforce that the `cpu` property is valid. | ✅ 📦 | | |
105
+ | [valid-dependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-dependencies) | Enforce that the `dependencies` property is valid. | ✅ 📦 | | |
106
+ | [valid-description](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-description) | Enforce that the `description` property is valid. | ✅ 📦 | | |
107
+ | [valid-devDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-devDependencies) | Enforce that the `devDependencies` property is valid. | ✅ 📦 | | |
108
+ | [valid-devEngines](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-devEngines) | Enforce that the `devEngines` property is valid. | ✅ 📦 | | |
109
+ | [valid-directories](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-directories) | Enforce that the `directories` property is valid. | ✅ 📦 | | |
110
+ | [valid-engines](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-engines) | Enforce that the `engines` property is valid. | ✅ 📦 | | |
111
+ | [valid-exports](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-exports) | Enforce that the `exports` property is valid. | ✅ 📦 | | |
112
+ | [valid-files](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-files) | Enforce that the `files` property is valid. | ✅ 📦 | | |
113
+ | [valid-funding](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-funding) | Enforce that the `funding` property is valid. | ✅ 📦 | | |
114
+ | [valid-gypfile](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-gypfile) | Enforce that the `gypfile` property is valid. | ✅ 📦 | | |
115
+ | [valid-homepage](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-homepage) | Enforce that the `homepage` property is valid. | ✅ 📦 | | |
116
+ | [valid-keywords](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-keywords) | Enforce that the `keywords` property is valid. | ✅ 📦 | | |
117
+ | [valid-libc](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-libc) | Enforce that the `libc` property is valid. | ✅ 📦 | | |
118
+ | [valid-license](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-license) | Enforce that the `license` property is valid. | ✅ 📦 | | |
119
+ | [valid-main](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-main) | Enforce that the `main` property is valid. | ✅ 📦 | | |
120
+ | [valid-man](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-man) | Enforce that the `man` property is valid. | ✅ 📦 | | |
121
+ | [valid-module](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-module) | Enforce that the `module` property is valid. | ✅ 📦 | | |
122
+ | [valid-name](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-name) | Enforce that the `name` property is valid. | ✅ 📦 | | |
123
+ | [valid-optionalDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-optionalDependencies) | Enforce that the `optionalDependencies` property is valid. | ✅ 📦 | | |
124
+ | [valid-os](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-os) | Enforce that the `os` property is valid. | ✅ 📦 | | |
125
+ | [valid-packageManager](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-packageManager) | Enforce that the `packageManager` property is valid. | ✅ 📦 | | |
126
+ | [valid-peerDependencies](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-peerDependencies) | Enforce that the `peerDependencies` property is valid. | ✅ 📦 | | |
127
+ | [valid-peerDependenciesMeta](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-peerDependenciesMeta) | Enforce that the `peerDependenciesMeta` property is valid. | ✅ 📦 | | |
128
+ | [valid-peerDependenciesMeta-relationship](https://eslint-plugin-package-json.dev/rules/valid-peerDependenciesMeta-relationship) | Enforces that any dependencies declared in `peerDependenciesMeta` are also defined in the package's `peerDependencies`. | ✅ 📦 | | 💡 |
129
+ | [valid-private](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-private) | Enforce that the `private` property is valid. | ✅ 📦 | | |
130
+ | [valid-publishConfig](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-publishConfig) | Enforce that the `publishConfig` property is valid. | ✅ 📦 | | |
131
+ | [valid-repository](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-repository) | Enforce that the `repository` property is valid. | ✅ 📦 | | |
132
+ | [valid-repository-directory](https://eslint-plugin-package-json.dev/rules/valid-repository-directory) | Enforce that if repository directory is specified, it matches the path to the package.json file | ✅ 📦 | | 💡 |
133
+ | [valid-scripts](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-scripts) | Enforce that the `scripts` property is valid. | ✅ 📦 | | |
134
+ | [valid-sideEffects](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-sideEffects) | Enforce that the `sideEffects` property is valid. | ✅ 📦 | | |
135
+ | [valid-type](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-type) | Enforce that the `type` property is valid. | ✅ 📦 | | |
136
+ | [valid-version](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-version) | Enforce that the `version` property is valid. | ✅ 📦 | | |
137
+ | [valid-workspaces](https://eslint-plugin-package-json.dev/rules/valid-properties/valid-workspaces) | Enforce that the `workspaces` property is valid. | ✅ 📦 | | |
124
138
 
125
139
  <!-- end auto-generated rules list -->
126
- <!-- prettier-ignore-end -->
127
140
 
128
141
  These rules only run on `package.json` files; they will ignore all other files being linted.
129
142
  They can lint `package.json` files at project root and in any subfolder of the project, making this plugin great for monorepos.
@@ -154,10 +167,8 @@ Thanks! 🗂
154
167
 
155
168
  ## Contributors
156
169
 
157
- <!-- spellchecker: disable -->
158
170
  <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
159
171
  <!-- prettier-ignore-start -->
160
- <!-- markdownlint-disable -->
161
172
  <table>
162
173
  <tbody>
163
174
  <tr>
@@ -217,12 +228,9 @@ Thanks! 🗂
217
228
  </tbody>
218
229
  </table>
219
230
 
220
- <!-- markdownlint-restore -->
221
231
  <!-- prettier-ignore-end -->
222
-
223
232
  <!-- ALL-CONTRIBUTORS-LIST:END -->
224
- <!-- spellchecker: enable -->
225
233
 
226
- ## Appreciation
234
+ ## License
227
235
 
228
- Many thanks to [@zetlen](https://github.com/zetlen) for creating the initial version and core infrastructure of this package! 💖
236
+ See the [LICENSE](./LICENSE.md) file for license rights and limitations (MIT).
@@ -38,7 +38,8 @@ interface PackageJsonRuleModule<Options extends unknown[] = unknown[], Schema ex
38
38
  meta: Omit<Rule.RuleMetaData, "defaultOptions" | "docs" | "schema"> & {
39
39
  defaultOptions?: NoInfer<Options>;
40
40
  docs?: Rule.RuleMetaData["docs"] & {
41
- category?: string;
41
+ category?: string; /** An optional route segment to group this rule under */
42
+ ruleGroup?: string;
42
43
  };
43
44
  schema?: Schema;
44
45
  };
@@ -5,6 +5,7 @@ import { isPackageJson } from "./utils/isPackageJson.mjs";
5
5
  * If you're not satisfied with the inferred type, you may specify it manually in the first type parameter.
6
6
  */
7
7
  function createRule(rule) {
8
+ const ruleGroup = rule.meta.docs?.ruleGroup;
8
9
  return {
9
10
  create(context) {
10
11
  if (!isPackageJson(context.filename)) return {};
@@ -14,7 +15,7 @@ function createRule(rule) {
14
15
  ...rule.meta,
15
16
  docs: {
16
17
  ...rule.meta.docs,
17
- url: `https://github.com/michaelfaith/eslint-plugin-package-json/blob/HEAD/docs/rules/${rule.name}.md`
18
+ url: `https://eslint-plugin-package-json.dev/rules/${ruleGroup ? `${ruleGroup}/` : ""}${rule.name}`
18
19
  }
19
20
  }
20
21
  };
package/lib/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { JSONSchema } from "./node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/definitions/jsonSchema.mjs";
2
2
  import { PackageJsonPluginSettings, PackageJsonRuleModule } from "./createRule.mjs";
3
3
  import { plugin } from "./plugin.mjs";
4
- import * as jsonc_eslint_parser0 from "jsonc-eslint-parser";
5
- import * as eslint from "eslint";
4
+ import * as _$jsonc_eslint_parser0 from "jsonc-eslint-parser";
5
+ import * as _$eslint from "eslint";
6
6
 
7
7
  //#region src/index.d.ts
8
8
  declare const rules: Record<string, PackageJsonRuleModule<unknown[], JSONSchema[]>>;
@@ -10,11 +10,11 @@ declare const configs: {
10
10
  recommended: {
11
11
  files: string[];
12
12
  languageOptions: {
13
- parser: typeof jsonc_eslint_parser0;
13
+ parser: typeof _$jsonc_eslint_parser0;
14
14
  };
15
15
  name: string;
16
16
  plugins: {
17
- readonly "package-json": eslint.ESLint.Plugin;
17
+ readonly "package-json": _$eslint.ESLint.Plugin;
18
18
  };
19
19
  rules: {
20
20
  [k: string]: "error";
@@ -23,11 +23,11 @@ declare const configs: {
23
23
  "recommended-publishable": {
24
24
  files: string[];
25
25
  languageOptions: {
26
- parser: typeof jsonc_eslint_parser0;
26
+ parser: typeof _$jsonc_eslint_parser0;
27
27
  };
28
28
  name: string;
29
29
  plugins: {
30
- readonly "package-json": eslint.ESLint.Plugin;
30
+ readonly "package-json": _$eslint.ESLint.Plugin;
31
31
  };
32
32
  rules: {
33
33
  [x: string]: "error";
@@ -36,11 +36,11 @@ declare const configs: {
36
36
  stylistic: {
37
37
  files: string[];
38
38
  languageOptions: {
39
- parser: typeof jsonc_eslint_parser0;
39
+ parser: typeof _$jsonc_eslint_parser0;
40
40
  };
41
41
  name: string;
42
42
  plugins: {
43
- readonly "package-json": eslint.ESLint.Plugin;
43
+ readonly "package-json": _$eslint.ESLint.Plugin;
44
44
  };
45
45
  rules: {
46
46
  [k: string]: "error";
package/lib/plugin.mjs CHANGED
@@ -14,10 +14,9 @@ import { rule as rule$11 } from "./rules/scripts-name-casing.mjs";
14
14
  import { rule as rule$12 } from "./rules/sort-collections.mjs";
15
15
  import { rule as rule$13 } from "./rules/specify-peers-locally.mjs";
16
16
  import { rule as rule$14 } from "./rules/unique-dependencies.mjs";
17
- import { rule as rule$15 } from "./rules/valid-name.mjs";
17
+ import { rule as rule$15 } from "./rules/valid-peerDependenciesMeta-relationship.mjs";
18
18
  import { rules as rules$2 } from "./rules/valid-properties.mjs";
19
19
  import { rule as rule$16 } from "./rules/valid-repository-directory.mjs";
20
- import { rule as rule$17 } from "./rules/valid-version.mjs";
21
20
  import { createRequire } from "node:module";
22
21
  import * as parserJsonc from "jsonc-eslint-parser";
23
22
  //#region src/plugin.ts
@@ -40,9 +39,8 @@ const rules = {
40
39
  "specify-peers-locally": rule$13,
41
40
  "unique-dependencies": rule$14,
42
41
  ...rules$2,
43
- "valid-name": rule$15,
44
- "valid-repository-directory": rule$16,
45
- "valid-version": rule$17
42
+ "valid-peerDependenciesMeta-relationship": rule$15,
43
+ "valid-repository-directory": rule$16
46
44
  };
47
45
  const recommendedRules = { ...Object.fromEntries(Object.entries(rules).filter(([, rule]) => rule.meta.docs?.recommended).map(([name]) => ["package-json/" + name, "error"])) };
48
46
  const recommendedPublishableRules = {
@@ -23,7 +23,7 @@ const rule = createRule({
23
23
  "Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.value=private]"(node) {
24
24
  if (node.value.type === "JSONLiteral" && node.value.value === true) isPrivatePackage = true;
25
25
  },
26
- "Program:exit"(node) {
26
+ "Program:exit"() {
27
27
  if (ignorePrivate && isPrivatePackage) return;
28
28
  if (preferContributorsOnly) {
29
29
  if (authorPropertyNode) context.report({
@@ -35,12 +35,18 @@ const rule = createRule({
35
35
  }]
36
36
  });
37
37
  if (!contributorsPropertyNode) context.report({
38
- messageId: "missingContributor",
39
- node
38
+ loc: {
39
+ column: 0,
40
+ line: 1
41
+ },
42
+ messageId: "missingContributor"
40
43
  });
41
44
  } else if (!authorPropertyNode && !contributorsPropertyNode) context.report({
42
- messageId: "missing",
43
- node
45
+ loc: {
46
+ column: 0,
47
+ line: 1
48
+ },
49
+ messageId: "missing"
44
50
  });
45
51
  }
46
52
  };
@@ -3,8 +3,10 @@ import { createSimpleRequirePropertyRule } from "../utils/createSimpleRequirePro
3
3
  const propertyConfig = [
4
4
  ["author"],
5
5
  ["bin"],
6
+ ["browser"],
6
7
  ["bugs", { ignorePrivateDefault: true }],
7
8
  ["bundleDependencies"],
9
+ ["config"],
8
10
  ["contributors"],
9
11
  ["cpu"],
10
12
  ["dependencies"],
@@ -22,8 +24,10 @@ const propertyConfig = [
22
24
  isRecommended: true
23
25
  }],
24
26
  ["funding"],
27
+ ["gypfile"],
25
28
  ["homepage", { ignorePrivateDefault: true }],
26
29
  ["keywords", { ignorePrivateDefault: true }],
30
+ ["libc"],
27
31
  ["license", {
28
32
  ignorePrivateDefault: true,
29
33
  isRecommended: true
@@ -1,6 +1,6 @@
1
1
  import { PackageJsonRuleModule } from "../createRule.mjs";
2
2
 
3
- //#region src/rules/valid-name.d.ts
3
+ //#region src/rules/valid-peerDependenciesMeta-relationship.d.ts
4
4
  declare const rule: PackageJsonRuleModule<[], []>;
5
5
  //#endregion
6
6
  export { rule };
@@ -0,0 +1,50 @@
1
+ import { createRule } from "../createRule.mjs";
2
+ import { isJSONStringLiteral } from "../utils/predicates.mjs";
3
+ import { fixRemoveObjectProperty } from "eslint-fix-utils";
4
+ //#region src/rules/valid-peerDependenciesMeta-relationship.ts
5
+ const rule = createRule({
6
+ create(context) {
7
+ const peerDependencies = /* @__PURE__ */ new Set();
8
+ const peerDependenciesMeta = /* @__PURE__ */ new Map();
9
+ return {
10
+ "Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.value=peerDependencies]"(node) {
11
+ if (node.value.type === "JSONObjectExpression") {
12
+ for (const property of node.value.properties) if (isJSONStringLiteral(property.key)) peerDependencies.add(property.key.value);
13
+ }
14
+ },
15
+ "Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.value=peerDependenciesMeta]"(node) {
16
+ if (node.value.type === "JSONObjectExpression") {
17
+ for (const property of node.value.properties) if (isJSONStringLiteral(property.key)) peerDependenciesMeta.set(property.key.value, property);
18
+ }
19
+ },
20
+ "Program:exit"() {
21
+ for (const [dependencyName, propertyNode] of peerDependenciesMeta) if (!peerDependencies.has(dependencyName)) context.report({
22
+ data: { dependencyName },
23
+ messageId: "unnecessaryPeerDependency",
24
+ node: propertyNode,
25
+ suggest: [{
26
+ fix: fixRemoveObjectProperty(context, propertyNode),
27
+ messageId: "removePeerDependencyMeta"
28
+ }]
29
+ });
30
+ }
31
+ };
32
+ },
33
+ meta: {
34
+ docs: {
35
+ category: "Best Practices",
36
+ description: "Enforces that any dependencies declared in `peerDependenciesMeta` are also defined in the package's `peerDependencies`.",
37
+ recommended: true
38
+ },
39
+ hasSuggestions: true,
40
+ messages: {
41
+ removePeerDependencyMeta: "Remove from `peerDependenciesMeta`.",
42
+ unnecessaryPeerDependency: "Dependency '{{ dependencyName }}' is declared in `peerDependenciesMeta` but not in `peerDependencies`."
43
+ },
44
+ schema: [],
45
+ type: "problem"
46
+ },
47
+ name: "valid-peerDependenciesMeta-relationship"
48
+ });
49
+ //#endregion
50
+ export { rule };
@@ -1,9 +1,10 @@
1
1
  import { createSimpleValidPropertyRule } from "../utils/createSimpleValidPropertyRule.mjs";
2
- import { validateAuthor, validateBin, validateBugs, validateBundleDependencies, validateConfig, validateContributors, validateCpu, validateDependencies, validateDescription, validateDevEngines, validateDirectories, validateEngines, validateExports, validateFiles, validateFunding, validateHomepage, validateKeywords, validateLicense, validateMain, validateMan, validateOs, validatePackageManager, validatePrivate, validatePublishConfig, validateRepository, validateScripts, validateSideEffects, validateType, validateWorkspaces } from "package-json-validator";
3
- //#region src/rules/valid-properties.ts
4
- const properties = [
2
+ import { validateAuthor, validateBin, validateBrowser, validateBugs, validateBundleDependencies, validateConfig, validateContributors, validateCpu, validateDependencies, validateDescription, validateDevEngines, validateDirectories, validateEngines, validateExports, validateFiles, validateFunding, validateGypfile, validateHomepage, validateKeywords, validateLibc, validateLicense, validateMain, validateMan, validateName, validateOs, validatePackageManager, validatePeerDependenciesMeta, validatePrivate, validatePublishConfig, validateRepository, validateScripts, validateSideEffects, validateType, validateVersion, validateWorkspaces } from "package-json-validator";
3
+ /** All basic valid- flavor rules */
4
+ const rules = Object.fromEntries([
5
5
  ["author", validateAuthor],
6
6
  ["bin", validateBin],
7
+ ["browser", validateBrowser],
7
8
  ["bugs", validateBugs],
8
9
  ["bundleDependencies", {
9
10
  aliases: ["bundledDependencies"],
@@ -21,26 +22,29 @@ const properties = [
21
22
  ["exports", validateExports],
22
23
  ["files", validateFiles],
23
24
  ["funding", validateFunding],
25
+ ["gypfile", validateGypfile],
24
26
  ["homepage", validateHomepage],
25
27
  ["keywords", validateKeywords],
28
+ ["libc", validateLibc],
26
29
  ["license", validateLicense],
27
30
  ["main", validateMain],
28
31
  ["man", validateMan],
29
32
  ["module", validateMain],
33
+ ["name", validateName],
30
34
  ["optionalDependencies", validateDependencies],
31
35
  ["os", validateOs],
32
36
  ["packageManager", validatePackageManager],
33
37
  ["peerDependencies", validateDependencies],
38
+ ["peerDependenciesMeta", validatePeerDependenciesMeta],
34
39
  ["private", validatePrivate],
35
40
  ["publishConfig", validatePublishConfig],
36
41
  ["repository", validateRepository],
37
42
  ["scripts", validateScripts],
38
43
  ["sideEffects", validateSideEffects],
39
44
  ["type", validateType],
45
+ ["version", validateVersion],
40
46
  ["workspaces", validateWorkspaces]
41
- ];
42
- /** All basic valid- flavor rules */
43
- const rules = Object.fromEntries(properties.map(([propertyName, validationFunctionOrOptions]) => {
47
+ ].map(([propertyName, validationFunctionOrOptions]) => {
44
48
  let validationFunction;
45
49
  let aliases = [];
46
50
  if (typeof validationFunctionOrOptions === "object") {
@@ -22,8 +22,11 @@ const createSimpleRequirePropertyRule = (propertyName, { category, fixValue, ign
22
22
  yield fixer.insertTextAfterRange([0, 1], `\n "${propertyName}": ${JSON.stringify(fixValue)}`);
23
23
  yield node.properties.length > 0 ? fixer.insertTextAfterRange([0, 1], ",") : fixer.insertTextAfterRange([0, 1], "\n");
24
24
  },
25
- messageId: "missing",
26
- node: context.sourceCode.ast
25
+ loc: {
26
+ column: 0,
27
+ line: 1
28
+ },
29
+ messageId: "missing"
27
30
  });
28
31
  } };
29
32
  },
@@ -31,7 +34,8 @@ const createSimpleRequirePropertyRule = (propertyName, { category, fixValue, ign
31
34
  docs: {
32
35
  category,
33
36
  description: `Requires the \`${propertyName}\` property to be present.`,
34
- recommended: isRecommended
37
+ recommended: isRecommended,
38
+ ruleGroup: "require-properties"
35
39
  },
36
40
  fixable: fixValue === void 0 ? void 0 : "code",
37
41
  messages: { missing: "Property '{{property}}' is required." },
@@ -40,8 +40,9 @@ const createSimpleValidPropertyRule = (propertyName, validationFunction, aliases
40
40
  meta: {
41
41
  docs: {
42
42
  category: "Best Practices",
43
- description: `Enforce that the \`${propertyName}\`${aliases.length ? ` (also: ${aliases.map((alias) => `\`${alias}\``).join(", ")})` : ""} property is valid.`,
44
- recommended: true
43
+ description: `Enforce that the \`${propertyName}\`${aliases.length ? ` (also ${aliases.map((alias) => `\`${alias}\``).join(", ")})` : ""} property is valid.`,
44
+ recommended: true,
45
+ ruleGroup: "valid-properties"
45
46
  },
46
47
  messages: { validationError: `Invalid ${propertyName}: {{ error }}` },
47
48
  schema: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-package-json",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0",
4
4
  "description": "Rules for consistent, readable, and valid package.json files. 🗂️",
5
5
  "homepage": "https://github.com/michaelfaith/eslint-plugin-package-json#readme",
6
6
  "bugs": {
@@ -40,9 +40,6 @@
40
40
  "CHANGELOG.md",
41
41
  "lib/"
42
42
  ],
43
- "lint-staged": {
44
- "*": "prettier --ignore-unknown --write"
45
- },
46
43
  "dependencies": {
47
44
  "@altano/repository-tools": "^2.0.1",
48
45
  "change-case": "^5.4.4",
@@ -50,14 +47,13 @@
50
47
  "detect-newline": "^4.0.1",
51
48
  "eslint-fix-utils": "~0.4.1",
52
49
  "jsonc-eslint-parser": "^3.1.0",
53
- "package-json-validator": "^1.4.1",
50
+ "package-json-validator": "^1.5.0",
54
51
  "semver": "^7.7.3",
55
52
  "sort-object-keys": "^2.0.0",
56
- "sort-package-json": "^3.4.0",
57
- "validate-npm-package-name": "^7.0.0"
53
+ "sort-package-json": "^3.4.0"
58
54
  },
59
55
  "devDependencies": {
60
- "@astrojs/starlight": "0.38.3",
56
+ "@astrojs/starlight": "0.39.0",
61
57
  "@catppuccin/starlight": "2.0.1",
62
58
  "@eslint-community/eslint-plugin-eslint-comments": "4.7.0",
63
59
  "@eslint/js": "10.0.1",
@@ -65,34 +61,37 @@
65
61
  "@types/estree": "1.0.8",
66
62
  "@types/node": "24.12.0",
67
63
  "@types/semver": "7.7.1",
68
- "@types/validate-npm-package-name": "4.0.2",
69
64
  "@vitest/coverage-v8": "4.1.0",
70
65
  "@vitest/eslint-plugin": "1.6.1",
71
- "astro": "6.1.8",
66
+ "astro": "6.3.0",
67
+ "astro-og-canvas": "0.11.1",
68
+ "canvaskit-wasm": "0.41.1",
72
69
  "console-fail-test": "0.6.0",
73
- "eslint": "10.2.0",
70
+ "eslint": "10.3.0",
74
71
  "eslint-doc-generator": "3.3.1",
75
72
  "eslint-plugin-eslint-plugin": "7.3.1",
76
73
  "eslint-plugin-jsdoc": "62.9.0",
77
74
  "eslint-plugin-jsonc": "3.1.0",
78
- "eslint-plugin-n": "17.24.0",
75
+ "eslint-plugin-n": "18.0.0",
79
76
  "eslint-plugin-node-dependencies": "2.2.0",
80
77
  "eslint-plugin-perfectionist": "5.9.0",
81
78
  "eslint-plugin-regexp": "3.1.0",
82
79
  "eslint-plugin-unicorn": "64.0.0",
83
80
  "eslint-plugin-yml": "3.3.0",
84
81
  "husky": "9.1.7",
85
- "jiti": "2.6.1",
82
+ "jiti": "2.7.0",
86
83
  "json-schema-to-ts": "3.1.1",
87
- "knip": "6.6.0",
88
- "lint-staged": "16.4.0",
84
+ "knip": "6.13.0",
85
+ "lint-staged": "17.0.2",
89
86
  "prettier": "3.8.0",
90
87
  "prettier-plugin-curly": "0.4.0",
91
88
  "prettier-plugin-packagejson": "3.0.0",
92
89
  "prettier-plugin-sentences-per-line": "0.2.3",
93
90
  "prettier-plugin-sh": "0.18.0",
91
+ "pretty-quick": "4.2.2",
94
92
  "sharp": "0.34.5",
95
- "tsdown": "0.21.0",
93
+ "starlight-auto-sidebar": "0.4.0",
94
+ "tsdown": "0.22.0",
96
95
  "typescript": "6.0.2",
97
96
  "typescript-eslint": "8.59.0",
98
97
  "vitest": "4.1.0"
@@ -101,7 +100,7 @@
101
100
  "eslint": ">=9.0.0"
102
101
  },
103
102
  "engines": {
104
- "node": "^22.13.0 || >=24"
103
+ "node": "^22.22.2 || >=24.15.0"
105
104
  },
106
105
  "scripts": {
107
106
  "build": "tsdown",
@@ -1,42 +0,0 @@
1
- import { createRule } from "../createRule.mjs";
2
- import validate from "validate-npm-package-name";
3
- //#region src/rules/valid-name.ts
4
- const rule = createRule({
5
- create(context) {
6
- return { "Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.value=name]"(node) {
7
- if (node.value.type !== "JSONLiteral" || typeof node.value.value !== "string") {
8
- context.report({
9
- messageId: "type",
10
- node: node.value
11
- });
12
- return;
13
- }
14
- const privateField = node.parent.properties.find((p) => p.key.type === "JSONLiteral" && p.key.value === "private");
15
- if (privateField?.value.type === "JSONLiteral" && (privateField.value.value === true || privateField.value.value === "true")) return;
16
- const { errors, warnings } = validate(node.value.value);
17
- const complaints = [...errors ?? [], ...warnings ?? []];
18
- if (!complaints.length) return;
19
- context.report({
20
- data: { complaints: complaints.map((error) => error.slice(0, Math.max(0, error.length))).join("; ") },
21
- messageId: "invalid",
22
- node: node.value
23
- });
24
- } };
25
- },
26
- meta: {
27
- docs: {
28
- category: "Best Practices",
29
- description: "Enforce that package names are valid npm package names",
30
- recommended: true
31
- },
32
- messages: {
33
- invalid: "Invalid npm package name: {{ complaints }}.",
34
- type: "\"name\" should be a string."
35
- },
36
- schema: [],
37
- type: "problem"
38
- },
39
- name: "valid-name"
40
- });
41
- //#endregion
42
- export { rule };
@@ -1,6 +0,0 @@
1
- import { PackageJsonRuleModule } from "../createRule.mjs";
2
-
3
- //#region src/rules/valid-version.d.ts
4
- declare const rule: PackageJsonRuleModule<[], []>;
5
- //#endregion
6
- export { rule };
@@ -1,36 +0,0 @@
1
- import { createRule } from "../createRule.mjs";
2
- import semver from "semver";
3
- //#region src/rules/valid-version.ts
4
- const rule = createRule({
5
- create(context) {
6
- return { "Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.value=version]"(node) {
7
- if (node.value.type !== "JSONLiteral" || typeof node.value.value !== "string") {
8
- context.report({
9
- messageId: "type",
10
- node: node.value
11
- });
12
- return;
13
- }
14
- if (!semver.valid(node.value.value)) context.report({
15
- messageId: "invalid",
16
- node: node.value
17
- });
18
- } };
19
- },
20
- meta: {
21
- docs: {
22
- category: "Best Practices",
23
- description: "Enforce that package versions are valid semver specifiers",
24
- recommended: true
25
- },
26
- messages: {
27
- invalid: "Version is not a valid semver specifier.",
28
- type: "\"version\" should be a string."
29
- },
30
- schema: [],
31
- type: "problem"
32
- },
33
- name: "valid-version"
34
- });
35
- //#endregion
36
- export { rule };