eslint-plugin-package-json 0.38.0 → 0.39.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
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
# [0.
|
|
3
|
+
# [0.39.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.38.1...v0.39.0) (2025-06-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* deprecate `valid-local-dependency` ([#1107](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1107)) ([4efea70](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/4efea705124a31a35ba9e10e3bb0ef79bf442fab)), closes [#1096](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1096)
|
|
4
9
|
|
|
10
|
+
## [0.38.1](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.38.0...v0.38.1) (2025-06-13)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **valid-local-dependency:** don't flag archives as invalid ([#1109](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1109)) ([3d89865](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/3d89865bba6e3ecab02576cde131336a7dc8c169)), closes [#1086](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1086)
|
|
15
|
+
|
|
16
|
+
# [0.38.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.37.0...v0.38.0) (2025-06-13)
|
|
5
17
|
|
|
6
18
|
### Features
|
|
7
19
|
|
|
8
|
-
|
|
20
|
+
- add `valid-author` rule ([#1079](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/1079)) ([b8e8b40](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/commit/b8e8b40065a0aa0bfa9e38697ab5fe3241b7d6d7)), closes [#840](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/840)
|
|
9
21
|
|
|
10
22
|
# [0.37.0](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.36.0...v0.37.0) (2025-06-12)
|
|
11
23
|
|
package/README.md
CHANGED
|
@@ -139,7 +139,7 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
|
|
|
139
139
|
| [unique-dependencies](docs/rules/unique-dependencies.md) | Checks a dependency isn't specified more than once (i.e. in `dependencies` and `devDependencies`) | ✔️ ✅ | | 💡 | |
|
|
140
140
|
| [valid-author](docs/rules/valid-author.md) | Enforce that the author field is a valid npm author specification | ✔️ ✅ | | | |
|
|
141
141
|
| [valid-bin](docs/rules/valid-bin.md) | Enforce that the `bin` property is valid. | ✔️ ✅ | | | |
|
|
142
|
-
| [valid-local-dependency](docs/rules/valid-local-dependency.md) | Checks existence of local dependencies in the package.json |
|
|
142
|
+
| [valid-local-dependency](docs/rules/valid-local-dependency.md) | Checks existence of local dependencies in the package.json | | | | ❌ |
|
|
143
143
|
| [valid-name](docs/rules/valid-name.md) | Enforce that package names are valid npm package names | ✔️ ✅ | | | |
|
|
144
144
|
| [valid-package-def](docs/rules/valid-package-def.md) | Enforce that package.json has all properties required by the npm spec | | | | ❌ |
|
|
145
145
|
| [valid-package-definition](docs/rules/valid-package-definition.md) | Enforce that package.json has all properties required by the npm spec | ✔️ ✅ | | | |
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { validateAuthor } from "package-json-validator";
|
|
2
2
|
import { createRule } from "../createRule.js";
|
|
3
|
+
import { formatErrors } from "../utils/formatErrors.js";
|
|
3
4
|
const rule = createRule({
|
|
4
5
|
create(context) {
|
|
5
6
|
return {
|
|
@@ -11,11 +12,9 @@ const rule = createRule({
|
|
|
11
12
|
);
|
|
12
13
|
const errors = validateAuthor(authorValue);
|
|
13
14
|
if (errors.length > 0) {
|
|
14
|
-
const complaints = errors.length === 1 ? errors[0] : `
|
|
15
|
-
- ${errors.join("\n - ")}`;
|
|
16
15
|
context.report({
|
|
17
16
|
data: {
|
|
18
|
-
|
|
17
|
+
errors: formatErrors(errors)
|
|
19
18
|
},
|
|
20
19
|
messageId: "invalid",
|
|
21
20
|
node: node.value
|
|
@@ -31,7 +30,7 @@ const rule = createRule({
|
|
|
31
30
|
recommended: true
|
|
32
31
|
},
|
|
33
32
|
messages: {
|
|
34
|
-
invalid: "Invalid author: {{
|
|
33
|
+
invalid: "Invalid author: {{ errors }}"
|
|
35
34
|
},
|
|
36
35
|
schema: [],
|
|
37
36
|
type: "problem"
|
package/lib/rules/valid-bin.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { validateBin } from "package-json-validator";
|
|
2
2
|
import { createRule } from "../createRule.js";
|
|
3
|
+
import { formatErrors } from "../utils/formatErrors.js";
|
|
3
4
|
const rule = createRule({
|
|
4
5
|
create(context) {
|
|
5
6
|
return {
|
|
@@ -14,7 +15,7 @@ const rule = createRule({
|
|
|
14
15
|
}
|
|
15
16
|
context.report({
|
|
16
17
|
data: {
|
|
17
|
-
errors: errors
|
|
18
|
+
errors: formatErrors(errors)
|
|
18
19
|
},
|
|
19
20
|
messageId: "validationError",
|
|
20
21
|
node: binValueNode
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { createRule } from "../createRule.js";
|
|
3
|
+
const fileRegex = /^file:/;
|
|
4
|
+
const linkRegex = /^link:/;
|
|
3
5
|
const rule = createRule({
|
|
4
6
|
create(context) {
|
|
5
7
|
return {
|
|
@@ -13,11 +15,10 @@ const rule = createRule({
|
|
|
13
15
|
];
|
|
14
16
|
for (const obj of depObjs) {
|
|
15
17
|
for (const [key, value] of obj) {
|
|
16
|
-
const response = (
|
|
18
|
+
const response = (pathToken) => {
|
|
17
19
|
const filePath = path.join(
|
|
18
|
-
context.filename.replace(
|
|
19
|
-
value.replace(
|
|
20
|
-
"/package.json"
|
|
20
|
+
context.filename.replace("package.json", ""),
|
|
21
|
+
value.replace(pathToken, "")
|
|
21
22
|
);
|
|
22
23
|
try {
|
|
23
24
|
require.resolve(filePath);
|
|
@@ -33,10 +34,10 @@ const rule = createRule({
|
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
if (value.startsWith("link:")) {
|
|
36
|
-
response(
|
|
37
|
+
response(linkRegex);
|
|
37
38
|
}
|
|
38
39
|
if (value.startsWith("file:")) {
|
|
39
|
-
response(
|
|
40
|
+
response(fileRegex);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
}
|
|
@@ -44,10 +45,10 @@ const rule = createRule({
|
|
|
44
45
|
};
|
|
45
46
|
},
|
|
46
47
|
meta: {
|
|
48
|
+
deprecated: true,
|
|
47
49
|
docs: {
|
|
48
50
|
category: "Best Practices",
|
|
49
|
-
description: "Checks existence of local dependencies in the package.json"
|
|
50
|
-
recommended: true
|
|
51
|
+
description: "Checks existence of local dependencies in the package.json"
|
|
51
52
|
},
|
|
52
53
|
messages: {
|
|
53
54
|
invalidPath: "The package {{package}} does not exist given the specified path: {{path}}."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-package-json",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.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": {
|