eslint-plugin-package-json 0.85.0 → 0.87.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/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: 32" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-32-21bb42.svg" /></a>
11
+ <a href="#contributors" target="_blank"><img alt="👪 All Contributors: 35" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-35-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>
@@ -35,11 +35,12 @@ This plugin's recommended configuration enables its rules on `**/package.json` f
35
35
  ```ts
36
36
  // eslint.config.ts
37
37
  import packageJson from "eslint-plugin-package-json";
38
+ import { defineConfig } from "eslint/config";
38
39
 
39
- export default [
40
+ export default defineConfig([
40
41
  // your other ESLint configurations
41
42
  packageJson.configs.recommended,
42
- ];
43
+ ]);
43
44
  ```
44
45
 
45
46
  If you want to override the recommended rules:
@@ -47,16 +48,18 @@ If you want to override the recommended rules:
47
48
  ```ts
48
49
  // eslint.config.ts
49
50
  import packageJson from "eslint-plugin-package-json";
51
+ import { defineConfig } from "eslint/config";
50
52
 
51
- export default [
53
+ export default defineConfig([
52
54
  // your other ESLint configurations
53
- packageJson.configs.recommended,
54
55
  {
56
+ extends: [packageJson.configs.recommended],
57
+ files: ["package.json"],
55
58
  rules: {
56
- "package-json/valid-package-definition": "off",
59
+ "package-json/require-author": "error",
57
60
  },
58
61
  },
59
- ];
62
+ ]);
60
63
  ```
61
64
 
