eslint-plugin-package-json 0.83.0 β 0.85.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -2
- package/README.md +84 -68
- package/lib/index.d.mts +13 -0
- package/lib/plugin.d.mts +13 -0
- package/lib/plugin.mjs +13 -0
- package/lib/rules/require-properties.mjs +3 -3
- package/lib/rules/valid-properties.mjs +2 -1
- package/lib/utils/createSimpleRequirePropertyRule.d.mts +5 -0
- package/lib/utils/createSimpleRequirePropertyRule.mjs +2 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
# [0.
|
|
3
|
+
# [0.85.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.84.0...v0.85.0) (2025-11-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **valid-sideEffects:** add new rule for validating `sideEffects` ([#1414](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1414)) ([04b86b1](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/04b86b1a5e86cae4187ca1629ba916066d49b086)), closes [#000](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/000)
|
|
4
9
|
|
|
10
|
+
# [0.84.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.83.0...v0.84.0) (2025-11-18)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- add new `recommended-publishable` config ([#1413](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1413)) ([ba313a6](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/ba313a6ca0b701c152986a83a377b9541c2b20c8)), closes [#1403](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1403)
|
|
15
|
+
|
|
16
|
+
# [0.83.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.82.0...v0.83.0) (2025-11-17)
|
|
5
17
|
|
|
6
18
|
### Features
|
|
7
19
|
|
|
8
|
-
|
|
20
|
+
- **specify-peers-locally:** add rule to require all peers are declared as dev dependencies ([#1407](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1407)) ([5a102ec](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/5a102ecd0f6fb025f42e838492844e2fa32ba786)), closes [#1053](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1053)
|
|
9
21
|
|
|
10
22
|
# [0.82.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.81.0...v0.82.0) (2025-11-17)
|
|
11
23
|
|
package/README.md
CHANGED
|
@@ -61,9 +61,23 @@ export default [
|
|
|
61
61
|
|
|
62
62
|
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.
|
|
63
63
|
|
|
64
|
+
### Recommended Config for Publishable Packages
|
|
65
|
+
|
|
66
|
+
The `recommended-publishable` configuration has everything in it from the standard `recommended` config, with some additional rules added that are geared towards packages that are intended to be published.
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
// eslint.config.ts
|
|
70
|
+
import packageJson from "eslint-plugin-package-json";
|
|
71
|
+
|
|
72
|
+
export default [
|
|
73
|
+
// your other ESLint configurations
|
|
74
|
+
packageJson.configs["recommended-publishable"],
|
|
75
|
+
];
|
|
76
|
+
```
|
|
77
|
+
|
|
64
78
|
### Stylistic Config
|
|
65
79
|
|
|
66
|
-
The stylistic configuration
|
|
80
|
+
The `stylistic` configuration sets up the parser and files similar to the recommended config, but includes rules that are more opinionated about the style of a package.json.
|
|
67
81
|
This can be used in addition to the recommended config, or on its own.
|
|
68
82
|
|
|
69
83
|
```ts
|
|
@@ -72,7 +86,7 @@ import packageJson from "eslint-plugin-package-json";
|
|
|
72
86
|
|
|
73
87
|
export default [
|
|
74
88
|
// your other ESLint configurations
|
|
75
|
-
packageJson.configs.recommended,
|
|
89
|
+
packageJson.configs.recommended, // or packageJson.configs["recommended-publishable"]
|
|
76
90
|
packageJson.configs.stylistic,
|
|
77
91
|
];
|
|
78
92
|
```
|
|
@@ -176,77 +190,79 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
|
|
|
176
190
|
πΌ Configurations enabled in.\
|
|
177
191
|
βοΈ Set in the `legacy-recommended` configuration.\
|
|
178
192
|
β
Set in the `recommended` configuration.\
|
|
193
|
+
π¦ Set in the `recommended-publishable` configuration.\
|
|
179
194
|
π¨ Set in the `stylistic` configuration.\
|
|
180
195
|
π§ Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
|
|
181
196
|
π‘ Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).\
|
|
182
197
|
β Deprecated.
|
|
183
198
|
|
|
184
|
-
| NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Description | πΌ
|
|
185
|
-
| :------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
186
|
-
| [bin-name-casing](docs/rules/bin-name-casing.md) | Enforce that names for bin properties are in kebab case. | π¨
|
|
187
|
-
| [exports-subpaths-style](docs/rules/exports-subpaths-style.md) | Enforce consistent format for the exports field (implicit or explicit subpaths). | π¨
|
|
188
|
-
| [no-empty-fields](docs/rules/no-empty-fields.md) | Reports on unnecessary empty arrays and objects. | βοΈ β
| | π‘ | |
|
|
189
|
-
| [no-redundant-files](docs/rules/no-redundant-files.md) | Prevents adding unnecessary / redundant files. | βοΈ β
| | π‘ | |
|
|
190
|
-
| [no-redundant-publishConfig](docs/rules/no-redundant-publishConfig.md) | Warns when publishConfig.access is used in unscoped packages. | βοΈ β
| | π‘ | |
|
|
191
|
-
| [order-properties](docs/rules/order-properties.md) | Package properties must be declared in standard order | βοΈ β
| π§ | | |
|
|
192
|
-
| [repository-shorthand](docs/rules/repository-shorthand.md) | Enforce either object or shorthand declaration for repository. | βοΈ β
| π§ | | |
|
|
193
|
-
| [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. | | | π‘ | |
|
|
194
|
-
| [require-author](docs/rules/require-author.md) | Requires the `author` property to be present. |
|
|
195
|
-
| [require-bugs](docs/rules/require-bugs.md) | Requires the `bugs` property to be present. |
|
|
196
|
-
| [require-bundleDependencies](docs/rules/require-bundleDependencies.md) | Requires the `bundleDependencies` property to be present. |
|
|
197
|
-
| [require-dependencies](docs/rules/require-dependencies.md) | Requires the `dependencies` property to be present. |
|
|
198
|
-
| [require-description](docs/rules/require-description.md) | Requires the `description` property to be present. | βοΈ β
| | | |
|
|
199
|
-
| [require-devDependencies](docs/rules/require-devDependencies.md) | Requires the `devDependencies` property to be present. |
|
|
200
|
-
| [require-engines](docs/rules/require-engines.md) | Requires the `engines` property to be present. |
|
|
201
|
-
| [require-exports](docs/rules/require-exports.md) | Requires the `exports` property to be present. | | | | |
|
|
202
|
-
| [require-files](docs/rules/require-files.md) | Requires the `files` property to be present. | | | | |
|
|
203
|
-
| [require-keywords](docs/rules/require-keywords.md) | Requires the `keywords` property to be present. |
|
|
204
|
-
| [require-license](docs/rules/require-license.md) | Requires the `license` property to be present. | βοΈ β
| | | |
|
|
205
|
-
| [require-name](docs/rules/require-name.md) | Requires the `name` property to be present. | βοΈ β
| | | |
|
|
206
|
-
| [require-optionalDependencies](docs/rules/require-optionalDependencies.md) | Requires the `optionalDependencies` property to be present. |
|
|
207
|
-
| [require-peerDependencies](docs/rules/require-peerDependencies.md) | Requires the `peerDependencies` property to be present. |
|
|
208
|
-
| [require-sideEffects](docs/rules/require-sideEffects.md) | Requires the `sideEffects` property to be present. | | | | |
|
|
209
|
-
| [require-type](docs/rules/require-type.md) | Requires the `type` property to be present. | βοΈ β
| | | |
|
|
210
|
-
| [require-types](docs/rules/require-types.md) | Requires the `types` property to be present. |
|
|
211
|
-
| [require-version](docs/rules/require-version.md) | Requires the `version` property to be present. | βοΈ β
| | | |
|
|
212
|
-
| [restrict-dependency-ranges](docs/rules/restrict-dependency-ranges.md) | Restricts the range of dependencies to allow or disallow specific types of ranges. |
|
|
213
|
-
| [restrict-private-properties](docs/rules/restrict-private-properties.md) | Disallows unnecessary properties in private packages. |
|
|
214
|
-
| [scripts-name-casing](docs/rules/scripts-name-casing.md) | Enforce that names for `scripts` are in kebab case (optionally separated by colons). | π¨
|
|
215
|
-
| [sort-collections](docs/rules/sort-collections.md) | Selected collections must be in a consistent order (lexicographical for most; lifecycle-aware for scripts). | βοΈ β
| π§ | | |
|
|
216
|
-
| [specify-peers-locally](docs/rules/specify-peers-locally.md) | Requires that all peer dependencies are also declared as dev dependencies | βοΈ β
| | π‘ | |
|
|
217
|
-
| [unique-dependencies](docs/rules/unique-dependencies.md) | Checks a dependency isn't specified more than once (i.e. in `dependencies` and `devDependencies`) | βοΈ β
| | π‘ | |
|
|
218
|
-
| [valid-author](docs/rules/valid-author.md) | Enforce that the `author` property is valid. | βοΈ β
| | | |
|
|
219
|
-
| [valid-bin](docs/rules/valid-bin.md) | Enforce that the `bin` property is valid. | βοΈ β
| | | |
|
|
220
|
-
| [valid-bundleDependencies](docs/rules/valid-bundleDependencies.md) | Enforce that the `bundleDependencies` (also: `bundledDependencies`) property is valid. | βοΈ β
| | | |
|
|
221
|
-
| [valid-config](docs/rules/valid-config.md) | Enforce that the `config` property is valid. | βοΈ β
| | | |
|
|
222
|
-
| [valid-contributors](docs/rules/valid-contributors.md) | Enforce that the `contributors` property is valid. | βοΈ β
| | | |
|
|
223
|
-
| [valid-cpu](docs/rules/valid-cpu.md) | Enforce that the `cpu` property is valid. | βοΈ β
| | | |
|
|
224
|
-
| [valid-dependencies](docs/rules/valid-dependencies.md) | Enforce that the `dependencies` property is valid. | βοΈ β
| | | |
|
|
225
|
-
| [valid-description](docs/rules/valid-description.md) | Enforce that the `description` property is valid. | βοΈ β
| | | |
|
|
226
|
-
| [valid-devDependencies](docs/rules/valid-devDependencies.md) | Enforce that the `devDependencies` property is valid. | βοΈ β
| | | |
|
|
227
|
-
| [valid-directories](docs/rules/valid-directories.md) | Enforce that the `directories` property is valid. | βοΈ β
| | | |
|
|
228
|
-
| [valid-engines](docs/rules/valid-engines.md) | Enforce that the `engines` property is valid. | βοΈ β
| | | |
|
|
229
|
-
| [valid-exports](docs/rules/valid-exports.md) | Enforce that the `exports` property is valid. | βοΈ β
| | | |
|
|
230
|
-
| [valid-files](docs/rules/valid-files.md) | Enforce that the `files` property is valid. | βοΈ β
| | | |
|
|
231
|
-
| [valid-homepage](docs/rules/valid-homepage.md) | Enforce that the `homepage` property is valid. | βοΈ β
| | | |
|
|
232
|
-
| [valid-keywords](docs/rules/valid-keywords.md) | Enforce that the `keywords` property is valid. | βοΈ β
| | | |
|
|
233
|
-
| [valid-license](docs/rules/valid-license.md) | Enforce that the `license` property is valid. | βοΈ β
| | | |
|
|
234
|
-
| [valid-local-dependency](docs/rules/valid-local-dependency.md) | Checks existence of local dependencies in the package.json |
|
|
235
|
-
| [valid-main](docs/rules/valid-main.md) | Enforce that the `main` property is valid. | βοΈ β
| | | |
|
|
236
|
-
| [valid-man](docs/rules/valid-man.md) | Enforce that the `man` property is valid. | βοΈ β
| | | |
|
|
237
|
-
| [valid-name](docs/rules/valid-name.md) | Enforce that package names are valid npm package names | βοΈ β
| | | |
|
|
238
|
-
| [valid-optionalDependencies](docs/rules/valid-optionalDependencies.md) | Enforce that the `optionalDependencies` property is valid. | βοΈ β
| | | |
|
|
239
|
-
| [valid-os](docs/rules/valid-os.md) | Enforce that the `os` property is valid. | βοΈ β
| | | |
|
|
240
|
-
| [valid-package-definition](docs/rules/valid-package-definition.md) | Enforce that package.json has all properties required by the npm spec |
|
|
241
|
-
| [valid-peerDependencies](docs/rules/valid-peerDependencies.md) | Enforce that the `peerDependencies` property is valid. | βοΈ β
| | | |
|
|
242
|
-
| [valid-private](docs/rules/valid-private.md) | Enforce that the `private` property is valid. | βοΈ β
| | | |
|
|
243
|
-
| [valid-publishConfig](docs/rules/valid-publishConfig.md) | Enforce that the `publishConfig` property is valid. | βοΈ β
| | | |
|
|
244
|
-
| [valid-repository](docs/rules/valid-repository.md) | Enforce that the `repository` property is valid. | βοΈ β
| | | |
|
|
245
|
-
| [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 | βοΈ β
| | π‘ | |
|
|
246
|
-
| [valid-scripts](docs/rules/valid-scripts.md) | Enforce that the `scripts` property is valid. | βοΈ β
| | | |
|
|
247
|
-
| [valid-
|
|
248
|
-
| [valid-
|
|
249
|
-
| [valid-
|
|
199
|
+
| NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Description | πΌ | π§ | π‘ | β |
|
|
200
|
+
| :------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------ | :- | :- | :- |
|
|
201
|
+
| [bin-name-casing](docs/rules/bin-name-casing.md) | Enforce that names for bin properties are in kebab case. | π¨ | | π‘ | |
|
|
202
|
+
| [exports-subpaths-style](docs/rules/exports-subpaths-style.md) | Enforce consistent format for the exports field (implicit or explicit subpaths). | π¨ | π§ | | |
|
|
203
|
+
| [no-empty-fields](docs/rules/no-empty-fields.md) | Reports on unnecessary empty arrays and objects. | βοΈ β
π¦ | | π‘ | |
|
|
204
|
+
| [no-redundant-files](docs/rules/no-redundant-files.md) | Prevents adding unnecessary / redundant files. | βοΈ β
π¦ | | π‘ | |
|
|
205
|
+
| [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 | βοΈ β
π¦ | π§ | | |
|
|
207
|
+
| [repository-shorthand](docs/rules/repository-shorthand.md) | Enforce either object or shorthand declaration for repository. | βοΈ β
π¦ | π§ | | |
|
|
208
|
+
| [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
|
+
| [require-author](docs/rules/require-author.md) | Requires the `author` property to be present. | | | | |
|
|
210
|
+
| [require-bugs](docs/rules/require-bugs.md) | Requires the `bugs` property to be present. | | | | |
|
|
211
|
+
| [require-bundleDependencies](docs/rules/require-bundleDependencies.md) | Requires the `bundleDependencies` property to be present. | | | | |
|
|
212
|
+
| [require-dependencies](docs/rules/require-dependencies.md) | Requires the `dependencies` property to be present. | | | | |
|
|
213
|
+
| [require-description](docs/rules/require-description.md) | Requires the `description` property to be present. | βοΈ β
π¦ | | | |
|
|
214
|
+
| [require-devDependencies](docs/rules/require-devDependencies.md) | Requires the `devDependencies` property to be present. | | | | |
|
|
215
|
+
| [require-engines](docs/rules/require-engines.md) | Requires the `engines` property to be present. | | | | |
|
|
216
|
+
| [require-exports](docs/rules/require-exports.md) | Requires the `exports` property to be present. | π¦ | | | |
|
|
217
|
+
| [require-files](docs/rules/require-files.md) | Requires the `files` property to be present. | π¦ | | | |
|
|
218
|
+
| [require-keywords](docs/rules/require-keywords.md) | Requires the `keywords` property to be present. | | | | |
|
|
219
|
+
| [require-license](docs/rules/require-license.md) | Requires the `license` property to be present. | βοΈ β
π¦ | | | |
|
|
220
|
+
| [require-name](docs/rules/require-name.md) | Requires the `name` property to be present. | βοΈ β
π¦ | | | |
|
|
221
|
+
| [require-optionalDependencies](docs/rules/require-optionalDependencies.md) | Requires the `optionalDependencies` property to be present. | | | | |
|
|
222
|
+
| [require-peerDependencies](docs/rules/require-peerDependencies.md) | Requires the `peerDependencies` property to be present. | | | | |
|
|
223
|
+
| [require-sideEffects](docs/rules/require-sideEffects.md) | Requires the `sideEffects` property to be present. | π¦ | | | |
|
|
224
|
+
| [require-type](docs/rules/require-type.md) | Requires the `type` property to be present. | βοΈ β
π¦ | | | |
|
|
225
|
+
| [require-types](docs/rules/require-types.md) | Requires the `types` property to be present. | | | | |
|
|
226
|
+
| [require-version](docs/rules/require-version.md) | Requires the `version` property to be present. | βοΈ β
π¦ | | | |
|
|
227
|
+
| [restrict-dependency-ranges](docs/rules/restrict-dependency-ranges.md) | Restricts the range of dependencies to allow or disallow specific types of ranges. | | | π‘ | |
|
|
228
|
+
| [restrict-private-properties](docs/rules/restrict-private-properties.md) | Disallows unnecessary properties in private packages. | | π§ | π‘ | |
|
|
229
|
+
| [scripts-name-casing](docs/rules/scripts-name-casing.md) | Enforce that names for `scripts` are in kebab case (optionally separated by colons). | π¨ | | π‘ | |
|
|
230
|
+
| [sort-collections](docs/rules/sort-collections.md) | Selected collections must be in a consistent order (lexicographical for most; lifecycle-aware for scripts). | βοΈ β
π¦ | π§ | | |
|
|
231
|
+
| [specify-peers-locally](docs/rules/specify-peers-locally.md) | Requires that all peer dependencies are also declared as dev dependencies | βοΈ β
π¦ | | π‘ | |
|
|
232
|
+
| [unique-dependencies](docs/rules/unique-dependencies.md) | Checks a dependency isn't specified more than once (i.e. in `dependencies` and `devDependencies`) | βοΈ β
π¦ | | π‘ | |
|
|
233
|
+
| [valid-author](docs/rules/valid-author.md) | Enforce that the `author` property is valid. | βοΈ β
π¦ | | | |
|
|
234
|
+
| [valid-bin](docs/rules/valid-bin.md) | Enforce that the `bin` property is valid. | βοΈ β
π¦ | | | |
|
|
235
|
+
| [valid-bundleDependencies](docs/rules/valid-bundleDependencies.md) | Enforce that the `bundleDependencies` (also: `bundledDependencies`) property is valid. | βοΈ β
π¦ | | | |
|
|
236
|
+
| [valid-config](docs/rules/valid-config.md) | Enforce that the `config` property is valid. | βοΈ β
π¦ | | | |
|
|
237
|
+
| [valid-contributors](docs/rules/valid-contributors.md) | Enforce that the `contributors` property is valid. | βοΈ β
π¦ | | | |
|
|
238
|
+
| [valid-cpu](docs/rules/valid-cpu.md) | Enforce that the `cpu` property is valid. | βοΈ β
π¦ | | | |
|
|
239
|
+
| [valid-dependencies](docs/rules/valid-dependencies.md) | Enforce that the `dependencies` property is valid. | βοΈ β
π¦ | | | |
|
|
240
|
+
| [valid-description](docs/rules/valid-description.md) | Enforce that the `description` property is valid. | βοΈ β
π¦ | | | |
|
|
241
|
+
| [valid-devDependencies](docs/rules/valid-devDependencies.md) | Enforce that the `devDependencies` property is valid. | βοΈ β
π¦ | | | |
|
|
242
|
+
| [valid-directories](docs/rules/valid-directories.md) | Enforce that the `directories` property is valid. | βοΈ β
π¦ | | | |
|
|
243
|
+
| [valid-engines](docs/rules/valid-engines.md) | Enforce that the `engines` property is valid. | βοΈ β
π¦ | | | |
|
|
244
|
+
| [valid-exports](docs/rules/valid-exports.md) | Enforce that the `exports` property is valid. | βοΈ β
π¦ | | | |
|
|
245
|
+
| [valid-files](docs/rules/valid-files.md) | Enforce that the `files` property is valid. | βοΈ β
π¦ | | | |
|
|
246
|
+
| [valid-homepage](docs/rules/valid-homepage.md) | Enforce that the `homepage` property is valid. | βοΈ β
π¦ | | | |
|
|
247
|
+
| [valid-keywords](docs/rules/valid-keywords.md) | Enforce that the `keywords` property is valid. | βοΈ β
π¦ | | | |
|
|
248
|
+
| [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
|
+
| [valid-main](docs/rules/valid-main.md) | Enforce that the `main` property is valid. | βοΈ β
π¦ | | | |
|
|
251
|
+
| [valid-man](docs/rules/valid-man.md) | Enforce that the `man` property is valid. | βοΈ β
π¦ | | | |
|
|
252
|
+
| [valid-name](docs/rules/valid-name.md) | Enforce that package names are valid npm package names | βοΈ β
π¦ | | | |
|
|
253
|
+
| [valid-optionalDependencies](docs/rules/valid-optionalDependencies.md) | Enforce that the `optionalDependencies` property is valid. | βοΈ β
π¦ | | | |
|
|
254
|
+
| [valid-os](docs/rules/valid-os.md) | Enforce that the `os` property is valid. | βοΈ β
π¦ | | | |
|
|
255
|
+
| [valid-package-definition](docs/rules/valid-package-definition.md) | Enforce that package.json has all properties required by the npm spec | | | | β |
|
|
256
|
+
| [valid-peerDependencies](docs/rules/valid-peerDependencies.md) | Enforce that the `peerDependencies` property is valid. | βοΈ β
π¦ | | | |
|
|
257
|
+
| [valid-private](docs/rules/valid-private.md) | Enforce that the `private` property is valid. | βοΈ β
π¦ | | | |
|
|
258
|
+
| [valid-publishConfig](docs/rules/valid-publishConfig.md) | Enforce that the `publishConfig` property is valid. | βοΈ β
π¦ | | | |
|
|
259
|
+
| [valid-repository](docs/rules/valid-repository.md) | Enforce that the `repository` property is valid. | βοΈ β
π¦ | | | |
|
|
260
|
+
| [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
|
+
| [valid-scripts](docs/rules/valid-scripts.md) | Enforce that the `scripts` property is valid. | βοΈ β
π¦ | | | |
|
|
262
|
+
| [valid-sideEffects](docs/rules/valid-sideEffects.md) | Enforce that the `sideEffects` property is valid. | βοΈ β
π¦ | | | |
|
|
263
|
+
| [valid-type](docs/rules/valid-type.md) | Enforce that the `type` property is valid. | βοΈ β
π¦ | | | |
|
|
264
|
+
| [valid-version](docs/rules/valid-version.md) | Enforce that package versions are valid semver specifiers | βοΈ β
π¦ | | | |
|
|
265
|
+
| [valid-workspaces](docs/rules/valid-workspaces.md) | Enforce that the `workspaces` property is valid. | βοΈ β
π¦ | | | |
|
|
250
266
|
|
|
251
267
|
<!-- end auto-generated rules list -->
|
|
252
268
|
<!-- prettier-ignore-end -->
|
package/lib/index.d.mts
CHANGED
|
@@ -26,6 +26,19 @@ declare const configs: {
|
|
|
26
26
|
[k: string]: "error";
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
+
"recommended-publishable": {
|
|
30
|
+
files: string[];
|
|
31
|
+
languageOptions: {
|
|
32
|
+
parser: typeof jsonc_eslint_parser0;
|
|
33
|
+
};
|
|
34
|
+
name: string;
|
|
35
|
+
plugins: {
|
|
36
|
+
readonly "package-json": eslint0.ESLint.Plugin;
|
|
37
|
+
};
|
|
38
|
+
rules: {
|
|
39
|
+
[x: string]: "error";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
29
42
|
stylistic: {
|
|
30
43
|
files: string[];
|
|
31
44
|
languageOptions: {
|
package/lib/plugin.d.mts
CHANGED
|
@@ -26,6 +26,19 @@ declare const plugin: {
|
|
|
26
26
|
[k: string]: "error";
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
+
"recommended-publishable": {
|
|
30
|
+
files: string[];
|
|
31
|
+
languageOptions: {
|
|
32
|
+
parser: typeof parserJsonc;
|
|
33
|
+
};
|
|
34
|
+
name: string;
|
|
35
|
+
plugins: {
|
|
36
|
+
readonly "package-json": ESLint.Plugin;
|
|
37
|
+
};
|
|
38
|
+
rules: {
|
|
39
|
+
[x: string]: "error";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
29
42
|
stylistic: {
|
|
30
43
|
files: string[];
|
|
31
44
|
languageOptions: {
|
package/lib/plugin.mjs
CHANGED
|
@@ -48,6 +48,10 @@ const rules$2 = {
|
|
|
48
48
|
"valid-version": rule$18
|
|
49
49
|
};
|
|
50
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"])) };
|
|
51
|
+
const recommendedPublishableRules = {
|
|
52
|
+
...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"]))
|
|
54
|
+
};
|
|
51
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"])) };
|
|
52
56
|
const plugin = {
|
|
53
57
|
configs: {
|
|
@@ -64,6 +68,15 @@ const plugin = {
|
|
|
64
68
|
} },
|
|
65
69
|
rules: recommendedRules
|
|
66
70
|
},
|
|
71
|
+
"recommended-publishable": {
|
|
72
|
+
files: ["**/package.json"],
|
|
73
|
+
languageOptions: { parser: parserJsonc },
|
|
74
|
+
name: "package-json/recommended-publishable",
|
|
75
|
+
plugins: { get "package-json"() {
|
|
76
|
+
return plugin;
|
|
77
|
+
} },
|
|
78
|
+
rules: recommendedPublishableRules
|
|
79
|
+
},
|
|
67
80
|
stylistic: {
|
|
68
81
|
files: ["**/package.json"],
|
|
69
82
|
languageOptions: { parser: parserJsonc },
|
|
@@ -9,8 +9,8 @@ const properties = [
|
|
|
9
9
|
["description", { isRecommended: true }],
|
|
10
10
|
["devDependencies"],
|
|
11
11
|
["engines"],
|
|
12
|
-
["exports"],
|
|
13
|
-
["files"],
|
|
12
|
+
["exports", { category: "Publishable" }],
|
|
13
|
+
["files", { category: "Publishable" }],
|
|
14
14
|
["keywords"],
|
|
15
15
|
["license", {
|
|
16
16
|
ignorePrivateDefault: true,
|
|
@@ -22,7 +22,7 @@ const properties = [
|
|
|
22
22
|
}],
|
|
23
23
|
["optionalDependencies"],
|
|
24
24
|
["peerDependencies"],
|
|
25
|
-
["sideEffects"],
|
|
25
|
+
["sideEffects", { category: "Publishable" }],
|
|
26
26
|
["type", { isRecommended: true }],
|
|
27
27
|
["types"],
|
|
28
28
|
["version", {
|
|
@@ -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 = [
|
|
@@ -31,6 +31,7 @@ const properties = [
|
|
|
31
31
|
["publishConfig", validatePublishConfig],
|
|
32
32
|
["repository", validateRepository],
|
|
33
33
|
["scripts", validateScripts],
|
|
34
|
+
["sideEffects", validateSideEffects],
|
|
34
35
|
["type", validateType],
|
|
35
36
|
["workspaces", validateWorkspaces]
|
|
36
37
|
];
|
|
@@ -2,6 +2,10 @@ import { PackageJsonRuleModule } from "../createRule.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/utils/createSimpleRequirePropertyRule.d.ts
|
|
4
4
|
interface CreateRequirePropertyRuleOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The category for this rule.
|
|
7
|
+
*/
|
|
8
|
+
category?: string;
|
|
5
9
|
/**
|
|
6
10
|
* The default value of `ignorePrivate` rule option.
|
|
7
11
|
*/
|
|
@@ -18,6 +22,7 @@ interface CreateRequirePropertyRuleOptions {
|
|
|
18
22
|
* to create a more complex rule, create it in its own file.
|
|
19
23
|
*/
|
|
20
24
|
declare const createSimpleRequirePropertyRule: (propertyName: string, {
|
|
25
|
+
category,
|
|
21
26
|
ignorePrivateDefault,
|
|
22
27
|
isRecommended
|
|
23
28
|
}?: CreateRequirePropertyRuleOptions) => {
|
|
@@ -8,7 +8,7 @@ import { isJSONStringLiteral } from "./predicates.mjs";
|
|
|
8
8
|
* Note: this will only create a basic require rule, with no options. If you need
|
|
9
9
|
* to create a more complex rule, create it in its own file.
|
|
10
10
|
*/
|
|
11
|
-
const createSimpleRequirePropertyRule = (propertyName, { ignorePrivateDefault = false, isRecommended } = {}) => {
|
|
11
|
+
const createSimpleRequirePropertyRule = (propertyName, { category, ignorePrivateDefault = false, isRecommended } = {}) => {
|
|
12
12
|
const ruleName = `require-${propertyName}`;
|
|
13
13
|
return {
|
|
14
14
|
rule: createRule({
|
|
@@ -26,6 +26,7 @@ const createSimpleRequirePropertyRule = (propertyName, { ignorePrivateDefault =
|
|
|
26
26
|
},
|
|
27
27
|
meta: {
|
|
28
28
|
docs: {
|
|
29
|
+
category,
|
|
29
30
|
description: `Requires the \`${propertyName}\` property to be present.`,
|
|
30
31
|
recommended: isRecommended
|
|
31
32
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-package-json",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.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": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"url": "https://michael.faith"
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
|
+
"sideEffects": false,
|
|
30
31
|
"type": "module",
|
|
31
32
|
"exports": {
|
|
32
33
|
".": {
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"detect-indent": "^7.0.2",
|
|
61
62
|
"detect-newline": "^4.0.1",
|
|
62
63
|
"eslint-fix-utils": "~0.4.0",
|
|
63
|
-
"package-json-validator": "~0.
|
|
64
|
+
"package-json-validator": "~0.59.0",
|
|
64
65
|
"semver": "^7.7.3",
|
|
65
66
|
"sort-object-keys": "^2.0.0",
|
|
66
67
|
"sort-package-json": "^3.4.0",
|
|
@@ -90,7 +91,7 @@
|
|
|
90
91
|
"jiti": "2.6.0",
|
|
91
92
|
"json-schema-to-ts": "3.1.1",
|
|
92
93
|
"jsonc-eslint-parser": "2.4.1",
|
|
93
|
-
"knip": "5.
|
|
94
|
+
"knip": "5.69.0",
|
|
94
95
|
"lint-staged": "16.2.0",
|
|
95
96
|
"markdownlint": "0.39.0",
|
|
96
97
|
"markdownlint-cli": "0.45.0",
|