eslint-plugin-package-json 0.60.0 → 0.61.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 +8 -2
- package/README.md +22 -5
- package/lib/index.d.ts +13 -0
- package/lib/plugin.d.ts +13 -0
- package/lib/plugin.js +10 -0
- package/lib/rules/exports-subpaths-style.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
# [0.
|
|
3
|
+
# [0.61.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.60.0...v0.61.0) (2025-11-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add new stylistic config ([#1342](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1342)) ([3d01cce](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/3d01cce99a1718a7485669c7b8cf6143a255b094)), closes [#1341](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1341)
|
|
4
9
|
|
|
10
|
+
# [0.60.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.59.1...v0.60.0) (2025-11-03)
|
|
5
11
|
|
|
6
12
|
### Features
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
- **valid-author:** create more precise reports ([#1337](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1337)) ([e79ff9a](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/e79ff9ac602d85bf999686b018de6ace3a7bee36)), closes [#000](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/000)
|
|
9
15
|
|
|
10
16
|
## [0.59.1](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.59.0...v0.59.1) (2025-10-30)
|
|
11
17
|
|
package/README.md
CHANGED
|
@@ -28,13 +28,12 @@ npm install eslint eslint-plugin-package-json --save-dev
|
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
31
|
-
### Config
|
|
31
|
+
### Recommended Config
|
|
32
32
|
|
|
33
33
|
This plugin's recommended configuration enables its rules on `**/package.json` files, parsing them with [`jsonc-eslint-parser`](https://github.com/ota-meshi/jsonc-eslint-parser).
|
|
34
34
|
|
|
35
|
-
In your ESLint configuration file:
|
|
36
|
-
|
|
37
35
|
```ts
|
|
36
|
+
// eslint.config.ts
|
|
38
37
|
import packageJson from "eslint-plugin-package-json";
|
|
39
38
|
|
|
40
39
|
export default [
|
|
@@ -46,6 +45,7 @@ export default [
|
|
|
46
45
|
If you want to override the recommended rules:
|
|
47
46
|
|
|
48
47
|
```ts
|
|
48
|
+
// eslint.config.ts
|
|
49
49
|
import packageJson from "eslint-plugin-package-json";
|
|
50
50
|
|
|
51
51
|
export default [
|
|
@@ -61,7 +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
|
-
###
|
|
64
|
+
### Stylistic Config
|
|
65
|
+
|
|
66
|
+
The stylistic configuration enables 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
|
+
This can be used in addition to the recommended config, or on its own.
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
// eslint.config.ts
|
|
71
|
+
import packageJson from "eslint-plugin-package-json";
|
|
72
|
+
|
|
73
|
+
export default [
|
|
74
|
+
// your other ESLint configurations
|
|
75
|
+
packageJson.configs.recommended,
|
|
76
|
+
packageJson.configs.stylistic,
|
|
77
|
+
];
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Legacy Recommended Config (deprecated)
|
|
65
81
|
|
|
66
82
|
Usage with ESLint's legacy ("eslintrc") format requires also installing [`jsonc-eslint-parser`](https://github.com/ota-meshi/jsonc-eslint-parser):
|
|
67
83
|
|
|
@@ -160,13 +176,14 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
|
|
|
160
176
|
💼 Configurations enabled in.\
|
|
161
177
|
✔️ Set in the `legacy-recommended` configuration.\
|
|
162
178
|
✅ Set in the `recommended` configuration.\
|
|
179
|
+
🎨 Set in the `stylistic` configuration.\
|
|
163
180
|
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
|
|
164
181
|
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).\
|
|
165
182
|
❌ Deprecated.
|
|
166
183
|
|
|
167
184
|
| Name | Description | 💼 | 🔧 | 💡 | ❌ |
|
|
168
185
|
| :------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------- | :--- | :- | :- | :- |
|
|
169
|
-
| [exports-subpaths-style](docs/rules/exports-subpaths-style.md) | Enforce consistent format for the exports field (implicit or explicit subpaths). |
|
|
186
|
+
| [exports-subpaths-style](docs/rules/exports-subpaths-style.md) | Enforce consistent format for the exports field (implicit or explicit subpaths). | 🎨 | 🔧 | | |
|
|
170
187
|
| [no-empty-fields](docs/rules/no-empty-fields.md) | Reports on unnecessary empty arrays and objects. | ✔️ ✅ | | 💡 | |
|
|
171
188
|
| [no-redundant-files](docs/rules/no-redundant-files.md) | Prevents adding unnecessary / redundant files. | ✔️ ✅ | | 💡 | |
|
|
172
189
|
| [order-properties](docs/rules/order-properties.md) | Package properties must be declared in standard order | ✔️ ✅ | 🔧 | | |
|
package/lib/index.d.ts
CHANGED
|
@@ -30,6 +30,19 @@ declare const configs: {
|
|
|
30
30
|
}];
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
+
stylistic: {
|
|
34
|
+
files: string[];
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parser: typeof jsonc_eslint_parser0;
|
|
37
|
+
};
|
|
38
|
+
name: string;
|
|
39
|
+
plugins: {
|
|
40
|
+
readonly "package-json": eslint0.ESLint.Plugin;
|
|
41
|
+
};
|
|
42
|
+
rules: {
|
|
43
|
+
[k: string]: "error";
|
|
44
|
+
};
|
|
45
|
+
};
|
|
33
46
|
};
|
|
34
47
|
//#endregion
|
|
35
48
|
export { type PackageJsonPluginSettings, configs, plugin as default, rules };
|
package/lib/plugin.d.ts
CHANGED
|
@@ -30,6 +30,19 @@ declare const plugin: {
|
|
|
30
30
|
}];
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
+
stylistic: {
|
|
34
|
+
files: string[];
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parser: typeof parserJsonc;
|
|
37
|
+
};
|
|
38
|
+
name: string;
|
|
39
|
+
plugins: {
|
|
40
|
+
readonly "package-json": ESLint.Plugin;
|
|
41
|
+
};
|
|
42
|
+
rules: {
|
|
43
|
+
[k: string]: "error";
|
|
44
|
+
};
|
|
45
|
+
};
|
|
33
46
|
};
|
|
34
47
|
meta: {
|
|
35
48
|
name: string;
|
package/lib/plugin.js
CHANGED
|
@@ -44,6 +44,7 @@ const recommendedRules = {
|
|
|
44
44
|
...baseRecommendedRules,
|
|
45
45
|
"package-json/valid-package-definition": ["error", { ignoreProperties: Object.entries(baseRecommendedRules).filter(([name$1]) => name$1.startsWith("package-json/valid-") && name$1 !== "package-json/valid-package-definition").map(([name$1]) => name$1.replace("package-json/valid-", "")) }]
|
|
46
46
|
};
|
|
47
|
+
const stylisticRules = { ...Object.fromEntries(Object.entries(rules$2).filter(([, rule$15]) => rule$15.meta.docs?.category === "Stylistic").map(([name$1]) => ["package-json/" + name$1, "error"])) };
|
|
47
48
|
const plugin = {
|
|
48
49
|
configs: {
|
|
49
50
|
"legacy-recommended": {
|
|
@@ -58,6 +59,15 @@ const plugin = {
|
|
|
58
59
|
return plugin;
|
|
59
60
|
} },
|
|
60
61
|
rules: recommendedRules
|
|
62
|
+
},
|
|
63
|
+
stylistic: {
|
|
64
|
+
files: ["**/package.json"],
|
|
65
|
+
languageOptions: { parser: parserJsonc },
|
|
66
|
+
name: "package-json/stylistic",
|
|
67
|
+
plugins: { get "package-json"() {
|
|
68
|
+
return plugin;
|
|
69
|
+
} },
|
|
70
|
+
rules: stylisticRules
|
|
61
71
|
}
|
|
62
72
|
},
|
|
63
73
|
meta: {
|
|
@@ -46,7 +46,7 @@ const rule = createRule({
|
|
|
46
46
|
meta: {
|
|
47
47
|
defaultOptions: [{ prefer: "explicit" }],
|
|
48
48
|
docs: {
|
|
49
|
-
category: "
|
|
49
|
+
category: "Stylistic",
|
|
50
50
|
description: "Enforce consistent format for the exports field (implicit or explicit subpaths).",
|
|
51
51
|
recommended: false
|
|
52
52
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-package-json",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.61.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": {
|