Skip to content

Commit 2dc9a13

Browse files
mpintljharb
authored andcommitted
[Fix] no-unused-modules: checkPkgFieldObject filters boolean fields from checks
1 parent 9800c51 commit 2dc9a13

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
2828
- [`dynamic-import-chunkname`]: prevent false report on a valid webpack magic comment ([#2330], thanks [@mhmadhamster])
2929
- [`export`]: do not error on TS export overloads ([#1590], thanks [@ljharb])
3030
- [`no-unresolved`], [`extensions`]: ignore type only exports ([#2436], thanks [@Lukas-Kullmann])
31-
- [Fix] `ExportMap`: add missing param to function ([#2589], thanks [@Fdawgs])
31+
- `ExportMap`: add missing param to function ([#2589], thanks [@Fdawgs])
32+
- [`no-unused-modules`]: `checkPkgFieldObject` filters boolean fields from checks ([#2598], thanks [@mpint])
3233

3334
### Changed
3435
- [Tests] [`named`]: Run all TypeScript test ([#2427], thanks [@ProdigySim])
@@ -1022,6 +1023,7 @@ for info on changes for earlier releases.
10221023

10231024
[`memo-parser`]: ./memo-parser/README.md
10241025

1026+
[#2598]: https://github.com/import-js/eslint-plugin-import/pull/2598
10251027
[#2589]: https://github.com/import-js/eslint-plugin-import/pull/2589
10261028
[#2588]: https://github.com/import-js/eslint-plugin-import/pull/2588
10271029
[#2582]: https://github.com/import-js/eslint-plugin-import/pull/2582
@@ -1697,6 +1699,7 @@ for info on changes for earlier releases.
16971699
[@mgwalker]: https://github.com/mgwalker
16981700
[@mhmadhamster]: https://github.com/MhMadHamster
16991701
[@MikeyBeLike]: https://github.com/MikeyBeLike
1702+
[@mpint]: https://github.com/mpint
17001703
[@mplewis]: https://github.com/mplewis
17011704
[@mrmckeb]: https://github.com/mrmckeb
17021705
[@msvab]: https://github.com/msvab

src/rules/no-unused-modules.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,10 @@ const fileIsInPkg = file => {
364364
};
365365

366366
const checkPkgFieldObject = pkgField => {
367-
const pkgFieldFiles = values(pkgField).map(value => join(basePath, value));
367+
const pkgFieldFiles = values(pkgField)
368+
.filter((value) => typeof value !== 'boolean')
369+
.map(value => join(basePath, value));
370+
368371
if (includes(pkgFieldFiles, file)) {
369372
return true;
370373
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"browser": {
3-
"browserObject": "./index.js"
3+
"browserObject": "./index.js",
4+
"an-ignored-module": false
45
}
56
}

0 commit comments

Comments
 (0)