eslint-plugin-package-json 0.52.0 → 0.53.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/lib/createRule.d.ts +28 -28
- package/lib/createRule.js +18 -12
- package/lib/index.d.ts +33 -35
- package/lib/index.js +6 -6
- package/lib/plugin.d.ts +33 -34
- package/lib/plugin.js +62 -80
- package/lib/rules/no-empty-fields.d.ts +6 -11
- package/lib/rules/no-empty-fields.js +80 -112
- package/lib/rules/no-redundant-files.d.ts +5 -10
- package/lib/rules/no-redundant-files.js +93 -136
- package/lib/rules/order-properties.d.ts +6 -11
- package/lib/rules/order-properties.js +92 -116
- package/lib/rules/repository-shorthand.d.ts +6 -11
- package/lib/rules/repository-shorthand.js +79 -112
- package/lib/rules/require-properties.d.ts +7 -12
- package/lib/rules/require-properties.js +31 -27
- package/lib/rules/restrict-dependency-ranges.d.ts +9 -14
- package/lib/rules/restrict-dependency-ranges.js +137 -189
- package/lib/rules/sort-collections.d.ts +5 -10
- package/lib/rules/sort-collections.js +71 -124
- package/lib/rules/unique-dependencies.d.ts +5 -10
- package/lib/rules/unique-dependencies.js +58 -82
- package/lib/rules/valid-bin.d.ts +6 -11
- package/lib/rules/valid-bin.js +59 -78
- package/lib/rules/valid-local-dependency.d.ts +5 -10
- package/lib/rules/valid-local-dependency.js +49 -57
- package/lib/rules/valid-name.d.ts +5 -10
- package/lib/rules/valid-name.js +41 -48
- package/lib/rules/valid-package-definition.d.ts +6 -11
- package/lib/rules/valid-package-definition.js +41 -50
- package/lib/rules/valid-properties.d.ts +7 -7
- package/lib/rules/valid-properties.js +33 -55
- package/lib/rules/valid-repository-directory.d.ts +5 -10
- package/lib/rules/valid-repository-directory.js +65 -80
- package/lib/rules/valid-version.d.ts +5 -10
- package/lib/rules/valid-version.js +35 -36
- package/lib/types/estree.d.ts +8 -0
- package/lib/utils/createSimpleRequirePropertyRule.d.ts +19 -18
- package/lib/utils/createSimpleRequirePropertyRule.js +48 -53
- package/lib/utils/createSimpleValidPropertyRule.d.ts +6 -8
- package/lib/utils/createSimpleValidPropertyRule.js +45 -39
- package/lib/utils/findPropertyWithKeyValue.d.ts +6 -5
- package/lib/utils/findPropertyWithKeyValue.js +5 -6
- package/lib/utils/formatErrors.d.ts +3 -2
- package/lib/utils/formatErrors.js +11 -7
- package/lib/utils/isPackageJson.d.ts +3 -2
- package/lib/utils/isPackageJson.js +4 -3
- package/lib/utils/predicates.d.ts +4 -3
- package/lib/utils/predicates.js +6 -6
- package/package.json +8 -8
- package/lib/tests/rules/ruleTester.d.ts +0 -15
- package/lib/tests/rules/ruleTester.js +0 -25
- package/lib/types/estree.d.d.ts +0 -7
- package/lib/types/estree.d.js +0 -0
|
@@ -1,124 +1,100 @@
|
|
|
1
|
+
import { createRule } from "../createRule.js";
|
|
1
2
|
import detectIndent from "detect-indent";
|
|
2
3
|
import { detectNewlineGraceful } from "detect-newline";
|
|
3
4
|
import sortObjectKeys from "sort-object-keys";
|
|
4
5
|
import { sortOrder } from "sort-package-json";
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
//#region src/rules/order-properties.ts
|
|
6
8
|
const standardOrderLegacy = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
9
|
+
"name",
|
|
10
|
+
"version",
|
|
11
|
+
"private",
|
|
12
|
+
"publishConfig",
|
|
13
|
+
"description",
|
|
14
|
+
"main",
|
|
15
|
+
"exports",
|
|
16
|
+
"browser",
|
|
17
|
+
"files",
|
|
18
|
+
"bin",
|
|
19
|
+
"directories",
|
|
20
|
+
"man",
|
|
21
|
+
"scripts",
|
|
22
|
+
"repository",
|
|
23
|
+
"keywords",
|
|
24
|
+
"author",
|
|
25
|
+
"license",
|
|
26
|
+
"bugs",
|
|
27
|
+
"homepage",
|
|
28
|
+
"config",
|
|
29
|
+
"dependencies",
|
|
30
|
+
"devDependencies",
|
|
31
|
+
"peerDependencies",
|
|
32
|
+
"optionalDependencies",
|
|
33
|
+
"bundledDependencies",
|
|
34
|
+
"engines",
|
|
35
|
+
"os",
|
|
36
|
+
"cpu"
|
|
35
37
|
];
|
|
36
38
|
const rule = createRule({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
incorrectOrder: 'Package top-level property "{{property}}" is not ordered in the npm standard way. Run the ESLint auto-fixer to correct.'
|
|
96
|
-
},
|
|
97
|
-
schema: [
|
|
98
|
-
{
|
|
99
|
-
additionalProperties: false,
|
|
100
|
-
properties: {
|
|
101
|
-
order: {
|
|
102
|
-
anyOf: [
|
|
103
|
-
{
|
|
104
|
-
enum: ["legacy", "sort-package-json"],
|
|
105
|
-
type: ["string"]
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
items: {
|
|
109
|
-
type: ["string"]
|
|
110
|
-
},
|
|
111
|
-
type: ["array"]
|
|
112
|
-
}
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
type: "object"
|
|
117
|
-
}
|
|
118
|
-
],
|
|
119
|
-
type: "layout"
|
|
120
|
-
}
|
|
39
|
+
create(context) {
|
|
40
|
+
return { "Program:exit"() {
|
|
41
|
+
const { ast, text } = context.sourceCode;
|
|
42
|
+
const options = {
|
|
43
|
+
order: "sort-package-json",
|
|
44
|
+
...context.options[0]
|
|
45
|
+
};
|
|
46
|
+
const requiredOrder = options.order === "legacy" ? standardOrderLegacy : options.order === "sort-package-json" ? sortOrder : options.order;
|
|
47
|
+
const json = JSON.parse(text);
|
|
48
|
+
const orderedSource = sortObjectKeys(json, [...requiredOrder, ...Object.keys(json)]);
|
|
49
|
+
const orderedKeys = Object.keys(orderedSource);
|
|
50
|
+
const { properties } = ast.body[0].expression;
|
|
51
|
+
for (let i = 0; i < properties.length; i += 1) {
|
|
52
|
+
const property = properties[i].key;
|
|
53
|
+
const { value } = property;
|
|
54
|
+
if (value === orderedKeys[i]) continue;
|
|
55
|
+
context.report({
|
|
56
|
+
data: { property: value },
|
|
57
|
+
fix(fixer) {
|
|
58
|
+
const { indent, type } = detectIndent(text);
|
|
59
|
+
const endCharacters = text.endsWith("\n") ? "\n" : "";
|
|
60
|
+
const newline = detectNewlineGraceful(text);
|
|
61
|
+
let result = JSON.stringify(orderedSource, null, type === "tab" ? " " : indent) + endCharacters;
|
|
62
|
+
if (newline === "\r\n") result = result.replace(/\n/g, newline);
|
|
63
|
+
return fixer.replaceText(context.sourceCode.ast, result);
|
|
64
|
+
},
|
|
65
|
+
loc: properties[i].loc,
|
|
66
|
+
messageId: "incorrectOrder"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
} };
|
|
70
|
+
},
|
|
71
|
+
meta: {
|
|
72
|
+
defaultOptions: [{ order: "sort-package-json" }],
|
|
73
|
+
docs: {
|
|
74
|
+
category: "Best Practices",
|
|
75
|
+
description: "Package properties must be declared in standard order",
|
|
76
|
+
recommended: true
|
|
77
|
+
},
|
|
78
|
+
fixable: "code",
|
|
79
|
+
messages: { incorrectOrder: "Package top-level property \"{{property}}\" is not ordered in the npm standard way. Run the ESLint auto-fixer to correct." },
|
|
80
|
+
schema: [{
|
|
81
|
+
additionalProperties: false,
|
|
82
|
+
properties: { order: {
|
|
83
|
+
anyOf: [{
|
|
84
|
+
enum: ["legacy", "sort-package-json"],
|
|
85
|
+
type: ["string"]
|
|
86
|
+
}, {
|
|
87
|
+
items: { type: ["string"] },
|
|
88
|
+
type: ["array"]
|
|
89
|
+
}],
|
|
90
|
+
description: "Specifies the sorting order of top-level properties."
|
|
91
|
+
} },
|
|
92
|
+
type: "object"
|
|
93
|
+
}],
|
|
94
|
+
type: "layout"
|
|
95
|
+
},
|
|
96
|
+
name: "order-properties"
|
|
121
97
|
});
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
};
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { rule };
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as jsonc_eslint_parser from 'jsonc-eslint-parser';
|
|
3
|
-
import { PackageJsonRuleContext } from '../createRule.js';
|
|
4
|
-
import 'estree';
|
|
1
|
+
import { PackageJsonRuleModule } from "../createRule.js";
|
|
5
2
|
|
|
3
|
+
//#region src/rules/repository-shorthand.d.ts
|
|
6
4
|
type Form = "object" | "shorthand";
|
|
7
5
|
type Options = [{
|
|
8
|
-
|
|
6
|
+
form: Form;
|
|
9
7
|
}?];
|
|
10
|
-
declare const rule:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export { rule };
|
|
8
|
+
declare const rule: PackageJsonRuleModule<Options>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { rule };
|
|
@@ -1,119 +1,86 @@
|
|
|
1
1
|
import { createRule } from "../createRule.js";
|
|
2
|
-
import { findPropertyWithKeyValue } from "../utils/findPropertyWithKeyValue.js";
|
|
3
2
|
import { isJSONStringLiteral } from "../utils/predicates.js";
|
|
3
|
+
import { findPropertyWithKeyValue } from "../utils/findPropertyWithKeyValue.js";
|
|
4
|
+
|
|
5
|
+
//#region src/rules/repository-shorthand.ts
|
|
4
6
|
const githubUrlRegex = /^(?:git\+)?(?:ssh:\/\/git@|http?s:\/\/)?(?:www\.)?github\.com\//;
|
|
5
7
|
const isGitHubUrl = (url) => githubUrlRegex.test(url);
|
|
6
8
|
const cleanGitHubUrl = (url) => url.replace(githubUrlRegex, "").replace(/\.git$/, "");
|
|
7
9
|
const rule = createRule({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (form === "shorthand") {
|
|
84
|
-
validateRepositoryForShorthand(node);
|
|
85
|
-
} else {
|
|
86
|
-
validateRepositoryForObject(node);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
},
|
|
91
|
-
meta: {
|
|
92
|
-
docs: {
|
|
93
|
-
category: "Best Practices",
|
|
94
|
-
description: "Enforce either object or shorthand declaration for repository.",
|
|
95
|
-
recommended: true
|
|
96
|
-
},
|
|
97
|
-
fixable: "code",
|
|
98
|
-
messages: {
|
|
99
|
-
preferObject: "Prefer an object locator for a repository.",
|
|
100
|
-
preferShorthand: "Prefer a shorthand locator for a GitHub repository."
|
|
101
|
-
},
|
|
102
|
-
schema: [
|
|
103
|
-
{
|
|
104
|
-
additionalProperties: false,
|
|
105
|
-
properties: {
|
|
106
|
-
form: {
|
|
107
|
-
enum: ["object", "shorthand"],
|
|
108
|
-
type: ["string"]
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
type: "object"
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
type: "suggestion"
|
|
115
|
-
}
|
|
10
|
+
create(context) {
|
|
11
|
+
const [{ form = "object" } = {}] = context.options;
|
|
12
|
+
function validateRepositoryForObject(node) {
|
|
13
|
+
if (isJSONStringLiteral(node.value)) context.report({
|
|
14
|
+
fix(fixer) {
|
|
15
|
+
if (!isJSONStringLiteral(node.value) || node.value.value.split("/").filter(Boolean).length !== 2) return null;
|
|
16
|
+
return fixer.replaceText(node.value, JSON.stringify({
|
|
17
|
+
type: "git",
|
|
18
|
+
url: `https://github.com/${node.value.value}`
|
|
19
|
+
}, null, 2));
|
|
20
|
+
},
|
|
21
|
+
messageId: "preferObject",
|
|
22
|
+
node: node.value
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function validateRepositoryForShorthand(node) {
|
|
26
|
+
if (isJSONStringLiteral(node.value)) {
|
|
27
|
+
const { value } = node.value;
|
|
28
|
+
if (typeof value === "string" && isGitHubUrl(value)) context.report({
|
|
29
|
+
fix(fixer) {
|
|
30
|
+
return fixer.replaceText(node.value, JSON.stringify(cleanGitHubUrl(value)));
|
|
31
|
+
},
|
|
32
|
+
messageId: "preferShorthand",
|
|
33
|
+
node: node.value
|
|
34
|
+
});
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (node.value.type !== "JSONObjectExpression") return;
|
|
38
|
+
const { properties } = node.value;
|
|
39
|
+
if (findPropertyWithKeyValue(properties, "directory")) return;
|
|
40
|
+
const typeProperty = findPropertyWithKeyValue(properties, "type");
|
|
41
|
+
if (typeProperty?.value.type !== "JSONLiteral" || typeProperty.value.value !== "git") return;
|
|
42
|
+
const urlProperty = findPropertyWithKeyValue(properties, "url");
|
|
43
|
+
if (urlProperty?.value.type !== "JSONLiteral" || typeof urlProperty.value.value !== "string" || !isGitHubUrl(urlProperty.value.value)) return;
|
|
44
|
+
const url = urlProperty.value.value;
|
|
45
|
+
context.report({
|
|
46
|
+
fix(fixer) {
|
|
47
|
+
return fixer.replaceText(node.value, JSON.stringify(cleanGitHubUrl(url)));
|
|
48
|
+
},
|
|
49
|
+
messageId: "preferShorthand",
|
|
50
|
+
node: node.value
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return { JSONProperty(node) {
|
|
54
|
+
if (node.key.type !== "JSONLiteral" || node.key.value !== "repository" || node.parent.parent.parent.type !== "Program") return;
|
|
55
|
+
if (form === "shorthand") validateRepositoryForShorthand(node);
|
|
56
|
+
else validateRepositoryForObject(node);
|
|
57
|
+
} };
|
|
58
|
+
},
|
|
59
|
+
meta: {
|
|
60
|
+
defaultOptions: [{ form: "object" }],
|
|
61
|
+
docs: {
|
|
62
|
+
category: "Best Practices",
|
|
63
|
+
description: "Enforce either object or shorthand declaration for repository.",
|
|
64
|
+
recommended: true
|
|
65
|
+
},
|
|
66
|
+
fixable: "code",
|
|
67
|
+
messages: {
|
|
68
|
+
preferObject: "Prefer an object locator for a repository.",
|
|
69
|
+
preferShorthand: "Prefer a shorthand locator for a GitHub repository."
|
|
70
|
+
},
|
|
71
|
+
schema: [{
|
|
72
|
+
additionalProperties: false,
|
|
73
|
+
properties: { form: {
|
|
74
|
+
description: "Specifies which repository form to enforce.",
|
|
75
|
+
enum: ["object", "shorthand"],
|
|
76
|
+
type: ["string"]
|
|
77
|
+
} },
|
|
78
|
+
type: "object"
|
|
79
|
+
}],
|
|
80
|
+
type: "suggestion"
|
|
81
|
+
},
|
|
82
|
+
name: "repository-shorthand"
|
|
116
83
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
};
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
export { rule };
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as jsonc_eslint_parser from 'jsonc-eslint-parser';
|
|
3
|
-
import { PackageJsonRuleContext } from '../createRule.js';
|
|
4
|
-
import 'estree';
|
|
1
|
+
import { PackageJsonRuleModule } from "../createRule.js";
|
|
5
2
|
|
|
3
|
+
//#region src/rules/require-properties.d.ts
|
|
6
4
|
declare const rules: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} | undefined)?]>): jsonc_eslint_parser.RuleListener;
|
|
11
|
-
meta: eslint.Rule.RuleMetaData;
|
|
12
|
-
};
|
|
5
|
+
[k: string]: PackageJsonRuleModule<[({
|
|
6
|
+
ignorePrivate?: boolean;
|
|
7
|
+
} | undefined)?]>;
|
|
13
8
|
};
|
|
14
|
-
|
|
15
|
-
export { rules };
|
|
9
|
+
//#endregion
|
|
10
|
+
export { rules };
|
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { createSimpleRequirePropertyRule } from "../utils/createSimpleRequirePropertyRule.js";
|
|
2
|
+
|
|
3
|
+
//#region src/rules/require-properties.ts
|
|
4
4
|
const properties = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
["author"],
|
|
6
|
+
["bugs"],
|
|
7
|
+
["bundleDependencies"],
|
|
8
|
+
["dependencies"],
|
|
9
|
+
["description", { isRecommended: true }],
|
|
10
|
+
["devDependencies"],
|
|
11
|
+
["engines"],
|
|
12
|
+
["files"],
|
|
13
|
+
["keywords"],
|
|
14
|
+
["name", {
|
|
15
|
+
ignorePrivateDefault: true,
|
|
16
|
+
isRecommended: true
|
|
17
|
+
}],
|
|
18
|
+
["optionalDependencies"],
|
|
19
|
+
["peerDependencies"],
|
|
20
|
+
["type", { isRecommended: true }],
|
|
21
|
+
["types"],
|
|
22
|
+
["version", {
|
|
23
|
+
ignorePrivateDefault: true,
|
|
24
|
+
isRecommended: true
|
|
25
|
+
}]
|
|
20
26
|
];
|
|
21
|
-
const rules = Object.fromEntries(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
rules
|
|
29
|
-
};
|
|
27
|
+
const rules = Object.fromEntries(properties.map(([propertyName, options]) => {
|
|
28
|
+
const { rule, ruleName } = createSimpleRequirePropertyRule(propertyName, options);
|
|
29
|
+
return [ruleName, rule];
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { rules };
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as jsonc_eslint_parser from 'jsonc-eslint-parser';
|
|
3
|
-
import { PackageJsonRuleContext } from '../createRule.js';
|
|
4
|
-
import 'estree';
|
|
1
|
+
import { PackageJsonRuleModule } from "../createRule.js";
|
|
5
2
|
|
|
3
|
+
//#region src/rules/restrict-dependency-ranges.d.ts
|
|
6
4
|
interface Option {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
forDependencyTypes?: string[];
|
|
6
|
+
forPackages?: string[];
|
|
7
|
+
forVersions?: string;
|
|
8
|
+
rangeType: RangeType | RangeType[];
|
|
11
9
|
}
|
|
12
10
|
type Options = [Option | Option[] | undefined];
|
|
13
11
|
declare const RANGE_TYPES: readonly ["caret", "pin", "tilde"];
|
|
14
12
|
type RangeType = (typeof RANGE_TYPES)[number];
|
|
15
|
-
declare const rule:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { rule };
|
|
13
|
+
declare const rule: PackageJsonRuleModule<Options>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { rule };
|