Skip to content

Commit

Permalink
[Fix] no-unused-modules: checkPkgFieldObject filters boolean fiel…
Browse files Browse the repository at this point in the history
…ds from checks
  • Loading branch information
mpint committed Nov 15, 2022
1 parent 6a9d6f2 commit 20e11f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/rules/no-unused-modules.js
Expand Up @@ -364,7 +364,10 @@ const fileIsInPkg = file => {
};

const checkPkgFieldObject = pkgField => {
const pkgFieldFiles = values(pkgField).map(value => join(basePath, value));
const pkgFieldFiles = values(pkgField)
.filter((value) => typeof value !== 'boolean')
.map(value => join(basePath, value));

if (includes(pkgFieldFiles, file)) {
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/files/no-unused-modules/browserObject/package.json
@@ -1,5 +1,6 @@
{
"browser": {
"browserObject": "./index.js"
"browserObject": "./index.js",
"an-ignored-module": false
}
}

0 comments on commit 20e11f7

Please sign in to comment.