eslint-plugin-package-json 0.89.4 → 0.90.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 +15 -0
- package/README.md +3 -0
- package/lib/createRule.mjs +1 -3
- package/lib/index.d.mts +4 -4
- package/lib/index.mjs +1 -3
- package/lib/plugin.mjs +1 -3
- package/lib/rules/bin-name-casing.mjs +1 -3
- package/lib/rules/exports-subpaths-style.mjs +1 -3
- package/lib/rules/no-empty-fields.mjs +1 -3
- package/lib/rules/no-redundant-files.mjs +1 -3
- package/lib/rules/no-redundant-publishConfig.mjs +1 -3
- package/lib/rules/order-properties.mjs +1 -3
- package/lib/rules/repository-shorthand.mjs +1 -3
- package/lib/rules/require-attribution.mjs +1 -3
- package/lib/rules/require-properties.mjs +1 -3
- package/lib/rules/restrict-dependency-ranges.mjs +1 -3
- package/lib/rules/restrict-private-properties.mjs +1 -3
- package/lib/rules/scripts-name-casing.mjs +1 -3
- package/lib/rules/sort-collections.mjs +1 -3
- package/lib/rules/specify-peers-locally.mjs +1 -3
- package/lib/rules/unique-dependencies.mjs +1 -3
- package/lib/rules/valid-name.mjs +1 -3
- package/lib/rules/valid-package-definition.mjs +1 -3
- package/lib/rules/valid-properties.mjs +5 -4
- package/lib/rules/valid-repository-directory.mjs +1 -3
- package/lib/rules/valid-version.mjs +1 -3
- package/lib/utils/createSimpleRequirePropertyRule.mjs +1 -3
- package/lib/utils/createSimpleValidPropertyRule.mjs +1 -3
- package/lib/utils/findPropertyWithKeyValue.mjs +1 -2
- package/lib/utils/formatErrors.mjs +1 -2
- package/lib/utils/isPackageJson.mjs +1 -2
- package/lib/utils/predicates.mjs +1 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.90.0](https://github.com/michaelfaith/eslint-plugin-package-json/compare/v0.89.4...v0.90.0) (2026-03-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* add `valid-funding` rule ([#1643](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1643))
|
|
9
|
+
* add `valid-bugs` rule ([#1644](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1644))
|
|
10
|
+
* add `valid-packageManager` rule ([#1640](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1640))
|
|
11
|
+
|
|
12
|
+
### 🚀 Features
|
|
13
|
+
|
|
14
|
+
* add `valid-bugs` rule ([#1644](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1644)) ([f981fa3](https://github.com/michaelfaith/eslint-plugin-package-json/commit/f981fa38ab4f1630c6db0933d859974d0a6ec0b3))
|
|
15
|
+
* add `valid-funding` rule ([#1643](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1643)) ([5b3c77d](https://github.com/michaelfaith/eslint-plugin-package-json/commit/5b3c77da9b8edcd659a1fd9b3e51d1e43803aa5e))
|
|
16
|
+
* add `valid-packageManager` rule ([#1640](https://github.com/michaelfaith/eslint-plugin-package-json/issues/1640)) ([9a65480](https://github.com/michaelfaith/eslint-plugin-package-json/commit/9a65480cb55a4d03043916def549cfd7fc4b604b))
|
|
17
|
+
|
|
3
18
|
## [0.89.4](https://github.com/michaelfaith/eslint-plugin-package-json/compare/v0.89.3...v0.89.4) (2026-03-07)
|
|
4
19
|
|
|
5
20
|
|
package/README.md
CHANGED
|
@@ -250,6 +250,7 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
|
|
|
250
250
|
| [unique-dependencies](docs/rules/unique-dependencies.md) | Checks a dependency isn't specified more than once (i.e. in `dependencies` and `devDependencies`) | ✔️ ✅ 📦 | | 💡 | |
|
|
251
251
|
| [valid-author](docs/rules/valid-author.md) | Enforce that the `author` property is valid. | ✔️ ✅ 📦 | | | |
|
|
252
252
|
| [valid-bin](docs/rules/valid-bin.md) | Enforce that the `bin` property is valid. | ✔️ ✅ 📦 | | | |
|
|
253
|
+
| [valid-bugs](docs/rules/valid-bugs.md) | Enforce that the `bugs` property is valid. | ✔️ ✅ 📦 | | | |
|
|
253
254
|
| [valid-bundleDependencies](docs/rules/valid-bundleDependencies.md) | Enforce that the `bundleDependencies` (also: `bundledDependencies`) property is valid. | ✔️ ✅ 📦 | | | |
|
|
254
255
|
| [valid-config](docs/rules/valid-config.md) | Enforce that the `config` property is valid. | ✔️ ✅ 📦 | | | |
|
|
255
256
|
| [valid-contributors](docs/rules/valid-contributors.md) | Enforce that the `contributors` property is valid. | ✔️ ✅ 📦 | | | |
|
|
@@ -261,6 +262,7 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
|
|
|
261
262
|
| [valid-engines](docs/rules/valid-engines.md) | Enforce that the `engines` property is valid. | ✔️ ✅ 📦 | | | |
|
|
262
263
|
| [valid-exports](docs/rules/valid-exports.md) | Enforce that the `exports` property is valid. | ✔️ ✅ 📦 | | | |
|
|
263
264
|
| [valid-files](docs/rules/valid-files.md) | Enforce that the `files` property is valid. | ✔️ ✅ 📦 | | | |
|
|
265
|
+
| [valid-funding](docs/rules/valid-funding.md) | Enforce that the `funding` property is valid. | ✔️ ✅ 📦 | | | |
|
|
264
266
|
| [valid-homepage](docs/rules/valid-homepage.md) | Enforce that the `homepage` property is valid. | ✔️ ✅ 📦 | | | |
|
|
265
267
|
| [valid-keywords](docs/rules/valid-keywords.md) | Enforce that the `keywords` property is valid. | ✔️ ✅ 📦 | | | |
|
|
266
268
|
| [valid-license](docs/rules/valid-license.md) | Enforce that the `license` property is valid. | ✔️ ✅ 📦 | | | |
|
|
@@ -271,6 +273,7 @@ The default settings don't conflict, and Prettier plugins can quickly fix up ord
|
|
|
271
273
|
| [valid-optionalDependencies](docs/rules/valid-optionalDependencies.md) | Enforce that the `optionalDependencies` property is valid. | ✔️ ✅ 📦 | | | |
|
|
272
274
|
| [valid-os](docs/rules/valid-os.md) | Enforce that the `os` property is valid. | ✔️ ✅ 📦 | | | |
|
|
273
275
|
| [valid-package-definition](docs/rules/valid-package-definition.md) | Enforce that package.json has all properties required by the npm spec | | | | ❌ |
|
|
276
|
+
| [valid-packageManager](docs/rules/valid-packageManager.md) | Enforce that the `packageManager` property is valid. | ✔️ ✅ 📦 | | | |
|
|
274
277
|
| [valid-peerDependencies](docs/rules/valid-peerDependencies.md) | Enforce that the `peerDependencies` property is valid. | ✔️ ✅ 📦 | | | |
|
|
275
278
|
| [valid-private](docs/rules/valid-private.md) | Enforce that the `private` property is valid. | ✔️ ✅ 📦 | | | |
|
|
276
279
|
| [valid-publishConfig](docs/rules/valid-publishConfig.md) | Enforce that the `publishConfig` property is valid. | ✔️ ✅ 📦 | | | |
|
package/lib/createRule.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isPackageJson } from "./utils/isPackageJson.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/createRule.ts
|
|
4
3
|
/**
|
|
5
4
|
* Rule options type is inferred from the JSON schema by [json-schema-to-ts](https://www.npmjs.com/package/json-schema-to-ts).
|
|
@@ -20,6 +19,5 @@ function createRule(rule) {
|
|
|
20
19
|
}
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
//#endregion
|
|
25
|
-
export { createRule };
|
|
23
|
+
export { createRule };
|
package/lib/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { JSONSchema } from "./node_modules/.pnpm/json-schema-to-ts@3.1.1/node_mo
|
|
|
2
2
|
import { PackageJsonPluginSettings, PackageJsonRuleModule } from "./createRule.mjs";
|
|
3
3
|
import { plugin } from "./plugin.mjs";
|
|
4
4
|
import * as jsonc_eslint_parser0 from "jsonc-eslint-parser";
|
|
5
|
-
import * as
|
|
5
|
+
import * as eslint from "eslint";
|
|
6
6
|
|
|
7
7
|
//#region src/index.d.ts
|
|
8
8
|
declare const rules: Record<string, PackageJsonRuleModule<unknown[], JSONSchema[]>>;
|
|
@@ -20,7 +20,7 @@ declare const configs: {
|
|
|
20
20
|
};
|
|
21
21
|
name: string;
|
|
22
22
|
plugins: {
|
|
23
|
-
readonly "package-json":
|
|
23
|
+
readonly "package-json": eslint.ESLint.Plugin;
|
|
24
24
|
};
|
|
25
25
|
rules: {
|
|
26
26
|
[k: string]: "error";
|
|
@@ -33,7 +33,7 @@ declare const configs: {
|
|
|
33
33
|
};
|
|
34
34
|
name: string;
|
|
35
35
|
plugins: {
|
|
36
|
-
readonly "package-json":
|
|
36
|
+
readonly "package-json": eslint.ESLint.Plugin;
|
|
37
37
|
};
|
|
38
38
|
rules: {
|
|
39
39
|
[x: string]: "error";
|
|
@@ -46,7 +46,7 @@ declare const configs: {
|
|
|
46
46
|
};
|
|
47
47
|
name: string;
|
|
48
48
|
plugins: {
|
|
49
|
-
readonly "package-json":
|
|
49
|
+
readonly "package-json": eslint.ESLint.Plugin;
|
|
50
50
|
};
|
|
51
51
|
rules: {
|
|
52
52
|
[k: string]: "error";
|
package/lib/index.mjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { plugin } from "./plugin.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/index.ts
|
|
4
3
|
const rules = plugin.rules;
|
|
5
4
|
const configs = plugin.configs;
|
|
6
5
|
var src_default = plugin;
|
|
7
|
-
|
|
8
6
|
//#endregion
|
|
9
|
-
export { configs, src_default as default, rules };
|
|
7
|
+
export { configs, src_default as default, rules };
|
package/lib/plugin.mjs
CHANGED
|
@@ -20,7 +20,6 @@ import { rule as rule$16 } from "./rules/valid-repository-directory.mjs";
|
|
|
20
20
|
import { rule as rule$17 } from "./rules/valid-version.mjs";
|
|
21
21
|
import { createRequire } from "node:module";
|
|
22
22
|
import * as parserJsonc from "jsonc-eslint-parser";
|
|
23
|
-
|
|
24
23
|
//#region src/plugin.ts
|
|
25
24
|
const require = createRequire(import.meta.url);
|
|
26
25
|
const rules = {
|
|
@@ -92,6 +91,5 @@ const plugin = {
|
|
|
92
91
|
},
|
|
93
92
|
rules
|
|
94
93
|
};
|
|
95
|
-
|
|
96
94
|
//#endregion
|
|
97
|
-
export { plugin };
|
|
95
|
+
export { plugin };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { kebabCase } from "change-case";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/bin-name-casing.ts
|
|
5
4
|
const rule = createRule({
|
|
6
5
|
create(context) {
|
|
@@ -38,6 +37,5 @@ const rule = createRule({
|
|
|
38
37
|
},
|
|
39
38
|
name: "bin-name-casing"
|
|
40
39
|
});
|
|
41
|
-
|
|
42
40
|
//#endregion
|
|
43
|
-
export { rule };
|
|
41
|
+
export { rule };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { isJSONStringLiteral } from "../utils/predicates.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/exports-subpaths-style.ts
|
|
5
4
|
function isImplicitFormat(node) {
|
|
6
5
|
if (node.type === "JSONLiteral") return true;
|
|
@@ -68,6 +67,5 @@ const rule = createRule({
|
|
|
68
67
|
},
|
|
69
68
|
name: "exports-subpaths-style"
|
|
70
69
|
});
|
|
71
|
-
|
|
72
70
|
//#endregion
|
|
73
|
-
export { rule };
|
|
71
|
+
export { rule };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { fixRemoveArrayElement, fixRemoveObjectProperty } from "eslint-fix-utils";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/no-empty-fields.ts
|
|
5
4
|
const getDataAndMessageId = (node) => {
|
|
6
5
|
switch (node.type) {
|
|
@@ -86,6 +85,5 @@ const rule = createRule({
|
|
|
86
85
|
},
|
|
87
86
|
name: "no-empty-fields"
|
|
88
87
|
});
|
|
89
|
-
|
|
90
88
|
//#endregion
|
|
91
|
-
export { rule };
|
|
89
|
+
export { rule };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { isJSONStringLiteral, isNotNullish } from "../utils/predicates.mjs";
|
|
3
3
|
import { fixRemoveArrayElement } from "eslint-fix-utils";
|
|
4
|
-
|
|
5
4
|
//#region src/rules/no-redundant-files.ts
|
|
6
5
|
const defaultFiles = [
|
|
7
6
|
/^(\.\/)?LICEN(C|S)E(\.|$)/i,
|
|
@@ -97,6 +96,5 @@ const rule = createRule({
|
|
|
97
96
|
},
|
|
98
97
|
name: "no-redundant-files"
|
|
99
98
|
});
|
|
100
|
-
|
|
101
99
|
//#endregion
|
|
102
|
-
export { rule };
|
|
100
|
+
export { rule };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { isJSONStringLiteral } from "../utils/predicates.mjs";
|
|
3
3
|
import { fixRemoveObjectProperty } from "eslint-fix-utils";
|
|
4
|
-
|
|
5
4
|
//#region src/rules/no-redundant-publishConfig.ts
|
|
6
5
|
const rule = createRule({
|
|
7
6
|
create(context) {
|
|
@@ -47,6 +46,5 @@ const rule = createRule({
|
|
|
47
46
|
},
|
|
48
47
|
name: "no-redundant-publishConfig"
|
|
49
48
|
});
|
|
50
|
-
|
|
51
49
|
//#endregion
|
|
52
|
-
export { rule };
|
|
50
|
+
export { rule };
|
|
@@ -3,7 +3,6 @@ import detectIndent from "detect-indent";
|
|
|
3
3
|
import { detectNewlineGraceful } from "detect-newline";
|
|
4
4
|
import sortObjectKeys from "sort-object-keys";
|
|
5
5
|
import { sortOrder } from "sort-package-json";
|
|
6
|
-
|
|
7
6
|
//#region src/rules/order-properties.ts
|
|
8
7
|
const standardOrderLegacy = [
|
|
9
8
|
"name",
|
|
@@ -93,6 +92,5 @@ const rule = createRule({
|
|
|
93
92
|
},
|
|
94
93
|
name: "order-properties"
|
|
95
94
|
});
|
|
96
|
-
|
|
97
95
|
//#endregion
|
|
98
|
-
export { rule };
|
|
96
|
+
export { rule };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { isJSONStringLiteral } from "../utils/predicates.mjs";
|
|
3
3
|
import { findPropertyWithKeyValue } from "../utils/findPropertyWithKeyValue.mjs";
|
|
4
|
-
|
|
5
4
|
//#region src/rules/repository-shorthand.ts
|
|
6
5
|
const providerRegexes = {
|
|
7
6
|
bitbucket: /^(?:git\+)?(?:ssh:\/\/git@|http?s:\/\/)?(?:www\.)?bitbucket\.org\//,
|
|
@@ -108,6 +107,5 @@ const rule = createRule({
|
|
|
108
107
|
},
|
|
109
108
|
name: "repository-shorthand"
|
|
110
109
|
});
|
|
111
|
-
|
|
112
110
|
//#endregion
|
|
113
|
-
export { rule };
|
|
111
|
+
export { rule };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { fixRemoveObjectProperty } from "eslint-fix-utils";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/require-attribution.ts
|
|
5
4
|
const rule = createRule({
|
|
6
5
|
create(context) {
|
|
@@ -82,6 +81,5 @@ const rule = createRule({
|
|
|
82
81
|
},
|
|
83
82
|
name: "require-attribution"
|
|
84
83
|
});
|
|
85
|
-
|
|
86
84
|
//#endregion
|
|
87
|
-
export { rule };
|
|
85
|
+
export { rule };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createSimpleRequirePropertyRule } from "../utils/createSimpleRequirePropertyRule.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/rules/require-properties.ts
|
|
4
3
|
const propertyConfig = [
|
|
5
4
|
["author"],
|
|
@@ -57,6 +56,5 @@ const rules = Object.fromEntries(propertyConfig.map(([propertyName, options]) =>
|
|
|
57
56
|
const { rule, ruleName } = createSimpleRequirePropertyRule(propertyName, options);
|
|
58
57
|
return [ruleName, rule];
|
|
59
58
|
}));
|
|
60
|
-
|
|
61
59
|
//#endregion
|
|
62
|
-
export { propertyConfig, rules };
|
|
60
|
+
export { propertyConfig, rules };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { isJSONStringLiteral } from "../utils/predicates.mjs";
|
|
3
3
|
import semver from "semver";
|
|
4
|
-
|
|
5
4
|
//#region src/rules/restrict-dependency-ranges.ts
|
|
6
5
|
const DEPENDENCY_TYPES = [
|
|
7
6
|
"dependencies",
|
|
@@ -144,6 +143,5 @@ const rule = createRule({
|
|
|
144
143
|
},
|
|
145
144
|
name: "restrict-dependency-ranges"
|
|
146
145
|
});
|
|
147
|
-
|
|
148
146
|
//#endregion
|
|
149
|
-
export { rule };
|
|
147
|
+
export { rule };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { isJSONStringLiteral } from "../utils/predicates.mjs";
|
|
3
3
|
import { fixRemoveObjectProperty } from "eslint-fix-utils";
|
|
4
|
-
|
|
5
4
|
//#region src/rules/restrict-private-properties.ts
|
|
6
5
|
const defaultBlockedProperties = ["files", "publishConfig"];
|
|
7
6
|
const rule = createRule({
|
|
@@ -50,6 +49,5 @@ const rule = createRule({
|
|
|
50
49
|
},
|
|
51
50
|
name: "restrict-private-properties"
|
|
52
51
|
});
|
|
53
|
-
|
|
54
52
|
//#endregion
|
|
55
|
-
export { rule };
|
|
53
|
+
export { rule };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { kebabCase } from "change-case";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/scripts-name-casing.ts
|
|
5
4
|
const BUILT_IN_SCRIPTS_IN_CAMEL_CASE = new Set(["prepublishOnly"]);
|
|
6
5
|
const rule = createRule({
|
|
@@ -41,6 +40,5 @@ const rule = createRule({
|
|
|
41
40
|
},
|
|
42
41
|
name: "scripts-name-casing"
|
|
43
42
|
});
|
|
44
|
-
|
|
45
43
|
//#endregion
|
|
46
|
-
export { rule };
|
|
44
|
+
export { rule };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import sortPackageJson from "sort-package-json";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/sort-collections.ts
|
|
5
4
|
const defaultCollections = new Set([
|
|
6
5
|
"config",
|
|
@@ -69,6 +68,5 @@ const rule = createRule({
|
|
|
69
68
|
},
|
|
70
69
|
name: "sort-collections"
|
|
71
70
|
});
|
|
72
|
-
|
|
73
71
|
//#endregion
|
|
74
|
-
export { rule };
|
|
72
|
+
export { rule };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { isJSONStringLiteral } from "../utils/predicates.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/specify-peers-locally.ts
|
|
5
4
|
const rule = createRule({
|
|
6
5
|
create(context) {
|
|
@@ -60,6 +59,5 @@ const rule = createRule({
|
|
|
60
59
|
},
|
|
61
60
|
name: "specify-peers-locally"
|
|
62
61
|
});
|
|
63
|
-
|
|
64
62
|
//#endregion
|
|
65
|
-
export { rule };
|
|
63
|
+
export { rule };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { isJSONStringLiteral, isNotNullish } from "../utils/predicates.mjs";
|
|
3
3
|
import { fixRemoveArrayElement, fixRemoveObjectProperty } from "eslint-fix-utils";
|
|
4
|
-
|
|
5
4
|
//#region src/rules/unique-dependencies.ts
|
|
6
5
|
const dependencyPropertyNames = new Set([
|
|
7
6
|
"bundledDependencies",
|
|
@@ -83,6 +82,5 @@ const rule = createRule({
|
|
|
83
82
|
},
|
|
84
83
|
name: "unique-dependencies"
|
|
85
84
|
});
|
|
86
|
-
|
|
87
85
|
//#endregion
|
|
88
|
-
export { rule };
|
|
86
|
+
export { rule };
|
package/lib/rules/valid-name.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import validate from "validate-npm-package-name";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/valid-name.ts
|
|
5
4
|
const rule = createRule({
|
|
6
5
|
create(context) {
|
|
@@ -39,6 +38,5 @@ const rule = createRule({
|
|
|
39
38
|
},
|
|
40
39
|
name: "valid-name"
|
|
41
40
|
});
|
|
42
|
-
|
|
43
41
|
//#endregion
|
|
44
|
-
export { rule };
|
|
42
|
+
export { rule };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { validate } from "package-json-validator";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/valid-package-definition.ts
|
|
5
4
|
const ignoredErrors = [
|
|
6
5
|
/^Url not valid/i,
|
|
@@ -41,6 +40,5 @@ const rule = createRule({
|
|
|
41
40
|
},
|
|
42
41
|
name: "valid-package-definition"
|
|
43
42
|
});
|
|
44
|
-
|
|
45
43
|
//#endregion
|
|
46
|
-
export { rule };
|
|
44
|
+
export { rule };
|
|
@@ -1,10 +1,10 @@
|
|
|
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, validateSideEffects, validateType, validateWorkspaces } from "package-json-validator";
|
|
3
|
-
|
|
2
|
+
import { validateAuthor, validateBin, validateBugs, validateBundleDependencies, validateConfig, validateContributors, validateCpu, validateDependencies, validateDescription, validateDirectories, validateEngines, validateExports, validateFiles, validateFunding, validateHomepage, validateKeywords, validateLicense, validateMain, validateMan, validateOs, validatePackageManager, validatePrivate, validatePublishConfig, validateRepository, validateScripts, validateSideEffects, validateType, validateWorkspaces } from "package-json-validator";
|
|
4
3
|
//#region src/rules/valid-properties.ts
|
|
5
4
|
const properties = [
|
|
6
5
|
["author", validateAuthor],
|
|
7
6
|
["bin", validateBin],
|
|
7
|
+
["bugs", validateBugs],
|
|
8
8
|
["bundleDependencies", {
|
|
9
9
|
aliases: ["bundledDependencies"],
|
|
10
10
|
validator: validateBundleDependencies
|
|
@@ -19,6 +19,7 @@ const properties = [
|
|
|
19
19
|
["engines", validateEngines],
|
|
20
20
|
["exports", validateExports],
|
|
21
21
|
["files", validateFiles],
|
|
22
|
+
["funding", validateFunding],
|
|
22
23
|
["homepage", validateHomepage],
|
|
23
24
|
["keywords", validateKeywords],
|
|
24
25
|
["license", validateLicense],
|
|
@@ -27,6 +28,7 @@ const properties = [
|
|
|
27
28
|
["module", validateMain],
|
|
28
29
|
["optionalDependencies", validateDependencies],
|
|
29
30
|
["os", validateOs],
|
|
31
|
+
["packageManager", validatePackageManager],
|
|
30
32
|
["peerDependencies", validateDependencies],
|
|
31
33
|
["private", validatePrivate],
|
|
32
34
|
["publishConfig", validatePublishConfig],
|
|
@@ -47,6 +49,5 @@ const rules = Object.fromEntries(properties.map(([propertyName, validationFuncti
|
|
|
47
49
|
const { rule, ruleName } = createSimpleValidPropertyRule(propertyName, validationFunction, aliases);
|
|
48
50
|
return [ruleName, rule];
|
|
49
51
|
}));
|
|
50
|
-
|
|
51
52
|
//#endregion
|
|
52
|
-
export { rules };
|
|
53
|
+
export { rules };
|
|
@@ -3,7 +3,6 @@ import { findPropertyWithKeyValue } from "../utils/findPropertyWithKeyValue.mjs"
|
|
|
3
3
|
import { findRootSync } from "@altano/repository-tools";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { sep } from "node:path/posix";
|
|
6
|
-
|
|
7
6
|
//#region src/rules/valid-repository-directory.ts
|
|
8
7
|
/**
|
|
9
8
|
* Checks if the child path appears at the end of the parent path.
|
|
@@ -66,6 +65,5 @@ const rule = createRule({
|
|
|
66
65
|
},
|
|
67
66
|
name: "valid-repository-directory"
|
|
68
67
|
});
|
|
69
|
-
|
|
70
68
|
//#endregion
|
|
71
|
-
export { rule };
|
|
69
|
+
export { rule };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import semver from "semver";
|
|
3
|
-
|
|
4
3
|
//#region src/rules/valid-version.ts
|
|
5
4
|
const rule = createRule({
|
|
6
5
|
create(context) {
|
|
@@ -33,6 +32,5 @@ const rule = createRule({
|
|
|
33
32
|
},
|
|
34
33
|
name: "valid-version"
|
|
35
34
|
});
|
|
36
|
-
|
|
37
35
|
//#endregion
|
|
38
|
-
export { rule };
|
|
36
|
+
export { rule };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
2
|
import { isJSONStringLiteral } from "./predicates.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/utils/createSimpleRequirePropertyRule.ts
|
|
5
4
|
/**
|
|
6
5
|
* Given a top-level property name, create a rule that requires that property to be present.
|
|
@@ -52,6 +51,5 @@ const createSimpleRequirePropertyRule = (propertyName, { category, fixValue, ign
|
|
|
52
51
|
ruleName
|
|
53
52
|
};
|
|
54
53
|
};
|
|
55
|
-
|
|
56
54
|
//#endregion
|
|
57
|
-
export { createSimpleRequirePropertyRule };
|
|
55
|
+
export { createSimpleRequirePropertyRule };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createRule } from "../createRule.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/utils/createSimpleValidPropertyRule.ts
|
|
4
3
|
/**
|
|
5
4
|
* Given a top-level property name, and a validation function, create a rule that validates the property using the validation function.
|
|
@@ -53,6 +52,5 @@ const createSimpleValidPropertyRule = (propertyName, validationFunction, aliases
|
|
|
53
52
|
ruleName
|
|
54
53
|
};
|
|
55
54
|
};
|
|
56
|
-
|
|
57
55
|
//#endregion
|
|
58
|
-
export { createSimpleValidPropertyRule };
|
|
56
|
+
export { createSimpleValidPropertyRule };
|
package/lib/utils/predicates.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-package-json",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.90.0",
|
|
4
4
|
"description": "Rules for consistent, readable, and valid package.json files. 🗂️",
|
|
5
5
|
"homepage": "https://github.com/michaelfaith/eslint-plugin-package-json#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"detect-indent": "^7.0.2",
|
|
50
50
|
"detect-newline": "^4.0.1",
|
|
51
51
|
"eslint-fix-utils": "~0.4.1",
|
|
52
|
-
"package-json-validator": "^1.
|
|
52
|
+
"package-json-validator": "^1.2.1",
|
|
53
53
|
"semver": "^7.7.3",
|
|
54
54
|
"sort-object-keys": "^2.0.0",
|
|
55
55
|
"sort-package-json": "^3.4.0",
|
|
@@ -60,19 +60,19 @@
|
|
|
60
60
|
"@eslint/js": "10.0.1",
|
|
61
61
|
"@eslint/markdown": "7.5.1",
|
|
62
62
|
"@types/estree": "1.0.8",
|
|
63
|
-
"@types/node": "24.
|
|
63
|
+
"@types/node": "24.12.0",
|
|
64
64
|
"@types/semver": "7.7.1",
|
|
65
65
|
"@types/validate-npm-package-name": "4.0.2",
|
|
66
66
|
"@vitest/coverage-v8": "4.0.13",
|
|
67
67
|
"@vitest/eslint-plugin": "1.6.1",
|
|
68
68
|
"console-fail-test": "0.6.0",
|
|
69
69
|
"eslint": "10.0.0",
|
|
70
|
-
"eslint-doc-generator": "3.
|
|
70
|
+
"eslint-doc-generator": "3.3.1",
|
|
71
71
|
"eslint-plugin-eslint-plugin": "7.3.1",
|
|
72
72
|
"eslint-plugin-jsdoc": "62.7.0",
|
|
73
73
|
"eslint-plugin-jsonc": "3.1.0",
|
|
74
74
|
"eslint-plugin-n": "17.24.0",
|
|
75
|
-
"eslint-plugin-node-dependencies": "2.
|
|
75
|
+
"eslint-plugin-node-dependencies": "2.2.0",
|
|
76
76
|
"eslint-plugin-perfectionist": "5.6.0",
|
|
77
77
|
"eslint-plugin-regexp": "3.0.0",
|
|
78
78
|
"eslint-plugin-unicorn": "63.0.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"prettier-plugin-packagejson": "3.0.0",
|
|
89
89
|
"prettier-plugin-sentences-per-line": "0.2.3",
|
|
90
90
|
"prettier-plugin-sh": "0.18.0",
|
|
91
|
-
"tsdown": "0.
|
|
91
|
+
"tsdown": "0.21.0",
|
|
92
92
|
"typescript": "5.9.3",
|
|
93
93
|
"typescript-eslint": "8.56.0",
|
|
94
94
|
"vitest": "4.0.13"
|