62
65
  See [ESLint's _Configuration Files_ guide](https://eslint.org/docs/latest/use/configure/configuration-files-new) for details on how to customize your rules and other config settings.
@@ -68,11 +71,12 @@ The `recommended-publishable` configuration has everything in it from the standa
68
71
  ```ts
69
72
  // eslint.config.ts
70
73
  import packageJson from "eslint-plugin-package-json";
74
+ import { defineConfig } from "eslint/config";
71
75
 
72
- export default [
76
+ export default defineConfig([
73
77
  // your other ESLint configurations
74
78
  packageJson.configs["recommended-publishable"],
75
- ];
79
+ ]);
76
80
  ```
77
81
 
78
82
  ### Stylistic Config
@@ -83,12 +87,13 @@ This can be used in addition to the recommended config, or on its own.
83
87
  ```ts
84
88
  // eslint.config.ts
85
89
  import packageJson from "eslint-plugin-package-json";
90
+ import { defineConfig } from "eslint/config";
86
91
 
87
- export default [
92
+ export default defineConfig([
88
93
  // your other ESLint configurations
89
94
  packageJson.configs.recommended, // or packageJson.configs["recommended-publishable"]
90
95
  packageJson.configs.stylistic,
91
- ];
96
+ ]);
92
97
  ```
93
98
 
94
99
  ### Legacy Recommended Config (deprecated)
@@ -141,8 +146,9 @@ Example:
141
146
  ```ts
142
147
  // eslint.config.ts
143
148
  import packageJson from "eslint-plugin-package-json";
149
+ import { defineConfig } from "eslint/config";
144
150
 
145
- export default {
151
+ export default defineConfig({
146
152
  plugins: {
147
153
  "package-json": packageJson,
148
154
  },
@@ -155,7 +161,7 @@ export default {
155
161
  enforceForPrivate: false,
156
162
  },
157
163
  },
158
- };
164
+ });
159
165
  ```
160
166
 
161
167
  #### `enforceForPrivate`
@@ -203,7 +209,7 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
203
209
  | [no-empty-fields](docs/rules/no-empty-fields.md) | Reports on unnecessary empty arrays and objects. | ✔️ ✅ 📦 | | 💡 | |
204
210
  | [no-redundant-files](docs/rules/no-redundant-files.md) | Prevents adding unnecessary / redundant files. | ✔️ ✅ 📦 | | 💡 | |
205
211
  | [no-redundant-publishConfig](docs/rules/no-redundant-publishConfig.md) | Warns when publishConfig.access is used in unscoped packages. | ✔️ ✅ 📦 | | 💡 | |
206
- | [order-properties](docs/rules/order-properties.md) | Package properties must be declared in standard order | ✔️ ✅ 📦 | 🔧 | | |
212
+ | [order-properties](docs/rules/order-properties.md) | Package properties should be declared in standard order | 🎨 | 🔧 | | |
207
213
  | [repository-shorthand](docs/rules/repository-shorthand.md) | Enforce either object or shorthand declaration for repository. | ✔️ ✅ 📦 | 🔧 | | |
208
214
  | [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. | 📦 | | 💡 | |
209
215
  | [require-author](docs/rules/require-author.md) | Requires the `author` property to be present. | | | | |
@@ -246,9 +252,9 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
246
252
  | [valid-homepage](docs/rules/valid-homepage.md) | Enforce that the `homepage` property is valid. | ✔️ ✅ 📦 | | | |
247
253
  | [valid-keywords](docs/rules/valid-keywords.md) | Enforce that the `keywords` property is valid. | ✔️ ✅ 📦 | | | |
248
254
  | [valid-license](docs/rules/valid-license.md) | Enforce that the `license` property is valid. | ✔️ ✅ 📦 | | | |
249
- | [valid-local-dependency](docs/rules/valid-local-dependency.md) | Checks existence of local dependencies in the package.json | | | | ❌ |
250
255
  | [valid-main](docs/rules/valid-main.md) | Enforce that the `main` property is valid. | ✔️ ✅ 📦 | | | |
251
256
  | [valid-man](docs/rules/valid-man.md) | Enforce that the `man` property is valid. | ✔️ ✅ 📦 | | | |
257
+ | [valid-module](docs/rules/valid-module.md) | Enforce that the `module` property is valid. | ✔️ ✅ 📦 | | | |
252
258
  | [valid-name](docs/rules/valid-name.md) | Enforce that package names are valid npm package names | ✔️ ✅ 📦 | | | |
253
259
  | [valid-optionalDependencies](docs/rules/valid-optionalDependencies.md) | Enforce that the `optionalDependencies` property is valid. | ✔️ ✅ 📦 | | | |
254
260
  | [valid-os](docs/rules/valid-os.md) | Enforce that the `os` property is valid. | ✔️ ✅ 📦 | | | |
@@ -304,41 +310,44 @@ Thanks! 🗂
304
310
  <tbody>
305
311
  <tr>
306
312
  <td align="center" valign="top" width="14.28%"><a href="https://alan.norbauer.com"><img src="https://avatars.githubusercontent.com/u/1009?v=4?s=100" width="100px;" alt="Alan"/><br /><sub><b>Alan</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Aaltano" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=altano" title="Code">💻</a></td>
313
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/AlexMan123456"><img src="https://avatars.githubusercontent.com/u/172595284?v=4?s=100" width="100px;" alt="AlexTheMan"/><br /><sub><b>AlexTheMan</b></sub></a><br /><a href="#ideas-AlexMan123456" title="Ideas, Planning, & Feedback">🤔</a></td>
307
314
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/AndreasLindbergPAF"><img src="https://avatars.githubusercontent.com/u/59874563?v=4?s=100" width="100px;" alt="Andreas Lindberg"/><br /><sub><b>Andreas Lindberg</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Aandreaslindbergpaf" title="Bug reports">🐛</a></td>
308
- <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>
315
+ <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> <a href="#tool-andreww2012" title="Tools">🔧</a></td>
309
316
  <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>
310
317
  <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>
311
318
  <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> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Aanomiex" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=anomiex" title="Code">💻</a></td>
312
- <td align="center" valign="top" width="14.28%"><a href="https://christopher-buss.gitbook.io/portfolio"><img src="https://avatars.githubusercontent.com/u/32301681?v=4?s=100" width="100px;" alt="Christopher Buss"/><br /><sub><b>Christopher Buss</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Achristopher-buss" title="Bug reports">🐛</a> <a href="#ideas-christopher-buss" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=christopher-buss" title="Code">💻</a></td>
313
319
  </tr>
314
320
  <tr>
321
+ <td align="center" valign="top" width="14.28%"><a href="https://christopher-buss.gitbook.io/portfolio"><img src="https://avatars.githubusercontent.com/u/32301681?v=4?s=100" width="100px;" alt="Christopher Buss"/><br /><sub><b>Christopher Buss</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Achristopher-buss" title="Bug reports">🐛</a> <a href="#ideas-christopher-buss" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=christopher-buss" title="Code">💻</a></td>
315
322
  <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>
316
323
  <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>
317
324
  <td align="center" valign="top" width="14.28%"><a href="http://lishaduck.github.io"><img src="https://avatars.githubusercontent.com/u/88557639?v=4?s=100" width="100px;" alt="Eli"/><br /><sub><b>Eli</b></sub></a><br /><a href="#ideas-lishaduck" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Alishaduck" title="Bug reports">🐛</a></td>
318
325
  <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>
319
326
  <td align="center" valign="top" width="14.28%"><a href="https://hirok.io"><img src="https://avatars.githubusercontent.com/u/1075694?v=4?s=100" width="100px;" alt="Hiroki Osame"/><br /><sub><b>Hiroki Osame</b></sub></a><br /><a href="#ideas-privatenumber" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=privatenumber" title="Code">💻</a></td>
320
327
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/Zamiell"><img src="https://avatars.githubusercontent.com/u/5511220?v=4?s=100" width="100px;" alt="James"/><br /><sub><b>James</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=Zamiell" title="Code">💻</a> <a href="#ideas-Zamiell" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3AZamiell" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=Zamiell" title="Documentation">📖</a></td>
321
- <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>
322
328
  </tr>
323
329
  <tr>
330
+ <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>
324
331
  <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>
325
332
  <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>
326
333
  <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>
327
334
  <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>
328
335
  <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>
329
336
  <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>
330
- <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/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3AMorrisonCole" title="Bug reports">🐛</a></td>
331
337
  </tr>
332
338
  <tr>
339
+ <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/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3AMorrisonCole" title="Bug reports">🐛</a></td>
333
340
  <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>
341
+ <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/JoshuaKGoldberg/eslint-plugin-package-json/commits?author=olivierzal" title="Documentation">📖</a></td>
342
+ <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/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=author%3Apatrik-csak" title="Bug reports">🐛</a></td>
334
343
  <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>
335
344
  <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>
336
345
  <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>
346
+ </tr>
347
+ <tr>
337
348
  <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>
338
349
  <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>
339
350
  <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>
340
- </tr>
341
- <tr>
342
351
  <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>
343
352
  <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>
344
353
  <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>
package/lib/plugin.mjs CHANGED
@@ -13,17 +13,16 @@ import { rule as rule$10 } from "./rules/scripts-name-casing.mjs";
13
13
  import { rule as rule$11 } from "./rules/sort-collections.mjs";
14
14
  import { rule as rule$12 } from "./rules/specify-peers-locally.mjs";
15
15
  import { rule as rule$13 } from "./rules/unique-dependencies.mjs";
16
- import { rule as rule$14 } from "./rules/valid-local-dependency.mjs";
17
- import { rule as rule$15 } from "./rules/valid-name.mjs";
18
- import { rule as rule$16 } from "./rules/valid-package-definition.mjs";
16
+ import { rule as rule$14 } from "./rules/valid-name.mjs";
17
+ import { rule as rule$15 } from "./rules/valid-package-definition.mjs";
19
18
  import { rules as rules$1 } from "./rules/valid-properties.mjs";
20
- import { rule as rule$17 } from "./rules/valid-repository-directory.mjs";
21
- import { rule as rule$18 } from "./rules/valid-version.mjs";
19
+ import { rule as rule$16 } from "./rules/valid-repository-directory.mjs";
20
+ import { rule as rule$17 } from "./rules/valid-version.mjs";
22
21
  import { createRequire } from "node:module";
23
22
  import * as parserJsonc from "jsonc-eslint-parser";
24
23
 
25
24
  //#region src/plugin.ts
26
- const { name, version } = createRequire(import.meta.url)("../package.json");
25
+ const require = createRequire(import.meta.url);
27
26
  const rules$2 = {
28
27
  "bin-name-casing": rule,
29
28
  "exports-subpaths-style": rule$1,
@@ -41,18 +40,18 @@ const rules$2 = {
41
40
  "specify-peers-locally": rule$12,
42
41
  "unique-dependencies": rule$13,
43
42
  ...rules$1,
44
- "valid-local-dependency": rule$14,
45
- "valid-name": rule$15,
46
- "valid-package-definition": rule$16,
47
- "valid-repository-directory": rule$17,
48
- "valid-version": rule$18
43
+ "valid-name": rule$14,
44
+ "valid-package-definition": rule$15,
45
+ "valid-repository-directory": rule$16,
46
+ "valid-version": rule$17
49
47
  };
50
- const recommendedRules = { ...Object.fromEntries(Object.entries(rules$2).filter(([, rule$19]) => rule$19.meta.docs?.recommended).map(([name$1]) => ["package-json/" + name$1, "error"])) };
48
+ const recommendedRules = { ...Object.fromEntries(Object.entries(rules$2).filter(([, rule$18]) => rule$18.meta.docs?.recommended).map(([name$1]) => ["package-json/" + name$1, "error"])) };
51
49
  const recommendedPublishableRules = {
52
50
  ...recommendedRules,
53
- ...Object.fromEntries(Object.entries(rules$2).filter(([, rule$19]) => rule$19.meta.docs?.category === "Publishable").map(([name$1]) => ["package-json/" + name$1, "error"]))
51
+ ...Object.fromEntries(Object.entries(rules$2).filter(([, rule$18]) => rule$18.meta.docs?.category === "Publishable").map(([name$1]) => ["package-json/" + name$1, "error"]))
54
52
  };
55
- const stylisticRules = { ...Object.fromEntries(Object.entries(rules$2).filter(([, rule$19]) => rule$19.meta.docs?.category === "Stylistic").map(([name$1]) => ["package-json/" + name$1, "error"])) };
53
+ const stylisticRules = { ...Object.fromEntries(Object.entries(rules$2).filter(([, rule$18]) => rule$18.meta.docs?.category === "Stylistic").map(([name$1]) => ["package-json/" + name$1, "error"])) };
54
+ const { name, version } = require("../package.json");
56
55
  const plugin = {
57
56
  configs: {
58
57
  "legacy-recommended": {
@@ -70,12 +70,11 @@ const rule = createRule({
70
70
  meta: {
71
71
  defaultOptions: [{ order: "sort-package-json" }],
72
72
  docs: {
73
- category: "Best Practices",
74
- description: "Package properties must be declared in standard order",
75
- recommended: true
73
+ category: "Stylistic",
74
+ description: "Package properties should be declared in standard order"
76
75
  },
77
76
  fixable: "code",
78
- messages: { incorrectOrder: "Package top-level property \"{{property}}\" is not ordered in the npm standard way. Run the ESLint auto-fixer to correct." },
77
+ messages: { incorrectOrder: "Top-level property \"{{property}}\" is not ordered in the standard way." },
79
78
  schema: [{
80
79
  additionalProperties: false,
81
80
  properties: { order: {
@@ -54,7 +54,6 @@ const changeVersionRange = (version, rangeType) => {
54
54
  if (/^workspace:[~^*]$/.test(version)) switch (rangeType) {
55
55
  case "caret": return "workspace:^";
56
56
  case "pin": return "workspace:*";
57
- case "tilde":
58
57
  default: return "workspace:~";
59
58
  }
60
59
  return version.replace(/^(workspace:)?(\^|~|<=?|>=?)?/, `$1${SYMBOLS[rangeType]}`);
@@ -73,7 +72,7 @@ const capitalize = (str) => {
73
72
  const rule = createRule({
74
73
  create(context) {
75
74
  if (!context.options[0]) return {};
76
- const optionsArray = (Array.isArray(context.options[0]) ? [...context.options[0]].reverse() : [context.options[0]]).map((option) => ({
75
+ const optionsArray = (Array.isArray(context.options[0]) ? context.options[0].toReversed() : [context.options[0]]).map((option) => ({
77
76
  ...option,
78
77
  forPackages: option.forPackages?.map((pattern) => new RegExp(pattern)),
79
78
  rangeTypes: Array.isArray(option.rangeType) ? option.rangeType : [option.rangeType]
@@ -26,15 +26,14 @@ const rule = createRule({
26
26
  if (!toSort.has(key)) return;
27
27
  const currentOrder = collection.properties;
28
28
  let desiredOrder;
29
- if (keyPartsReversed.at(-1) !== "scripts") desiredOrder = currentOrder.slice().sort((a, b) => {
30
- return a.key.value > b.key.value ? 1 : -1;
31
- });
32
- else {
29
+ if (keyPartsReversed.at(-1) === "scripts") {
33
30
  const scriptsSource = context.sourceCode.getText(node);
34
31
  const { scripts: sortedScripts } = sortPackageJson(JSON.parse(`{${scriptsSource}}`));
35
32
  const propertyNodeMap = Object.fromEntries(collection.properties.map((prop) => [prop.key.value, prop]));
36
33
  desiredOrder = Object.keys(sortedScripts).map((prop) => propertyNodeMap[prop]);
37
- }
34
+ } else desiredOrder = currentOrder.toSorted((a, b) => {
35
+ return a.key.value > b.key.value ? 1 : -1;
36
+ });
38
37
  if (currentOrder.some((property, i) => desiredOrder[i] !== property)) context.report({
39
38
  data: { key },
40
39
  fix(fixer) {
@@ -22,15 +22,15 @@ const rule = createRule({
22
22
  const trackForCrossGroupUniqueness = Object.keys(dependenciesCache);
23
23
  function check(elements, getNodeToRemove) {
24
24
  const seen = /* @__PURE__ */ new Set();
25
- for (const element of elements.filter(isNotNullish).filter(isJSONStringLiteral).reverse()) if (seen.has(element.value)) report(element, elements);
25
+ for (const element of elements.filter(isNotNullish).filter(isJSONStringLiteral).reverse()) if (seen.has(element.value)) report(element);
26
26
  else seen.add(element.value);
27
- function report(node, elements$1) {
27
+ function report(node) {
28
28
  const removal = getNodeToRemove(node);
29
29
  context.report({
30
30
  messageId: "overridden",
31
31
  node,
32
32
  suggest: [{
33
- fix: removal.type === "JSONProperty" ? fixRemoveObjectProperty(context, removal) : fixRemoveArrayElement(context, removal, elements$1),
33
+ fix: removal.type === "JSONProperty" ? fixRemoveObjectProperty(context, removal) : fixRemoveArrayElement(context, removal, elements),
34
34
  messageId: "remove"
35
35
  }]
36
36
  });
@@ -39,14 +39,11 @@ const rule = createRule({
39
39
  return {
40
40
  "Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.type=JSONLiteral]"(node) {
41
41
  if (!dependencyPropertyNames.has(node.key.value)) return;
42
- switch (node.value.type) {
43
- case "JSONArrayExpression":
44
- check(node.value.elements, (element) => element);
45
- break;
46
- case "JSONObjectExpression":
47
- check(node.value.properties.map((property) => property.key), (property) => property.parent);
48
- if (trackForCrossGroupUniqueness.includes(node.key.value)) dependenciesCache[node.key.value] = node.value.properties;
49
- break;
42
+ const nodeValueType = node.value.type;
43
+ if (nodeValueType === "JSONArrayExpression") check(node.value.elements, (element) => element);
44
+ if (nodeValueType === "JSONObjectExpression") {
45
+ check(node.value.properties.map((property) => property.key), (property) => property.parent);
46
+ if (trackForCrossGroupUniqueness.includes(node.key.value)) dependenciesCache[node.key.value] = node.value.properties;
50
47
  }
51
48
  },
52
49
  "Program:exit"() {
@@ -13,12 +13,12 @@ const rule = createRule({
13
13
  return;
14
14
  }
15
15
  const privateField = node.parent.properties.find((p) => p.key.type === "JSONLiteral" && p.key.value === "private");
16
- if (privateField && privateField.value.type === "JSONLiteral" && (privateField.value.value === true || privateField.value.value === "true")) return;
16
+ if (privateField?.value.type === "JSONLiteral" && (privateField.value.value === true || privateField.value.value === "true")) return;
17
17
  const { errors, warnings } = validate(node.value.value);
18
18
  const complaints = [...errors ?? [], ...warnings ?? []];
19
19
  if (!complaints.length) return;
20
20
  context.report({
21
- data: { complaints: complaints.map((error) => error.substring(0, error.length)).join("; ") },
21
+ data: { complaints: complaints.map((error) => error.slice(0, Math.max(0, error.length))).join("; ") },
22
22
  messageId: "invalid",
23
23
  node: node.value
24
24
  });
@@ -24,6 +24,7 @@ const properties = [
24
24
  ["license", validateLicense],
25
25
  ["main", validateMain],
26
26
  ["man", validateMan],
27
+ ["module", validateMain],
27
28
  ["optionalDependencies", validateDependencies],
28
29
  ["os", validateOs],
29
30
  ["peerDependencies", validateDependencies],
@@ -1,7 +1,7 @@
1
1
  import { createRule } from "../createRule.mjs";
2
2
  import { findPropertyWithKeyValue } from "../utils/findPropertyWithKeyValue.mjs";
3
- import * as path$1 from "node:path";
4
3
  import { findRootSync } from "@altano/repository-tools";
4
+ import path from "node:path";
5
5
  import { sep } from "node:path/posix";
6
6
 
7
7
  //#region src/rules/valid-repository-directory.ts
@@ -13,11 +13,11 @@ import { sep } from "node:path/posix";
13
13
  * @example '/a/b/c', 'd' => false
14
14
  */
15
15
  function pathEndsWith(parent, child) {
16
- const segments = parent.split(path$1.sep);
16
+ const segments = parent.split(path.sep);
17
17
  if (parent === child) return true;
18
18
  let pathToCheck = "";
19
19
  return segments.reverse().some((segment) => {
20
- pathToCheck = path$1.join(segment, pathToCheck);
20
+ pathToCheck = path.join(segment, pathToCheck);
21
21
  if (pathToCheck === child) return true;
22
22
  });
23
23
  }
@@ -27,15 +27,15 @@ const rule = createRule({
27
27
  const directoryProperty = findPropertyWithKeyValue(node.value.properties, "directory");
28
28
  if (directoryProperty?.value.type !== "JSONLiteral" || typeof directoryProperty.value.value !== "string") return;
29
29
  const directoryValue = directoryProperty.value.value;
30
- const fileDirectory = path$1.normalize(path$1.dirname(context.filename));
30
+ const fileDirectory = path.normalize(path.dirname(context.filename));
31
31
  const repositoryRoot = findRootSync(fileDirectory);
32
32
  if (repositoryRoot == null) {
33
- if (!pathEndsWith(fileDirectory, path$1.normalize(directoryValue))) context.report({
33
+ if (!pathEndsWith(fileDirectory, path.normalize(directoryValue))) context.report({
34
34
  messageId: "mismatched",
35
35
  node: directoryProperty.value
36
36
  });
37
37
  } else {
38
- const expected = path$1.relative(repositoryRoot, fileDirectory).replaceAll(path$1.sep, sep);
38
+ const expected = path.relative(repositoryRoot, fileDirectory).replaceAll(path.sep, sep);
39
39
  if (expected !== directoryValue) context.report({
40
40
  messageId: "mismatched",
41
41
  node: directoryProperty.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-package-json",
3
- "version": "0.85.0",
3
+ "version": "0.87.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": {
@@ -47,7 +47,6 @@
47
47
  "lint": "eslint . --max-warnings 0",
48
48
  "lint:docs": "eslint-doc-generator --check",
49
49
  "lint:knip": "knip",
50
- "lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",
51
50
  "prepare": "husky",
52
51
  "test": "vitest",
53
52
  "typecheck": "tsc"
@@ -70,51 +69,50 @@
70
69
  "devDependencies": {
71
70
  "@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
72
71
  "@eslint/js": "9.39.1",
73
- "@release-it/conventional-changelog": "10.0.0",
74
- "@types/estree": "1.0.7",
75
- "@types/node": "24.10.0",
76
- "@types/semver": "7.7.0",
72
+ "@eslint/markdown": "7.5.1",
73
+ "@release-it/conventional-changelog": "10.0.2",
74
+ "@types/estree": "1.0.8",
75
+ "@types/node": "24.10.1",
76
+ "@types/semver": "7.7.1",
77
77
  "@types/validate-npm-package-name": "4.0.2",
78
- "@vitest/coverage-v8": "4.0.4",
79
- "@vitest/eslint-plugin": "1.4.0",
80
- "console-fail-test": "0.5.0",
78
+ "@vitest/coverage-v8": "4.0.13",
79
+ "@vitest/eslint-plugin": "1.6.1",
80
+ "console-fail-test": "0.6.0",
81
81
  "eslint": "9.39.1",
82
- "eslint-doc-generator": "2.3.0",
82
+ "eslint-doc-generator": "2.4.0",
83
83
  "eslint-plugin-eslint-plugin": "7.2.0",
84
- "eslint-plugin-jsdoc": "61.1.0",
84
+ "eslint-plugin-jsdoc": "61.5.0",
85
85
  "eslint-plugin-jsonc": "2.21.0",
86
+ "eslint-plugin-markdown-links": "0.7.1",
86
87
  "eslint-plugin-n": "17.23.1",
87
- "eslint-plugin-perfectionist": "4.15.0",
88
+ "eslint-plugin-node-dependencies": "1.3.0",
89
+ "eslint-plugin-perfectionist": "5.1.0",
88
90
  "eslint-plugin-regexp": "2.10.0",
91
+ "eslint-plugin-unicorn": "62.0.0",
89
92
  "eslint-plugin-yml": "1.19.0",
90
93
  "husky": "9.1.7",
91
- "jiti": "2.6.0",
94
+ "jiti": "2.6.1",
92
95
  "json-schema-to-ts": "3.1.1",
93
96
  "jsonc-eslint-parser": "2.4.1",
94
- "knip": "5.69.0",
95
- "lint-staged": "16.2.0",
96
- "markdownlint": "0.39.0",
97
- "markdownlint-cli": "0.45.0",
98
- "prettier": "3.6.0",
97
+ "knip": "5.78.0",
98
+ "lint-staged": "16.2.7",
99
+ "prettier": "3.7.0",
99
100
  "prettier-plugin-curly": "0.4.0",
100
- "prettier-plugin-packagejson": "2.5.10",
101
+ "prettier-plugin-packagejson": "2.5.19",
102
+ "prettier-plugin-sentences-per-line": "0.2.0",
101
103
  "prettier-plugin-sh": "0.18.0",
102
- "release-it": "19.0.1",
103
- "sentences-per-line": "0.3.0",
104
- "tsdown": "0.16.0",
105
- "typescript": "5.9.2",
106
- "typescript-eslint": "8.46.0",
107
- "vitest": "4.0.4"
104
+ "release-it": "19.2.0",
105
+ "tsdown": "0.18.0",
106
+ "typescript": "5.9.3",
107
+ "typescript-eslint": "8.50.0",
108
+ "vitest": "4.0.13"
108
109
  },
109
110
  "peerDependencies": {
110
111
  "eslint": ">=8.0.0",
111
112
  "jsonc-eslint-parser": "^2.0.0"
112
113
  },
113
- "packageManager": "pnpm@10.21.0",
114
+ "packageManager": "pnpm@10.26.0",
114
115
  "engines": {
115
116
  "node": "^20.19.0 || >=22.12.0"
116
- },
117
- "publishConfig": {
118
- "provenance": true
119
117
  }
120
118
  }
@@ -1,6 +0,0 @@
1
- import { PackageJsonRuleModule } from "../createRule.mjs";
2
-
3
- //#region src/rules/valid-local-dependency.d.ts
4
- declare const rule: PackageJsonRuleModule<[], []>;
5
- //#endregion
6
- export { rule };
@@ -1,53 +0,0 @@
1
- import { createRule } from "../createRule.mjs";
2
- import { createRequire } from "node:module";
3
- import path from "node:path";
4
-
5
- //#region src/rules/valid-local-dependency.ts
6
- const require = createRequire(import.meta.url);
7
- const fileRegex = /^file:/;
8
- const linkRegex = /^link:/;
9
- const rule = createRule({
10
- create(context) {
11
- return { "Program:exit"() {
12
- const { dependencies, devDependencies, peerDependencies } = JSON.parse(context.sourceCode.text);
13
- const depObjs = [
14
- Object.entries(dependencies ?? {}),
15
- Object.entries(peerDependencies ?? {}),
16
- Object.entries(devDependencies ?? {})
17
- ];
18
- for (const obj of depObjs) for (const [key, value] of obj) {
19
- const response = (pathToken) => {
20
- const filePath = path.join(context.filename.replace("package.json", ""), value.replace(pathToken, ""));
21
- try {
22
- require.resolve(filePath);
23
- } catch {
24
- context.report({
25
- data: {
26
- package: key,
27
- path: value
28
- },
29
- messageId: "invalidPath",
30
- node: context.sourceCode.ast
31
- });
32
- }
33
- };
34
- if (value.startsWith("link:")) response(linkRegex);
35
- if (value.startsWith("file:")) response(fileRegex);
36
- }
37
- } };
38
- },
39
- meta: {
40
- deprecated: true,
41
- docs: {
42
- category: "Best Practices",
43
- description: "Checks existence of local dependencies in the package.json"
44
- },
45
- messages: { invalidPath: "The package {{package}} does not exist given the specified path: {{path}}." },
46
- schema: [],
47
- type: "problem"
48
- },
49
- name: "valid-local-dependency"
50
- });
51
-
52
- //#endregion
53
- export { rule };