Skip to content

Commit

Permalink
check peerDependencies in imports-as-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
DetachHead committed Jun 10, 2023
1 parent 3a5dd7d commit e1c79f5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/rules/importsAsDependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,29 @@ let deps;
const setDeps = function () {
try {
const pkg = JSON.parse(
// @ts-expect-error It's ok
// @ts-expect-error It's ok
readFileSync(join(process.cwd(), './package.json')),
);
deps = new Set([
...(pkg.dependencies ?
Object.keys(pkg.dependencies) :
// istanbul ignore next
// istanbul ignore next
[]),
...(pkg.devDependencies ?
Object.keys(pkg.devDependencies) :
// istanbul ignore next
// istanbul ignore next
[]),
...(pkg.peerDependencies ?
Object.keys(pkg.peerDependencies) :
// istanbul ignore next
[]),
]);
} catch (error) {
// istanbul ignore next -- our package.json exists
} catch (error) { // istanbul ignore next -- our package.json exists
deps = null;
/* eslint-disable no-console -- Inform user */
// istanbul ignore next -- our package.json exists
console.log(error);
/* eslint-enable no-console -- Inform user */
/* eslint-enable no-console -- Inform user */
}
};

Expand Down

0 comments on commit e1c79f5

Please sign in to comment.