eslint-plugin-package-json 1.6.3 β 1.7.1
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/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<p align="center">
|
|
16
16
|
<!-- prettier-ignore-start -->
|
|
17
17
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
18
|
-
<a href="#contributors" target="_blank"><img alt="πͺ All Contributors:
|
|
18
|
+
<a href="#contributors" target="_blank"><img alt="πͺ All Contributors: 44" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-44-21bb42.svg" /></a>
|
|
19
19
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
20
20
|
<!-- prettier-ignore-end -->
|
|
21
21
|
<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>
|
|
@@ -202,47 +202,48 @@ Thanks! π»
|
|
|
202
202
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ClementValot"><img src="https://avatars.githubusercontent.com/u/65364056?v=4?s=100" width="100px;" alt="ClΓ©ment Valot"/><br /><sub><b>ClΓ©ment Valot</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3AClementValot" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=ClementValot" title="Code">π»</a></td>
|
|
203
203
|
<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>
|
|
204
204
|
<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/michaelfaith/eslint-plugin-package-json/commits?author=davidlj95" title="Documentation">π</a></td>
|
|
205
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/DetachHead"><img src="https://avatars.githubusercontent.com/u/57028336?v=4?s=100" width="100px;" alt="DetachHead"/><br /><sub><b>DetachHead</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=DetachHead" title="Code">π»</a> <a href="#ideas-DetachHead" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
205
206
|
<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/michaelfaith/eslint-plugin-package-json/issues?q=author%3Alishaduck" title="Bug reports">π</a></td>
|
|
206
207
|
<td align="center" valign="top" width="14.28%"><a href="https://open-fixture-library.org"><img src="https://avatars.githubusercontent.com/u/202916?v=4?s=100" width="100px;" alt="Flo Edelmann"/><br /><sub><b>Flo Edelmann</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=FloEdelmann" title="Documentation">π</a></td>
|
|
207
|
-
<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>
|
|
208
208
|
</tr>
|
|
209
209
|
<tr>
|
|
210
|
+
<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>
|
|
210
211
|
<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/michaelfaith/eslint-plugin-package-json/commits?author=privatenumber" title="Code">π»</a></td>
|
|
211
212
|
<td align="center" valign="top" width="14.28%"><a href="https://vanyauhalin.me/"><img src="https://avatars.githubusercontent.com/u/56481109?v=4?s=100" width="100px;" alt="Ivan Uhalin"/><br /><sub><b>Ivan Uhalin</b></sub></a><br /><a href="#ideas-vanyauhalin" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
212
213
|
<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/michaelfaith/eslint-plugin-package-json/commits?author=Zamiell" title="Code">π»</a> <a href="#ideas-Zamiell" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3AZamiell" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=Zamiell" title="Documentation">π</a></td>
|
|
213
214
|
<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/michaelfaith/eslint-plugin-package-json/commits?author=zetlen" title="Code">π»</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3Azetlen" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/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>
|
|
214
215
|
<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/michaelfaith/eslint-plugin-package-json/commits?author=piranna" title="Code">π»</a></td>
|
|
215
216
|
<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/michaelfaith/eslint-plugin-package-json/issues?q=author%3AJoshuaKGoldberg" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/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/michaelfaith/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>
|
|
216
|
-
<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/michaelfaith/eslint-plugin-package-json/commits?author=kendallgassner" title="Code">π»</a> <a href="#maintenance-kendallgassner" title="Maintenance">π§</a></td>
|
|
217
217
|
</tr>
|
|
218
218
|
<tr>
|
|
219
|
+
<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/michaelfaith/eslint-plugin-package-json/commits?author=kendallgassner" title="Code">π»</a> <a href="#maintenance-kendallgassner" title="Maintenance">π§</a></td>
|
|
219
220
|
<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/michaelfaith/eslint-plugin-package-json/issues?q=author%3Akristjanesperanto" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=kristjanesperanto" title="Code">π»</a></td>
|
|
220
221
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/marcalexiei"><img src="https://avatars.githubusercontent.com/u/24919330?v=4?s=100" width="100px;" alt="Marco Pasqualetti"/><br /><sub><b>Marco Pasqualetti</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=marcalexiei" title="Code">π»</a> <a href="#tool-marcalexiei" title="Tools">π§</a> <a href="#maintenance-marcalexiei" title="Maintenance">π§</a></td>
|
|
221
222
|
<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>
|
|
222
223
|
<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/michaelfaith/eslint-plugin-package-json/commits?author=cellule" title="Code">π»</a></td>
|
|
223
224
|
<td align="center" valign="top" width="14.28%"><a href="https://morrisoncole.co.uk"><img src="https://avatars.githubusercontent.com/u/963368?v=4?s=100" width="100px;" alt="Morrison Cole"/><br /><sub><b>Morrison Cole</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3AMorrisonCole" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=MorrisonCole" title="Documentation">π</a></td>
|
|
224
225
|
<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/michaelfaith/eslint-plugin-package-json/commits?author=nschonni" title="Code">π»</a></td>
|
|
225
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/OlivierZal"><img src="https://avatars.githubusercontent.com/u/88216225?v=4?s=100" width="100px;" alt="Olivier Zalmanski"/><br /><sub><b>Olivier Zalmanski</b></sub></a><br /><a href="#maintenance-olivierzal" title="Maintenance">π§</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=olivierzal" title="Documentation">π</a></td>
|
|
226
226
|
</tr>
|
|
227
227
|
<tr>
|
|
228
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/OlivierZal"><img src="https://avatars.githubusercontent.com/u/88216225?v=4?s=100" width="100px;" alt="Olivier Zalmanski"/><br /><sub><b>Olivier Zalmanski</b></sub></a><br /><a href="#maintenance-olivierzal" title="Maintenance">π§</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=olivierzal" title="Documentation">π</a></td>
|
|
228
229
|
<td align="center" valign="top" width="14.28%"><a href="http://patrikcsak.com"><img src="https://avatars.githubusercontent.com/u/4766244?v=4?s=100" width="100px;" alt="Patrik Csak"/><br /><sub><b>Patrik Csak</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3Apatrik-csak" title="Bug reports">π</a></td>
|
|
229
230
|
<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/michaelfaith/eslint-plugin-package-json/commits?author=rakleed" title="Documentation">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=rakleed" title="Code">π»</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/issues?q=author%3Arakleed" title="Bug reports">π</a></td>
|
|
230
231
|
<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/michaelfaith/eslint-plugin-package-json/commits?author=sasial-dev" title="Code">π»</a></td>
|
|
231
232
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/belozer"><img src="https://avatars.githubusercontent.com/u/1655916?v=4?s=100" width="100px;" alt="Sergey Belozyorcev"/><br /><sub><b>Sergey Belozyorcev</b></sub></a><br /><a href="#ideas-belozer" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
232
233
|
<td align="center" valign="top" width="14.28%"><a href="https://shayan-zamani.me"><img src="https://avatars.githubusercontent.com/u/81762186?v=4?s=100" width="100px;" alt="Shayan Zamani"/><br /><sub><b>Shayan Zamani</b></sub></a><br /><a href="#ideas-ShayanTheNerd" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=ShayanTheNerd" title="Documentation">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=ShayanTheNerd" title="Code">π»</a></td>
|
|
233
234
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Sigmabrogz"><img src="https://avatars.githubusercontent.com/u/122412346?v=4?s=100" width="100px;" alt="Sigmabro"/><br /><sub><b>Sigmabro</b></sub></a><br /><a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=Sigmabrogz" title="Code">π»</a></td>
|
|
234
|
-
<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/michaelfaith/eslint-plugin-package-json/commits?author=sirugh" title="Code">π»</a></td>
|
|
235
235
|
</tr>
|
|
236
236
|
<tr>
|
|
237
|
+
<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/michaelfaith/eslint-plugin-package-json/commits?author=sirugh" title="Code">π»</a></td>
|
|
237
238
|
<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/michaelfaith/eslint-plugin-package-json/issues?q=author%3Ahyoban" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=hyoban" title="Code">π»</a> <a href="#ideas-hyoban" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=hyoban" title="Documentation">π</a></td>
|
|
238
239
|
<td align="center" valign="top" width="14.28%"><a href="https://www.wesleytodd.com/"><img src="https://avatars.githubusercontent.com/u/1027776?v=4?s=100" width="100px;" alt="Wes Todd"/><br /><sub><b>Wes Todd</b></sub></a><br /><a href="#ideas-wesleytodd" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
239
240
|
<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/michaelfaith/eslint-plugin-package-json/issues?q=author%3Aota-meshi" title="Bug reports">π</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=ota-meshi" title="Code">π»</a></td>
|
|
240
241
|
<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/michaelfaith/eslint-plugin-package-json/issues?q=author%3Ab3rnhard" title="Bug reports">π</a></td>
|
|
241
242
|
<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/michaelfaith/eslint-plugin-package-json/commits?author=chouchouji" title="Code">π»</a></td>
|
|
242
243
|
<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/michaelfaith/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/michaelfaith/eslint-plugin-package-json/issues?q=author%3Amichaelfaith" title="Bug reports">π</a> <a href="#tool-michaelfaith" title="Tools">π§</a> <a href="https://github.com/michaelfaith/eslint-plugin-package-json/commits?author=michaelfaith" title="Documentation">π</a> <a href="#projectManagement-michaelfaith" title="Project Management">π</a></td>
|
|
243
|
-
<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/michaelfaith/eslint-plugin-package-json/commits?author=roottool" title="Code">π»</a></td>
|
|
244
244
|
</tr>
|
|
245
245
|
<tr>
|
|
246
|
+
<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/michaelfaith/eslint-plugin-package-json/commits?author=roottool" title="Code">π»</a></td>
|
|
246
247
|
<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/michaelfaith/eslint-plugin-package-json/issues?q=author%3Asunnytsang1998" title="Bug reports">π</a></td>
|
|
247
248
|
</tr>
|
|
248
249
|
</tbody>
|
package/dist/index.mjs
CHANGED
|
@@ -244,12 +244,21 @@ const rule$16 = createRule({
|
|
|
244
244
|
//#endregion
|
|
245
245
|
//#region src/rules/no-local-dependencies.ts
|
|
246
246
|
const isLocalDependency = (value) => value.startsWith("file:") || value.startsWith("link:") || value.startsWith("./") || value.startsWith("../") || value.startsWith(".\\") || value.startsWith("..\\");
|
|
247
|
+
const getBundledDependencyNames = (value) => {
|
|
248
|
+
const names = /* @__PURE__ */ new Set();
|
|
249
|
+
if (value?.type === "JSONArrayExpression") for (const element of value.elements.filter(isNotNullish).filter(isJSONStringLiteral)) names.add(element.value);
|
|
250
|
+
return names;
|
|
251
|
+
};
|
|
247
252
|
const rule$15 = createRule({
|
|
248
253
|
create(context) {
|
|
249
254
|
const ignorePrivate = context.options[0]?.ignorePrivate ?? true;
|
|
250
255
|
let isPrivate = false;
|
|
251
256
|
let dependencyNodes = [];
|
|
257
|
+
const bundleDependencyValues = /* @__PURE__ */ new Map();
|
|
252
258
|
return {
|
|
259
|
+
"Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.type=JSONLiteral]:matches([key.value=bundleDependencies], [key.value=bundledDependencies])"(node) {
|
|
260
|
+
bundleDependencyValues.set(node.key.value, node.value);
|
|
261
|
+
},
|
|
253
262
|
"Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.type=JSONLiteral][value.type=JSONLiteral][key.value=private]"(node) {
|
|
254
263
|
if (node.value.value === true) isPrivate = true;
|
|
255
264
|
},
|
|
@@ -258,7 +267,13 @@ const rule$15 = createRule({
|
|
|
258
267
|
},
|
|
259
268
|
"Program:exit"() {
|
|
260
269
|
if (ignorePrivate && isPrivate) return;
|
|
270
|
+
let bundleDependenciesValue = bundleDependencyValues.get("bundleDependencies");
|
|
271
|
+
if (!(bundleDependenciesValue && (bundleDependenciesValue.type !== "JSONLiteral" || Boolean(bundleDependenciesValue.value)))) bundleDependenciesValue = bundleDependencyValues.get("bundledDependencies");
|
|
272
|
+
if (bundleDependenciesValue?.type === "JSONLiteral" && bundleDependenciesValue.value === true) return;
|
|
273
|
+
const bundledDependencyNames = getBundledDependencyNames(bundleDependenciesValue);
|
|
261
274
|
for (const dependencyPropertyNode of dependencyNodes) {
|
|
275
|
+
const dependencyKey = dependencyPropertyNode.key;
|
|
276
|
+
if (isJSONStringLiteral(dependencyKey) && bundledDependencyNames.has(dependencyKey.value)) continue;
|
|
262
277
|
const dependencyValue = dependencyPropertyNode.value;
|
|
263
278
|
if (isJSONStringLiteral(dependencyValue) && isLocalDependency(dependencyValue.value)) context.report({
|
|
264
279
|
data: { name: dependencyValue.value },
|
|
@@ -847,10 +862,40 @@ const DEPENDENCY_TYPES = [
|
|
|
847
862
|
"peerDependencies"
|
|
848
863
|
];
|
|
849
864
|
const RANGE_TYPES = [
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
865
|
+
{
|
|
866
|
+
symbol: "^",
|
|
867
|
+
alias: "caret",
|
|
868
|
+
workspaceSymbol: "^"
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
alias: "pin",
|
|
872
|
+
workspaceSymbol: "*"
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
symbol: "~",
|
|
876
|
+
alias: "tilde",
|
|
877
|
+
workspaceSymbol: "~"
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
symbol: "<",
|
|
881
|
+
alias: "lt"
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
symbol: "<=",
|
|
885
|
+
alias: "le"
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
symbol: ">",
|
|
889
|
+
alias: "gt"
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
symbol: ">=",
|
|
893
|
+
alias: "ge"
|
|
894
|
+
}
|
|
853
895
|
];
|
|
896
|
+
const SYMBOLS = RANGE_TYPES.filter((rangeType) => "symbol" in rangeType).map((rangeType) => rangeType.symbol);
|
|
897
|
+
const RANGE_NAMES = RANGE_TYPES.map((rangeType) => rangeType.alias);
|
|
898
|
+
const SYMBOLS_AND_RANGE_NAMES = [...SYMBOLS, ...RANGE_NAMES];
|
|
854
899
|
const schemaOptions = {
|
|
855
900
|
additionalProperties: false,
|
|
856
901
|
properties: {
|
|
@@ -870,8 +915,8 @@ const schemaOptions = {
|
|
|
870
915
|
},
|
|
871
916
|
rangeType: {
|
|
872
917
|
description: "Identifies which range type or types you want to apply to packages that match any of the other match options (or all dependencies if no other options are provided).",
|
|
873
|
-
oneOf: [{ enum:
|
|
874
|
-
items: { enum:
|
|
918
|
+
oneOf: [{ enum: SYMBOLS_AND_RANGE_NAMES }, {
|
|
919
|
+
items: { enum: SYMBOLS_AND_RANGE_NAMES },
|
|
875
920
|
type: "array"
|
|
876
921
|
}]
|
|
877
922
|
}
|
|
@@ -879,33 +924,37 @@ const schemaOptions = {
|
|
|
879
924
|
required: ["rangeType"],
|
|
880
925
|
type: "object"
|
|
881
926
|
};
|
|
882
|
-
const
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
927
|
+
const normalizeRangeType = (rangeTypeOrSymbol) => RANGE_TYPES.find((rangeType) => "symbol" in rangeType && rangeType.symbol === rangeTypeOrSymbol || rangeType.alias === rangeTypeOrSymbol);
|
|
928
|
+
/** @returns `undefined` if workspace versions are not supported for the specified {@link rangeType} */
|
|
929
|
+
const getWorkspaceVersionForRange = (rangeType) => {
|
|
930
|
+
if ("workspaceSymbol" in rangeType) return `workspace:${rangeType.workspaceSymbol}`;
|
|
886
931
|
};
|
|
932
|
+
/** For displaying a range type in a user-facing way (ie. an error message). */
|
|
933
|
+
const displayRangeType = (rangeType) => "symbol" in rangeType ? rangeType.symbol : rangeType.alias;
|
|
934
|
+
const ROLLING_WORKSPACE_REGEX = /^workspace:[~^*]$/;
|
|
935
|
+
const isRollingWorkspaceSpec = (version) => ROLLING_WORKSPACE_REGEX.test(version);
|
|
936
|
+
const CHANGE_VERSION_RANGE_REGEX = /^(workspace:)?(\^|~|<=?|>=?)?/;
|
|
887
937
|
/**
|
|
888
938
|
* Given the original version, update it to use the correct range type.
|
|
889
939
|
*/
|
|
890
940
|
const changeVersionRange = (version, rangeType) => {
|
|
891
|
-
if (
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
default: return "workspace:~";
|
|
941
|
+
if (isRollingWorkspaceSpec(version)) {
|
|
942
|
+
const result = getWorkspaceVersionForRange(rangeType);
|
|
943
|
+
if (result !== void 0) return result;
|
|
895
944
|
}
|
|
896
|
-
|
|
945
|
+
const replaceWith = "symbol" in rangeType ? rangeType.symbol : "";
|
|
946
|
+
return version.replace(CHANGE_VERSION_RANGE_REGEX, `$1${replaceWith}`);
|
|
897
947
|
};
|
|
948
|
+
const IS_VERSION_SUPPORTED_REGEX = /^workspace:/;
|
|
898
949
|
/**
|
|
899
950
|
* Check if the version is in a form that this rule supports.
|
|
900
951
|
*/
|
|
901
952
|
const isVersionSupported = (version) => {
|
|
902
|
-
if (
|
|
903
|
-
const rawVersion = version.replace(
|
|
953
|
+
if (isRollingWorkspaceSpec(version)) return true;
|
|
954
|
+
const rawVersion = version.replace(IS_VERSION_SUPPORTED_REGEX, "");
|
|
904
955
|
return !!semver.validRange(rawVersion);
|
|
905
956
|
};
|
|
906
|
-
const
|
|
907
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
908
|
-
};
|
|
957
|
+
const POSSIBLE_WORKSPACE_SPEC_REGEX = /(?:workspace:)?[^~]?/;
|
|
909
958
|
const rule$9 = createRule({
|
|
910
959
|
create(context) {
|
|
911
960
|
if (!context.options[0]) return {};
|
|
@@ -922,39 +971,41 @@ const rule$9 = createRule({
|
|
|
922
971
|
const name = property.key.value;
|
|
923
972
|
const version = property.value.value;
|
|
924
973
|
if (!isVersionSupported(version)) continue;
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
|
|
974
|
+
const doesRangeTypeMatch = (rangeType) => {
|
|
975
|
+
if ("symbol" in rangeType && semver.validRange(version)) return version.startsWith(rangeType.symbol);
|
|
976
|
+
if (rangeType.alias === "pin" && (!!semver.parse(version) || version === "workspace:*" || version === "workspace:")) return true;
|
|
977
|
+
if (version.startsWith("workspace:")) {
|
|
978
|
+
const workspaceVersion = getWorkspaceVersionForRange(rangeType);
|
|
979
|
+
return workspaceVersion === void 0 || version.startsWith(workspaceVersion);
|
|
980
|
+
}
|
|
981
|
+
return false;
|
|
982
|
+
};
|
|
928
983
|
for (const options of optionsArray) {
|
|
929
984
|
if (options.forDependencyTypes && !options.forDependencyTypes.includes(dependencyType)) continue;
|
|
930
985
|
if (options.forPackages) {
|
|
931
986
|
if (!options.forPackages.some((packageNameRegex) => packageNameRegex.test(name))) continue;
|
|
932
987
|
}
|
|
933
|
-
if (options.forVersions && (
|
|
934
|
-
const rangeTypes = options.rangeTypes;
|
|
988
|
+
if (options.forVersions && (isRollingWorkspaceSpec(version) || version !== "*" && !semver.satisfies(version.replace(POSSIBLE_WORKSPACE_SPEC_REGEX, ""), options.forVersions))) continue;
|
|
989
|
+
const rangeTypes = options.rangeTypes.map(normalizeRangeType);
|
|
990
|
+
const validRangeTypes = rangeTypes.map(displayRangeType).join(", ");
|
|
935
991
|
if (version === "*") {
|
|
936
992
|
context.report({
|
|
937
|
-
data: { rangeTypes:
|
|
993
|
+
data: { rangeTypes: validRangeTypes },
|
|
938
994
|
messageId: "wrongRangeType",
|
|
939
995
|
node: property.value
|
|
940
996
|
});
|
|
941
997
|
break;
|
|
942
998
|
}
|
|
943
|
-
if (!rangeTypes.some(
|
|
944
|
-
|
|
945
|
-
case "caret": return isCaretRange;
|
|
946
|
-
case "pin": return isPinned;
|
|
947
|
-
case "tilde": return isTildeRange;
|
|
948
|
-
}
|
|
949
|
-
})) context.report({
|
|
950
|
-
data: { rangeTypes: rangeTypes.join(", ") },
|
|
999
|
+
if (!rangeTypes.some(doesRangeTypeMatch)) context.report({
|
|
1000
|
+
data: { rangeTypes: validRangeTypes },
|
|
951
1001
|
messageId: "wrongRangeType",
|
|
952
1002
|
node: property.value,
|
|
953
1003
|
suggest: rangeTypes.map((rangeType) => ({
|
|
954
1004
|
fix(fixer) {
|
|
955
1005
|
return fixer.replaceText(property.value, `"${changeVersionRange(version, rangeType)}"`);
|
|
956
1006
|
},
|
|
957
|
-
messageId:
|
|
1007
|
+
messageId: rangeType.alias === "pin" ? "changeToPin" : "changeTo",
|
|
1008
|
+
data: rangeType.alias === "pin" ? void 0 : { rangeType: displayRangeType(rangeType) }
|
|
958
1009
|
}))
|
|
959
1010
|
});
|
|
960
1011
|
break;
|
|
@@ -967,9 +1018,8 @@ const rule$9 = createRule({
|
|
|
967
1018
|
docs: { description: "Restricts the range of dependencies to allow or disallow specific types of ranges." },
|
|
968
1019
|
hasSuggestions: true,
|
|
969
1020
|
messages: {
|
|
970
|
-
changeToCaret: "Change to use a caret range.",
|
|
971
1021
|
changeToPin: "Pin the version.",
|
|
972
|
-
|
|
1022
|
+
changeTo: "Change to use a {{rangeType}} range",
|
|
973
1023
|
wrongRangeType: "This dependency is using the wrong range type. Acceptable range type(s): {{rangeTypes}}"
|
|
974
1024
|
},
|
|
975
1025
|
schema: [{ oneOf: [schemaOptions, {
|
|
@@ -1104,11 +1154,14 @@ const rule$7 = createRule({
|
|
|
1104
1154
|
const BUILT_IN_SCRIPTS_IN_CAMEL_CASE = /* @__PURE__ */ new Set(["prepublishOnly", "pnpm:devPreinstall"]);
|
|
1105
1155
|
const rule$6 = createRule({
|
|
1106
1156
|
create(context) {
|
|
1157
|
+
const { ignoreNames = [], ignorePatterns = [] } = context.options[0] ?? {};
|
|
1158
|
+
const ignoreRegexes = ignorePatterns.map((pattern) => new RegExp(pattern));
|
|
1159
|
+
const isIgnored = (name) => ignoreNames.includes(name) || ignoreRegexes.some((regex) => regex.test(name));
|
|
1107
1160
|
return { "Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.value=scripts]"(node) {
|
|
1108
1161
|
if (node.value.type === "JSONObjectExpression") for (const property of node.value.properties) {
|
|
1109
1162
|
const keyNode = property.key;
|
|
1110
1163
|
const key = keyNode.value;
|
|
1111
|
-
if (BUILT_IN_SCRIPTS_IN_CAMEL_CASE.has(key)) continue;
|
|
1164
|
+
if (BUILT_IN_SCRIPTS_IN_CAMEL_CASE.has(key) || isIgnored(key)) continue;
|
|
1112
1165
|
const kebabCaseKey = (key.startsWith(".") ? key.slice(1) : key).split(":").map((segment) => kebabCase(segment)).join(":");
|
|
1113
1166
|
if (kebabCaseKey !== (key.startsWith(".") ? key.slice(1) : key)) context.report({
|
|
1114
1167
|
data: { property: key },
|
|
@@ -1126,6 +1179,7 @@ const rule$6 = createRule({
|
|
|
1126
1179
|
} };
|
|
1127
1180
|
},
|
|
1128
1181
|
meta: {
|
|
1182
|
+
defaultOptions: [{}],
|
|
1129
1183
|
docs: {
|
|
1130
1184
|
category: "Stylistic",
|
|
1131
1185
|
description: "Enforce that names for `scripts` are in kebab case (optionally separated by colons)."
|
|
@@ -1135,7 +1189,22 @@ const rule$6 = createRule({
|
|
|
1135
1189
|
convertToKebabCase: "Convert {{ property }} to kebab case.",
|
|
1136
1190
|
invalidCase: "Script name {{ property }} should be in kebab case."
|
|
1137
1191
|
},
|
|
1138
|
-
schema: [
|
|
1192
|
+
schema: [{
|
|
1193
|
+
additionalProperties: false,
|
|
1194
|
+
properties: {
|
|
1195
|
+
ignoreNames: {
|
|
1196
|
+
items: { type: ["string"] },
|
|
1197
|
+
type: ["array"],
|
|
1198
|
+
description: "Specific script names to ignore."
|
|
1199
|
+
},
|
|
1200
|
+
ignorePatterns: {
|
|
1201
|
+
items: { type: ["string"] },
|
|
1202
|
+
type: ["array"],
|
|
1203
|
+
description: "Regex patterns for script names to ignore."
|
|
1204
|
+
}
|
|
1205
|
+
},
|
|
1206
|
+
type: "object"
|
|
1207
|
+
}],
|
|
1139
1208
|
type: "suggestion"
|
|
1140
1209
|
},
|
|
1141
1210
|
name: "scripts-name-casing"
|
|
@@ -1665,7 +1734,9 @@ const packageManagerAwareValidateDependencies = (value) => {
|
|
|
1665
1734
|
const result = detectPackageManager();
|
|
1666
1735
|
if (result?.name === "pnpm") {
|
|
1667
1736
|
const version = result.version;
|
|
1668
|
-
|
|
1737
|
+
const isValidSemver = !!semver.valid(version);
|
|
1738
|
+
const isValidRange = !!semver.validRange(version);
|
|
1739
|
+
if (!version || isValidSemver && semver.gte(version, "11.1.0") || isValidRange && semver.satisfies("11.1.0", version)) return validateDependencies(value, { allowNamedRegistries: true });
|
|
1669
1740
|
}
|
|
1670
1741
|
return validateDependencies(value);
|
|
1671
1742
|
};
|
|
@@ -1737,7 +1808,7 @@ const pathEndsWith = (parent, child) => {
|
|
|
1737
1808
|
let pathToCheck = "";
|
|
1738
1809
|
return segments.reverse().some((segment) => {
|
|
1739
1810
|
pathToCheck = path.join(segment, pathToCheck);
|
|
1740
|
-
|
|
1811
|
+
return pathToCheck === child;
|
|
1741
1812
|
});
|
|
1742
1813
|
};
|
|
1743
1814
|
let repoRootCache = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-package-json",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
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": {
|
|
@@ -71,24 +71,24 @@
|
|
|
71
71
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
72
72
|
"@vitest/coverage-v8": "4.1.8",
|
|
73
73
|
"@vitest/eslint-plugin": "1.6.20",
|
|
74
|
-
"astro": "7.
|
|
74
|
+
"astro": "7.2.0",
|
|
75
75
|
"astro-og-canvas": "0.13.0",
|
|
76
76
|
"canvaskit-wasm": "0.41.1",
|
|
77
77
|
"console-fail-test": "0.6.0",
|
|
78
78
|
"eslint": "10.8.0",
|
|
79
79
|
"eslint-doc-generator": "3.7.0",
|
|
80
80
|
"eslint-plugin-eslint-plugin": "7.6.0",
|
|
81
|
-
"eslint-plugin-jsdoc": "
|
|
82
|
-
"eslint-plugin-jsonc": "3.
|
|
81
|
+
"eslint-plugin-jsdoc": "64.0.0",
|
|
82
|
+
"eslint-plugin-jsonc": "3.4.0",
|
|
83
83
|
"eslint-plugin-n": "18.2.1",
|
|
84
84
|
"eslint-plugin-node-dependencies": "2.2.0",
|
|
85
85
|
"eslint-plugin-perfectionist": "5.10.0",
|
|
86
86
|
"eslint-plugin-regexp": "3.1.0",
|
|
87
|
-
"eslint-plugin-unicorn": "
|
|
88
|
-
"eslint-plugin-yml": "3.
|
|
87
|
+
"eslint-plugin-unicorn": "73.0.0",
|
|
88
|
+
"eslint-plugin-yml": "3.8.0",
|
|
89
89
|
"jiti": "2.7.0",
|
|
90
90
|
"json-schema-to-ts": "3.1.1",
|
|
91
|
-
"knip": "6.
|
|
91
|
+
"knip": "6.32.0",
|
|
92
92
|
"prettier": "3.9.0",
|
|
93
93
|
"prettier-plugin-curly": "0.4.1",
|
|
94
94
|
"prettier-plugin-packagejson": "3.0.2",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"starlight-auto-sidebar": "0.4.0",
|
|
100
100
|
"tsdown": "0.22.2",
|
|
101
101
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
102
|
-
"typescript-eslint": "8.
|
|
102
|
+
"typescript-eslint": "8.66.0",
|
|
103
103
|
"vitest": "4.1.8"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|