Skip to content

Commit 3314997

Browse files
committed
check peerDependencies in imports-as-dependencies
1 parent 3a5dd7d commit 3314997

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/rules/importsAsDependencies.js

+20-18
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,26 @@ import {
1717
*/
1818
let deps;
1919

20-
const setDeps = function () {
21-
try {
22-
const pkg = JSON.parse(
23-
// @ts-expect-error It's ok
24-
readFileSync(join(process.cwd(), './package.json')),
25-
);
26-
deps = new Set([
27-
...(pkg.dependencies ?
28-
Object.keys(pkg.dependencies) :
29-
// istanbul ignore next
30-
[]),
31-
...(pkg.devDependencies ?
32-
Object.keys(pkg.devDependencies) :
33-
// istanbul ignore next
34-
[]),
35-
]);
36-
} catch (error) {
37-
// istanbul ignore next -- our package.json exists
20+
const setDeps = function () {try {
21+
const pkg = JSON.parse(
22+
// @ts-expect-error It's ok
23+
readFileSync(join(process.cwd(), './package.json')),
24+
);
25+
deps = new Set([
26+
...(pkg.dependencies ?
27+
Object.keys(pkg.dependencies) :
28+
// istanbul ignore next
29+
[]),
30+
...(pkg.devDependencies ?
31+
Object.keys(pkg.devDependencies) :
32+
// istanbul ignore next
33+
[]),
34+
...(pkg.peerDependencies ?
35+
Object.keys(pkg.peerDependencies) :
36+
// istanbul ignore next
37+
[]),
38+
]);
39+
} catch (error) {// istanbul ignore next -- our package.json exists
3840
deps = null;
3941
/* eslint-disable no-console -- Inform user */
4042
// istanbul ignore next -- our package.json exists

0 commit comments

Comments
 (0)