eslint-plugin-package-json 0.44.0 β 0.45.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 +14 -2
- package/README.md +8 -4
- package/lib/plugin.js +2 -0
- package/lib/rules/valid-license.d.ts +11 -0
- package/lib/rules/valid-license.js +40 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
# [0.
|
|
3
|
+
# [0.45.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.44.1...v0.45.0) (2025-07-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **valid-license:** add new rule for validating `license` ([#1174](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1174)) ([df450a1](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/df450a121067793af25890eb15e4120911a8cfa7)), closes [#830](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/830)
|
|
4
9
|
|
|
10
|
+
## [0.44.1](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.44.0...v0.44.1) (2025-07-10)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **deps:** update dependency package-json-validator to ~0.20.0 ([#1170](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1170)) ([941cf73](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/941cf734557db103da915d36de5adc18083a22a1))
|
|
15
|
+
|
|
16
|
+
# [0.44.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.43.4...v0.44.0) (2025-07-09)
|
|
5
17
|
|
|
6
18
|
### Features
|
|
7
19
|
|
|
8
|
-
|
|
20
|
+
- **valid-bundleDependencies:** add new rule for validating `bundleDependencies` ([#1148](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1148)) ([ee44973](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/ee449730ece778037a4d1ea7aa2d2ec83081a1cb)), closes [#819](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/819)
|
|
9
21
|
|
|
10
22
|
## [0.43.4](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.43.3...v0.43.4) (2025-07-09)
|
|
11
23
|
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<p align="center">
|
|
9
9
|
<!-- prettier-ignore-start -->
|
|
10
10
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
11
|
-
<a href="#contributors" target="_blank"><img alt="πͺ All Contributors:
|
|
11
|
+
<a href="#contributors" target="_blank"><img alt="πͺ All Contributors: 29" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-29-21bb42.svg" /></a>
|
|
12
12
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
13
13
|
<!-- prettier-ignore-end -->
|
|
14
14
|
<a href="https://github.com/JoshuaKGoldberg/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>
|
|
@@ -140,6 +140,7 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
|
|
|
140
140
|
| [valid-author](docs/rules/valid-author.md) | Enforce that the author field is a valid npm author specification | βοΈ β
| | | |
|
|
141
141
|
| [valid-bin](docs/rules/valid-bin.md) | Enforce that the `bin` property is valid. | βοΈ β
| | π‘ | |
|
|
142
142
|
| [valid-bundleDependencies](docs/rules/valid-bundleDependencies.md) | Enforce that the `bundleDependencies` (or `bundledDependencies`) property is valid. | βοΈ β
| | | |
|
|
143
|
+
| [valid-license](docs/rules/valid-license.md) | Enforce that the `license` property is valid. | βοΈ β
| | | |
|
|
143
144
|
| [valid-local-dependency](docs/rules/valid-local-dependency.md) | Checks existence of local dependencies in the package.json | | | | β |
|
|
144
145
|
| [valid-name](docs/rules/valid-name.md) | Enforce that package names are valid npm package names | βοΈ β
| | | |
|
|
145
146
|
| [valid-package-definition](docs/rules/valid-package-definition.md) | Enforce that package.json has all properties required by the npm spec | βοΈ β
| | | |
|
|
@@ -192,34 +193,37 @@ Thanks! π
|
|
|
192
193
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/andreww2012"><img src="https://avatars.githubusercontent.com/u/6554045?v=4?s=100" width="100px;" alt="Andrew Kazakov"/><br /><sub><b>Andrew Kazakov</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Aandreww2012" title="Bug reports">π</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=andreww2012" title="Code">π»</a> <a href="#ideas-andreww2012" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
193
194
|
<td align="center" valign="top" width="14.28%"><a href="http://technotes.khitrenovich.com/"><img src="https://avatars.githubusercontent.com/u/3424762?v=4?s=100" width="100px;" alt="Anton Khitrenovich"/><br /><sub><b>Anton Khitrenovich</b></sub></a><br /><a href="#ideas-khitrenovich" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
194
195
|
<td align="center" valign="top" width="14.28%"><a href="https://azat.io"><img src="https://avatars.githubusercontent.com/u/5698350?v=4?s=100" width="100px;" alt="Azat S."/><br /><sub><b>Azat S.</b></sub></a><br /><a href="#ideas-azat-io" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=azat-io" title="Code">π»</a></td>
|
|
196
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/anomiex"><img src="https://avatars.githubusercontent.com/u/1030580?v=4?s=100" width="100px;" alt="Brad Jorsch"/><br /><sub><b>Brad Jorsch</b></sub></a><br /><a href="#ideas-anomiex" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
195
197
|
<td align="center" valign="top" width="14.28%"><a href="http://www.curtisjewell.dev/"><img src="https://avatars.githubusercontent.com/u/67483?v=4?s=100" width="100px;" alt="Curtis Jewell"/><br /><sub><b>Curtis Jewell</b></sub></a><br /><a href="#ideas-csjewell" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
196
|
-
<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>
|
|
197
198
|
</tr>
|
|
198
199
|
<tr>
|
|
200
|
+
<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>
|
|
199
201
|
<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></td>
|
|
200
202
|
<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>
|
|
201
203
|
<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></td>
|
|
202
204
|
<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>
|
|
203
205
|
<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>
|
|
204
206
|
<td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com/"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg β¨"/><br /><sub><b>Josh Goldberg β¨</b></sub></a><br /><a href="#tool-JoshuaKGoldberg" title="Tools">π§</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3AJoshuaKGoldberg" title="Bug reports">π</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=JoshuaKGoldberg" title="Code">π»</a> <a href="#infra-JoshuaKGoldberg" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=JoshuaKGoldberg" title="Documentation">π</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">π§</a> <a href="#ideas-JoshuaKGoldberg" title="Ideas, Planning, & Feedback">π€</a> <a href="#content-JoshuaKGoldberg" title="Content">π</a> <a href="#projectManagement-JoshuaKGoldberg" title="Project Management">π</a></td>
|
|
205
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kendallgassner"><img src="https://avatars.githubusercontent.com/u/15275462?v=4?s=100" width="100px;" alt="Kendall Gassner"/><br /><sub><b>Kendall Gassner</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=kendallgassner" title="Code">π»</a> <a href="#maintenance-kendallgassner" title="Maintenance">π§</a></td>
|
|
206
207
|
</tr>
|
|
207
208
|
<tr>
|
|
209
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kendallgassner"><img src="https://avatars.githubusercontent.com/u/15275462?v=4?s=100" width="100px;" alt="Kendall Gassner"/><br /><sub><b>Kendall Gassner</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=kendallgassner" title="Code">π»</a> <a href="#maintenance-kendallgassner" title="Maintenance">π§</a></td>
|
|
208
210
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/KristjanESPERANTO"><img src="https://avatars.githubusercontent.com/u/35647502?v=4?s=100" width="100px;" alt="Kristjan ESPERANTO"/><br /><sub><b>Kristjan ESPERANTO</b></sub></a><br /><a href="#ideas-kristjanesperanto" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Akristjanesperanto" title="Bug reports">π</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=kristjanesperanto" title="Code">π»</a></td>
|
|
209
211
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lo1tuma"><img src="https://avatars.githubusercontent.com/u/169170?v=4?s=100" width="100px;" alt="Mathias Schreck"/><br /><sub><b>Mathias Schreck</b></sub></a><br /><a href="#ideas-lo1tuma" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
210
212
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Cellule"><img src="https://avatars.githubusercontent.com/u/4157103?v=4?s=100" width="100px;" alt="Michael "Mike" Ferris"/><br /><sub><b>Michael "Mike" Ferris</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=cellule" title="Code">π»</a></td>
|
|
211
213
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/nschonni"><img src="https://avatars.githubusercontent.com/u/1297909?v=4?s=100" width="100px;" alt="Nick Schonning"/><br /><sub><b>Nick Schonning</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=nschonni" title="Code">π»</a></td>
|
|
212
214
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rakleed"><img src="https://avatars.githubusercontent.com/u/19418601?v=4?s=100" width="100px;" alt="Pavel"/><br /><sub><b>Pavel</b></sub></a><br /><a href="#ideas-rakleed" title="Ideas, Planning, & Feedback">π€</a> <a href="#tool-rakleed" title="Tools">π§</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=rakleed" title="Documentation">π</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=rakleed" title="Code">π»</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Arakleed" title="Bug reports">π</a></td>
|
|
213
215
|
<td align="center" valign="top" width="14.28%"><a href="https://sasial.dev"><img src="https://avatars.githubusercontent.com/u/44125644?v=4?s=100" width="100px;" alt="Sasial"/><br /><sub><b>Sasial</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=sasial-dev" title="Code">π»</a></td>
|
|
214
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sirugh"><img src="https://avatars.githubusercontent.com/u/1278869?v=4?s=100" width="100px;" alt="Stephen"/><br /><sub><b>Stephen</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=sirugh" title="Code">π»</a></td>
|
|
215
216
|
</tr>
|
|
216
217
|
<tr>
|
|
218
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sirugh"><img src="https://avatars.githubusercontent.com/u/1278869?v=4?s=100" width="100px;" alt="Stephen"/><br /><sub><b>Stephen</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=sirugh" title="Code">π»</a></td>
|
|
217
219
|
<td align="center" valign="top" width="14.28%"><a href="https://hyoban.cc"><img src="https://avatars.githubusercontent.com/u/38493346?v=4?s=100" width="100px;" alt="Stephen Zhou"/><br /><sub><b>Stephen Zhou</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Ahyoban" title="Bug reports">π</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=hyoban" title="Code">π»</a> <a href="#ideas-hyoban" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=hyoban" title="Documentation">π</a></td>
|
|
218
220
|
<td align="center" valign="top" width="14.28%"><a href="https://ota-meshi.github.io/"><img src="https://avatars.githubusercontent.com/u/16508807?v=4?s=100" width="100px;" alt="Yosuke Ota"/><br /><sub><b>Yosuke Ota</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Aota-meshi" title="Bug reports">π</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=ota-meshi" title="Code">π»</a></td>
|
|
219
221
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/b3rnhard"><img src="https://avatars.githubusercontent.com/u/10774404?v=4?s=100" width="100px;" alt="b3rnhard"/><br /><sub><b>b3rnhard</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Ab3rnhard" title="Bug reports">π</a></td>
|
|
220
222
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/chouchouji"><img src="https://avatars.githubusercontent.com/u/70570907?v=4?s=100" width="100px;" alt="chouchouji"/><br /><sub><b>chouchouji</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=chouchouji" title="Code">π»</a></td>
|
|
221
223
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/michaelfaith"><img src="https://avatars.githubusercontent.com/u/8071845?v=4?s=100" width="100px;" alt="michael faith"/><br /><sub><b>michael faith</b></sub></a><br /><a href="#infra-michaelfaith" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=michaelfaith" title="Code">π»</a> <a href="#maintenance-michaelfaith" title="Maintenance">π§</a> <a href="#ideas-michaelfaith" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Amichaelfaith" title="Bug reports">π</a> <a href="#tool-michaelfaith" title="Tools">π§</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=michaelfaith" title="Documentation">π</a></td>
|
|
222
224
|
<td align="center" valign="top" width="14.28%"><a href="https://roottool.vercel.app"><img src="https://avatars.githubusercontent.com/u/11808736?v=4?s=100" width="100px;" alt="roottool"/><br /><sub><b>roottool</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=roottool" title="Code">π»</a></td>
|
|
225
|
+
</tr>
|
|
226
|
+
<tr>
|
|
223
227
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sunnytsang1998"><img src="https://avatars.githubusercontent.com/u/207208443?v=4?s=100" width="100px;" alt="sunnytsang1998"/><br /><sub><b>sunnytsang1998</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Asunnytsang1998" title="Bug reports">π</a></td>
|
|
224
228
|
</tr>
|
|
225
229
|
</tbody>
|
package/lib/plugin.js
CHANGED
|
@@ -11,6 +11,7 @@ import { rule as uniqueDependencies } from "./rules/unique-dependencies.js";
|
|
|
11
11
|
import { rule as validAuthor } from "./rules/valid-author.js";
|
|
12
12
|
import { rule as validBin } from "./rules/valid-bin.js";
|
|
13
13
|
import { rule as validBundleDependencies } from "./rules/valid-bundleDependencies.js";
|
|
14
|
+
import { rule as validLicense } from "./rules/valid-license.js";
|
|
14
15
|
import { rule as validLocalDependency } from "./rules/valid-local-dependency.js";
|
|
15
16
|
import { rule as validName } from "./rules/valid-name.js";
|
|
16
17
|
import { rule as validPackageDefinition } from "./rules/valid-package-definition.js";
|
|
@@ -32,6 +33,7 @@ const rules = {
|
|
|
32
33
|
"valid-author": validAuthor,
|
|
33
34
|
"valid-bin": validBin,
|
|
34
35
|
"valid-bundleDependencies": validBundleDependencies,
|
|
36
|
+
"valid-license": validLicense,
|
|
35
37
|
"valid-local-dependency": validLocalDependency,
|
|
36
38
|
"valid-name": validName,
|
|
37
39
|
"valid-package-definition": validPackageDefinition,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as eslint from 'eslint';
|
|
2
|
+
import * as jsonc_eslint_parser from 'jsonc-eslint-parser';
|
|
3
|
+
import { PackageJsonRuleContext } from '../createRule.js';
|
|
4
|
+
import 'estree';
|
|
5
|
+
|
|
6
|
+
declare const rule: {
|
|
7
|
+
create(context: PackageJsonRuleContext<unknown[]>): jsonc_eslint_parser.RuleListener;
|
|
8
|
+
meta: eslint.Rule.RuleMetaData;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { rule };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { validateLicense } from "package-json-validator";
|
|
2
|
+
import { createRule } from "../createRule.js";
|
|
3
|
+
import { formatErrors } from "../utils/formatErrors.js";
|
|
4
|
+
const rule = createRule({
|
|
5
|
+
create(context) {
|
|
6
|
+
return {
|
|
7
|
+
"Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.value=license]"(node) {
|
|
8
|
+
const valueNode = node.value;
|
|
9
|
+
const value = JSON.parse(
|
|
10
|
+
context.sourceCode.getText(valueNode)
|
|
11
|
+
);
|
|
12
|
+
const errors = validateLicense(value);
|
|
13
|
+
if (errors.length) {
|
|
14
|
+
context.report({
|
|
15
|
+
data: {
|
|
16
|
+
errors: formatErrors(errors)
|
|
17
|
+
},
|
|
18
|
+
messageId: "validationError",
|
|
19
|
+
node: valueNode
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
meta: {
|
|
26
|
+
docs: {
|
|
27
|
+
category: "Best Practices",
|
|
28
|
+
description: "Enforce that the `license` property is valid.",
|
|
29
|
+
recommended: true
|
|
30
|
+
},
|
|
31
|
+
messages: {
|
|
32
|
+
validationError: "Invalid license: {{ errors }}"
|
|
33
|
+
},
|
|
34
|
+
schema: [],
|
|
35
|
+
type: "problem"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
rule
|
|
40
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-package-json",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.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": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"detect-indent": "^7.0.1",
|
|
50
50
|
"detect-newline": "^4.0.1",
|
|
51
51
|
"eslint-fix-utils": "~0.4.0",
|
|
52
|
-
"package-json-validator": "~0.
|
|
52
|
+
"package-json-validator": "~0.22.0",
|
|
53
53
|
"semver": "^7.5.4",
|
|
54
54
|
"sort-object-keys": "^1.1.3",
|
|
55
55
|
"sort-package-json": "^3.0.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"eslint-plugin-jsdoc": "51.3.1",
|
|
76
76
|
"eslint-plugin-jsonc": "2.20.0",
|
|
77
77
|
"eslint-plugin-markdown": "5.1.0",
|
|
78
|
-
"eslint-plugin-n": "17.
|
|
78
|
+
"eslint-plugin-n": "17.21.0",
|
|
79
79
|
"eslint-plugin-perfectionist": "4.15.0",
|
|
80
80
|
"eslint-plugin-regexp": "2.9.0",
|
|
81
81
|
"eslint-plugin-yml": "1.18.0",
|
|
@@ -94,14 +94,14 @@
|
|
|
94
94
|
"sentences-per-line": "0.3.0",
|
|
95
95
|
"tsup": "8.5.0",
|
|
96
96
|
"typescript": "5.8.2",
|
|
97
|
-
"typescript-eslint": "8.
|
|
97
|
+
"typescript-eslint": "8.36.0",
|
|
98
98
|
"vitest": "3.2.0"
|
|
99
99
|
},
|
|
100
100
|
"peerDependencies": {
|
|
101
101
|
"eslint": ">=8.0.0",
|
|
102
102
|
"jsonc-eslint-parser": "^2.0.0"
|
|
103
103
|
},
|
|
104
|
-
"packageManager": "pnpm@10.
|
|
104
|
+
"packageManager": "pnpm@10.13.0",
|
|
105
105
|
"engines": {
|
|
106
106
|
"node": "^=20.19.0 || >=22.12.0"
|
|
107
107
|
},
|