eslint-plugin-package-json 0.84.0 → 0.86.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 +96 -83
- package/README.md +30 -20
- package/lib/plugin.mjs +13 -14
- package/lib/rules/restrict-dependency-ranges.mjs +1 -2
- package/lib/rules/sort-collections.mjs +4 -5
- package/lib/rules/unique-dependencies.mjs +8 -11
- package/lib/rules/valid-name.mjs +2 -2
- package/lib/rules/valid-properties.mjs +3 -1
- package/lib/rules/valid-repository-directory.mjs +6 -6
- package/package.json +28 -30
- package/lib/rules/valid-local-dependency.d.mts +0 -6
- package/lib/rules/valid-local-dependency.mjs +0 -53
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: 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/
|
|
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`
|
|
@@ -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. | ✔️ ✅ 📦 | | | |
|
|
@@ -259,6 +265,7 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
|
|
|
259
265
|
| [valid-repository](docs/rules/valid-repository.md) | Enforce that the `repository` property is valid. | ✔️ ✅ 📦 | | | |
|
|
260
266
|
| [valid-repository-directory](docs/rules/valid-repository-directory.md) | Enforce that if repository directory is specified, it matches the path to the package.json file | ✔️ ✅ 📦 | | 💡 | |
|
|
261
267
|
| [valid-scripts](docs/rules/valid-scripts.md) | Enforce that the `scripts` property is valid. | ✔️ ✅ 📦 | | | |
|
|
268
|
+
| [valid-sideEffects](docs/rules/valid-sideEffects.md) | Enforce that the `sideEffects` property is valid. | ✔️ ✅ 📦 | | | |
|
|
262
269
|
| [valid-type](docs/rules/valid-type.md) | Enforce that the `type` property is valid. | ✔️ ✅ 📦 | | | |
|
|
263
270
|
| [valid-version](docs/rules/valid-version.md) | Enforce that package versions are valid semver specifiers | ✔️ ✅ 📦 | | | |
|
|
264
271
|
| [valid-workspaces](docs/rules/valid-workspaces.md) | Enforce that the `workspaces` property is valid. | ✔️ ✅ 📦 | | | |
|
|
@@ -303,41 +310,44 @@ Thanks! 🗂
|
|
|
303
310
|
<tbody>
|
|
304
311
|
<tr>
|
|
305
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>
|
|
306
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>
|
|
307
|
-
<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>
|
|
308
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>
|
|
309
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>
|
|
310
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>
|
|
311
|
-
<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>
|
|
312
319
|
</tr>
|
|
313
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>
|
|
314
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>
|
|
315
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>
|
|
316
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>
|
|
317
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>
|
|
318
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>
|
|
319
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>
|
|
320
|
-
<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>
|
|
321
328
|
</tr>
|
|
322
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>
|
|
323
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>
|
|
324
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>
|
|
325
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>
|
|
326
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>
|
|
327
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>
|
|
328
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>
|
|
329
|
-
<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>
|
|
330
337
|
</tr>
|
|
331
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>
|
|
332
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>
|
|
333
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>
|
|
334
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>
|
|
335
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>
|
|
336
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>
|
|
337
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>
|
|
338
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>
|
|
339
|
-
</tr>
|
|
340
|
-
<tr>
|
|
341
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>
|
|
342
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>
|
|
343
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-
|
|
17
|
-
import { rule as rule$15 } from "./rules/valid-
|
|
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$
|
|
21
|
-
import { rule as rule$
|
|
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
|
|
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-
|
|
45
|
-
"valid-
|
|
46
|
-
"valid-
|
|
47
|
-
"valid-
|
|
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$
|
|
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$
|
|
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$
|
|
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": {
|
|
@@ -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]) ?
|
|
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)
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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"() {
|
package/lib/rules/valid-name.mjs
CHANGED
|
@@ -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
|
|
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.
|
|
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
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSimpleValidPropertyRule } from "../utils/createSimpleValidPropertyRule.mjs";
|
|
2
|
-
import { validateAuthor, validateBin, validateBundleDependencies, validateConfig, validateContributors, validateCpu, validateDependencies, validateDescription, validateDirectories, validateEngines, validateExports, validateFiles, validateHomepage, validateKeywords, validateLicense, validateMain, validateMan, validateOs, validatePrivate, validatePublishConfig, validateRepository, validateScripts, validateType, validateWorkspaces } from "package-json-validator";
|
|
2
|
+
import { validateAuthor, validateBin, validateBundleDependencies, validateConfig, validateContributors, validateCpu, validateDependencies, validateDescription, validateDirectories, validateEngines, validateExports, validateFiles, validateHomepage, validateKeywords, validateLicense, validateMain, validateMan, validateOs, validatePrivate, validatePublishConfig, validateRepository, validateScripts, validateSideEffects, validateType, validateWorkspaces } from "package-json-validator";
|
|
3
3
|
|
|
4
4
|
//#region src/rules/valid-properties.ts
|
|
5
5
|
const properties = [
|
|
@@ -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],
|
|
@@ -31,6 +32,7 @@ const properties = [
|
|
|
31
32
|
["publishConfig", validatePublishConfig],
|
|
32
33
|
["repository", validateRepository],
|
|
33
34
|
["scripts", validateScripts],
|
|
35
|
+
["sideEffects", validateSideEffects],
|
|
34
36
|
["type", validateType],
|
|
35
37
|
["workspaces", validateWorkspaces]
|
|
36
38
|
];
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.86.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"
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
"detect-indent": "^7.0.2",
|
|
62
61
|
"detect-newline": "^4.0.1",
|
|
63
62
|
"eslint-fix-utils": "~0.4.0",
|
|
64
|
-
"package-json-validator": "~0.
|
|
63
|
+
"package-json-validator": "~0.59.0",
|
|
65
64
|
"semver": "^7.7.3",
|
|
66
65
|
"sort-object-keys": "^2.0.0",
|
|
67
66
|
"sort-package-json": "^3.4.0",
|
|
@@ -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
|
-
"@
|
|
74
|
-
"@
|
|
75
|
-
"@types/
|
|
76
|
-
"@types/
|
|
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.
|
|
79
|
-
"@vitest/eslint-plugin": "1.
|
|
80
|
-
"console-fail-test": "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.
|
|
82
|
+
"eslint-doc-generator": "2.4.0",
|
|
83
83
|
"eslint-plugin-eslint-plugin": "7.2.0",
|
|
84
|
-
"eslint-plugin-jsdoc": "61.
|
|
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-
|
|
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.
|
|
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.
|
|
95
|
-
"lint-staged": "16.2.
|
|
96
|
-
"
|
|
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.
|
|
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
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"typescript": "
|
|
106
|
-
"
|
|
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.
|
|
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,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 };
|