eslint-plugin-package-json 1.8.0 → 1.8.1
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/dist/{createRule-29pC9RoP.d.mts → createRule-CSNxd7i2.d.mts} +2 -2
- package/dist/experimental/index.d.mts +7 -8
- package/dist/experimental/index.mjs +1 -1
- package/dist/index.d.mts +10 -10
- package/dist/index.mjs +1 -1
- package/dist/{plugin-Ciw4gT9_.mjs → plugin-DlF-r5D9.mjs} +11 -2
- package/package.json +31 -31
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AST, RuleListener } from "jsonc-eslint-parser";
|
|
2
2
|
import { AST as AST$1, Rule, SourceCode } from "eslint";
|
|
3
3
|
import * as ESTree from "estree";
|
|
4
|
-
|
|
5
4
|
//#region node_modules/.pnpm/json-schema-to-ts@3.1.1/node_modules/json-schema-to-ts/lib/types/definitions/jsonSchema.d.ts
|
|
6
5
|
declare const $JSONSchema: unique symbol;
|
|
7
6
|
type $JSONSchema = typeof $JSONSchema;
|
|
@@ -92,7 +91,8 @@ interface PackageJsonRuleModule<Options extends unknown[] = unknown[], Schema ex
|
|
|
92
91
|
meta: Omit<Rule.RuleMetaData, 'defaultOptions' | 'docs' | 'schema'> & {
|
|
93
92
|
defaultOptions?: NoInfer<Options>;
|
|
94
93
|
docs?: Rule.RuleMetaData['docs'] & {
|
|
95
|
-
category?: string;
|
|
94
|
+
category?: string;
|
|
95
|
+
/** An optional route segment to group this rule under */
|
|
96
96
|
ruleGroup?: string;
|
|
97
97
|
};
|
|
98
98
|
schema?: Schema;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as PackageJsonRuleModule, r as JSONSchema, t as PackageJsonPluginSettings } from "../createRule-
|
|
2
|
-
import { ESLint } from "eslint";
|
|
3
|
-
|
|
1
|
+
import { n as PackageJsonRuleModule, r as JSONSchema, t as PackageJsonPluginSettings } from "../createRule-CSNxd7i2.mjs";
|
|
2
|
+
import { ESLint as ESLint$1 } from "eslint";
|
|
4
3
|
//#region src/experimental/plugin.d.ts
|
|
5
4
|
declare const plugin: {
|
|
6
5
|
configs: {
|
|
@@ -9,7 +8,7 @@ declare const plugin: {
|
|
|
9
8
|
language: string;
|
|
10
9
|
name: string;
|
|
11
10
|
plugins: {
|
|
12
|
-
readonly 'package-json': ESLint.Plugin;
|
|
11
|
+
readonly 'package-json': ESLint$1.Plugin;
|
|
13
12
|
};
|
|
14
13
|
rules: {
|
|
15
14
|
[k: string]: "error";
|
|
@@ -20,7 +19,7 @@ declare const plugin: {
|
|
|
20
19
|
language: string;
|
|
21
20
|
name: string;
|
|
22
21
|
plugins: {
|
|
23
|
-
readonly 'package-json': ESLint.Plugin;
|
|
22
|
+
readonly 'package-json': ESLint$1.Plugin;
|
|
24
23
|
};
|
|
25
24
|
rules: {
|
|
26
25
|
[k: string]: "error";
|
|
@@ -37,7 +36,7 @@ declare const plugin: {
|
|
|
37
36
|
};
|
|
38
37
|
//#endregion
|
|
39
38
|
//#region src/experimental/index.d.ts
|
|
40
|
-
declare const configs: {
|
|
39
|
+
export declare const configs: {
|
|
41
40
|
recommended: {
|
|
42
41
|
files: string[];
|
|
43
42
|
language: string;
|
|
@@ -61,8 +60,8 @@ declare const configs: {
|
|
|
61
60
|
};
|
|
62
61
|
};
|
|
63
62
|
};
|
|
64
|
-
declare const rules: {
|
|
63
|
+
export declare const rules: {
|
|
65
64
|
[k: string]: PackageJsonRuleModule<unknown[], JSONSchema[]>;
|
|
66
65
|
};
|
|
67
66
|
//#endregion
|
|
68
|
-
export { type PackageJsonPluginSettings,
|
|
67
|
+
export { type PackageJsonPluginSettings, plugin as default };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { n as PackageJsonRuleModule, r as JSONSchema, t as PackageJsonPluginSettings } from "./createRule-
|
|
1
|
+
import { n as PackageJsonRuleModule, r as JSONSchema, t as PackageJsonPluginSettings } from "./createRule-CSNxd7i2.mjs";
|
|
2
2
|
import * as parserJsonc from "jsonc-eslint-parser";
|
|
3
|
-
import { ESLint } from "eslint";
|
|
4
|
-
|
|
3
|
+
import { ESLint as ESLint$1 } from "eslint";
|
|
5
4
|
//#region src/plugin.d.ts
|
|
6
5
|
declare const plugin: {
|
|
7
6
|
configs: {
|
|
@@ -12,12 +11,13 @@ declare const plugin: {
|
|
|
12
11
|
};
|
|
13
12
|
name: string;
|
|
14
13
|
plugins: {
|
|
15
|
-
readonly 'package-json': ESLint.Plugin;
|
|
14
|
+
readonly 'package-json': ESLint$1.Plugin;
|
|
16
15
|
};
|
|
17
16
|
rules: {
|
|
18
17
|
[k: string]: "error";
|
|
19
18
|
};
|
|
20
|
-
};
|
|
19
|
+
};
|
|
20
|
+
/** @deprecated use the recommended config instead. this config will be removed in a future major release */
|
|
21
21
|
'recommended-publishable': {
|
|
22
22
|
files: string[];
|
|
23
23
|
languageOptions: {
|
|
@@ -25,7 +25,7 @@ declare const plugin: {
|
|
|
25
25
|
};
|
|
26
26
|
name: string;
|
|
27
27
|
plugins: {
|
|
28
|
-
readonly 'package-json': ESLint.Plugin;
|
|
28
|
+
readonly 'package-json': ESLint$1.Plugin;
|
|
29
29
|
};
|
|
30
30
|
rules: {
|
|
31
31
|
[x: string]: "error";
|
|
@@ -38,7 +38,7 @@ declare const plugin: {
|
|
|
38
38
|
};
|
|
39
39
|
name: string;
|
|
40
40
|
plugins: {
|
|
41
|
-
readonly 'package-json': ESLint.Plugin;
|
|
41
|
+
readonly 'package-json': ESLint$1.Plugin;
|
|
42
42
|
};
|
|
43
43
|
rules: {
|
|
44
44
|
[k: string]: "error";
|
|
@@ -53,8 +53,8 @@ declare const plugin: {
|
|
|
53
53
|
};
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/index.d.ts
|
|
56
|
-
declare const rules: Record<string, PackageJsonRuleModule<unknown[], JSONSchema[]>>;
|
|
57
|
-
declare const configs: {
|
|
56
|
+
export declare const rules: Record<string, PackageJsonRuleModule<unknown[], JSONSchema[]>>;
|
|
57
|
+
export declare const configs: {
|
|
58
58
|
recommended: {
|
|
59
59
|
files: string[];
|
|
60
60
|
languageOptions: {
|
|
@@ -96,4 +96,4 @@ declare const configs: {
|
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
98
|
//#endregion
|
|
99
|
-
export { type PackageJsonPluginSettings,
|
|
99
|
+
export { type PackageJsonPluginSettings, plugin as default };
|
package/dist/index.mjs
CHANGED
|
@@ -14,6 +14,11 @@ import path from "node:path";
|
|
|
14
14
|
import process from "node:process";
|
|
15
15
|
import { sep } from "node:path/posix";
|
|
16
16
|
import { findRootSync } from "@altano/repository-tools";
|
|
17
|
+
//#region src/utils/predicates/isJSONNullLiteral.ts
|
|
18
|
+
function isJSONNullLiteral(node) {
|
|
19
|
+
return node.type === "JSONLiteral" && node.value === null;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
17
22
|
//#region src/utils/predicates/isJSONStringLiteral.ts
|
|
18
23
|
function isJSONStringLiteral(node) {
|
|
19
24
|
return node.type === "JSONLiteral" && typeof node.value === "string";
|
|
@@ -97,6 +102,7 @@ const rule$18 = createRule({
|
|
|
97
102
|
const [{ prefer = "explicit" } = {}] = context.options;
|
|
98
103
|
function validateForExplicit(node) {
|
|
99
104
|
const { value } = node;
|
|
105
|
+
if (isJSONNullLiteral(value)) return;
|
|
100
106
|
if (value.type !== "JSONLiteral" && value.type !== "JSONObjectExpression" || !isImplicitFormat(value)) return;
|
|
101
107
|
context.report({
|
|
102
108
|
fix(fixer) {
|
|
@@ -113,6 +119,7 @@ const rule$18 = createRule({
|
|
|
113
119
|
if (value.type !== "JSONObjectExpression") return;
|
|
114
120
|
if (value.properties.length !== 1 || !isJSONStringLiteral(value.properties[0].key) || value.properties[0].key.value !== ".") return;
|
|
115
121
|
const dotProperty = value.properties[0];
|
|
122
|
+
if (isJSONNullLiteral(dotProperty.value)) return;
|
|
116
123
|
context.report({
|
|
117
124
|
fix(fixer) {
|
|
118
125
|
const valueText = context.sourceCode.getText(dotProperty.value);
|
|
@@ -1306,7 +1313,8 @@ const rule$5 = createRule({
|
|
|
1306
1313
|
let naturalCompare;
|
|
1307
1314
|
if (isScripts) {
|
|
1308
1315
|
const scriptsSource = context.sourceCode.getText(node);
|
|
1309
|
-
const
|
|
1316
|
+
const minimalJson = JSON.parse(`{${scriptsSource}}`);
|
|
1317
|
+
const { scripts: sortedScripts } = sortPackageJson(minimalJson);
|
|
1310
1318
|
const lifecycleIndex = new Map(Object.keys(sortedScripts).map((k, i) => [k, i]));
|
|
1311
1319
|
naturalCompare = (a, b) => (lifecycleIndex.get(a) ?? 0) - (lifecycleIndex.get(b) ?? 0);
|
|
1312
1320
|
} else naturalCompare = (a, b) => a > b ? 1 : -1;
|
|
@@ -1561,7 +1569,8 @@ const rule$2 = createRule({
|
|
|
1561
1569
|
};
|
|
1562
1570
|
return { "Program > JSONExpressionStatement > JSONObjectExpression > JSONProperty[key.value=author]"(node) {
|
|
1563
1571
|
const valueNode = node.value;
|
|
1564
|
-
const
|
|
1572
|
+
const value = JSON.parse(context.sourceCode.getText(valueNode));
|
|
1573
|
+
const result = validateAuthor(value);
|
|
1565
1574
|
reportIssues(result, valueNode, "author");
|
|
1566
1575
|
} };
|
|
1567
1576
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-package-json",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
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": {
|
|
@@ -57,51 +57,51 @@
|
|
|
57
57
|
"sort-package-json": "^4.0.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@astrojs/check": "0.9.
|
|
61
|
-
"@astrojs/markdown-satteri": "0.
|
|
62
|
-
"@astrojs/starlight": "0.
|
|
60
|
+
"@astrojs/check": "0.9.10",
|
|
61
|
+
"@astrojs/markdown-satteri": "0.4.1",
|
|
62
|
+
"@astrojs/starlight": "0.42.0",
|
|
63
63
|
"@catppuccin/starlight": "2.1.0",
|
|
64
|
-
"@eslint-community/eslint-plugin-eslint-comments": "4.
|
|
64
|
+
"@eslint-community/eslint-plugin-eslint-comments": "4.8.0",
|
|
65
65
|
"@eslint/js": "10.0.1",
|
|
66
|
-
"@eslint/json": "2.
|
|
67
|
-
"@eslint/markdown": "8.0.
|
|
66
|
+
"@eslint/json": "2.1.0",
|
|
67
|
+
"@eslint/markdown": "8.0.3",
|
|
68
68
|
"@ianvs/prettier-plugin-sort-imports": "4.7.1",
|
|
69
|
-
"@types/node": "24.13.
|
|
69
|
+
"@types/node": "24.13.4",
|
|
70
70
|
"@types/semver": "7.8.0",
|
|
71
71
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
72
|
-
"@vitest/coverage-v8": "
|
|
73
|
-
"@vitest/eslint-plugin": "1.6.
|
|
74
|
-
"astro": "7.2
|
|
75
|
-
"astro-og-canvas": "0.13.
|
|
72
|
+
"@vitest/coverage-v8": "5.0.0",
|
|
73
|
+
"@vitest/eslint-plugin": "1.6.27",
|
|
74
|
+
"astro": "7.3.2",
|
|
75
|
+
"astro-og-canvas": "0.13.1",
|
|
76
76
|
"canvaskit-wasm": "0.42.0",
|
|
77
|
-
"console-fail-test": "0.6.
|
|
78
|
-
"eslint": "10.
|
|
79
|
-
"eslint-doc-generator": "3.7.
|
|
80
|
-
"eslint-plugin-eslint-plugin": "7.6.
|
|
81
|
-
"eslint-plugin-jsdoc": "64.
|
|
82
|
-
"eslint-plugin-jsonc": "3.4.
|
|
77
|
+
"console-fail-test": "0.6.1",
|
|
78
|
+
"eslint": "10.10.0",
|
|
79
|
+
"eslint-doc-generator": "3.7.1",
|
|
80
|
+
"eslint-plugin-eslint-plugin": "7.6.2",
|
|
81
|
+
"eslint-plugin-jsdoc": "64.3.8",
|
|
82
|
+
"eslint-plugin-jsonc": "3.4.2",
|
|
83
83
|
"eslint-plugin-n": "18.3.0",
|
|
84
84
|
"eslint-plugin-node-dependencies": "2.2.0",
|
|
85
|
-
"eslint-plugin-perfectionist": "5.
|
|
86
|
-
"eslint-plugin-regexp": "3.
|
|
87
|
-
"eslint-plugin-unicorn": "
|
|
88
|
-
"eslint-plugin-yml": "3.8.
|
|
85
|
+
"eslint-plugin-perfectionist": "5.11.0",
|
|
86
|
+
"eslint-plugin-regexp": "3.3.0",
|
|
87
|
+
"eslint-plugin-unicorn": "74.0.0",
|
|
88
|
+
"eslint-plugin-yml": "3.8.1",
|
|
89
89
|
"jiti": "2.7.0",
|
|
90
90
|
"json-schema-to-ts": "3.1.1",
|
|
91
|
-
"knip": "6.
|
|
92
|
-
"pkg-pr-new": "0.0.
|
|
93
|
-
"prettier": "3.9.
|
|
91
|
+
"knip": "6.35.1",
|
|
92
|
+
"pkg-pr-new": "0.0.88",
|
|
93
|
+
"prettier": "3.9.6",
|
|
94
94
|
"prettier-plugin-curly": "0.4.1",
|
|
95
95
|
"prettier-plugin-packagejson": "3.0.2",
|
|
96
96
|
"prettier-plugin-sh": "0.19.0",
|
|
97
97
|
"pretty-quick": "4.2.2",
|
|
98
|
-
"sharp": "0.35.
|
|
99
|
-
"simple-git-hooks": "2.
|
|
100
|
-
"starlight-auto-sidebar": "0.4.
|
|
101
|
-
"tsdown": "0.
|
|
98
|
+
"sharp": "0.35.4",
|
|
99
|
+
"simple-git-hooks": "2.14.0",
|
|
100
|
+
"starlight-auto-sidebar": "0.4.1",
|
|
101
|
+
"tsdown": "0.23.0",
|
|
102
102
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
103
|
-
"typescript-eslint": "8.
|
|
104
|
-
"vitest": "
|
|
103
|
+
"typescript-eslint": "8.70.0",
|
|
104
|
+
"vitest": "5.0.0"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
107
|
"@eslint/json": ">=1.0.0",
|