Skip to content

Commit

Permalink
fix: ignore @types/* packages in engine check
Browse files Browse the repository at this point in the history
  • Loading branch information
voxpelli committed Apr 4, 2024
1 parent 6a6cb9f commit f87823e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/check-version-range.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import { getObjectValueByPath, getStringValueByPath } from './utils.js';
/**
* @typedef VersionRangeOptions
* @property {boolean|undefined} [expectedInDependencies=false] When set a warning will be issued when the key is empty or not found in a dependency
* @property {boolean|undefined} [noDev=false] If set then dev dependencies won't be included in the check
* @property {boolean|undefined} [ignoreDefinitelyTyped=false] When set, all DefinitelyTyped packages will be ignored
* @property {string[]|((test: string) => boolean)|undefined} [ignore] If set then the specified module names won't be included in the
* @property {boolean|undefined} [noDev=false] If set then dev dependencies won't be included in the check
* @property {boolean|undefined} [strict=false] Converts most warnings into failures
*/

Expand All @@ -26,6 +27,7 @@ import { getObjectValueByPath, getStringValueByPath } from './utils.js';
export function checkVersionRange (pkg, key, installed, options) {
const {
ignore,
ignoreDefinitelyTyped,
noDev = false,
strict = false,
} = options || {};
Expand Down Expand Up @@ -58,6 +60,9 @@ export function checkVersionRange (pkg, key, installed, options) {
if (ignoreMatcher && ignoreMatcher(dependency)) {
continue;
}
if (ignoreDefinitelyTyped && dependency.startsWith('@types/')) {
continue;
}
if (dependency === pkg.name) {
continue;
}
Expand Down
1 change: 1 addition & 0 deletions lib/perform-installed-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export async function performInstalledCheck (checks, pkg, installed, options) {
...checkOptions,
defaultKeys: ['node'],
expectedInDependencies: true,
ignoreDefinitelyTyped: true,
}),
checks.includes('peer') && checkVersions(pkg, 'peerDependencies', installed, checkOptions),
];
Expand Down

0 comments on commit f87823e

Please sign in to comment.