Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
- [`dynamic-import-chunkname`]: prevent false report on a valid webpack magic comment ([#2330], thanks [@mhmadhamster])
- [`export`]: do not error on TS export overloads ([#1590], thanks [@ljharb])
- [`no-unresolved`], [`extensions`]: ignore type only exports ([#2436], thanks [@Lukas-Kullmann])
- [Fix] `ExportMap`: add missing param to function ([#2589], thanks [@Fdawgs])
- `ExportMap`: add missing param to function ([#2589], thanks [@Fdawgs])
- [`no-unused-modules`]: `checkPkgFieldObject` filters boolean fields from checks ([#2598], thanks [@mpint])

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

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

[#2598]: https://github.com/import-js/eslint-plugin-import/pull/2598
[#2589]: https://github.com/import-js/eslint-plugin-import/pull/2589
[#2588]: https://github.com/import-js/eslint-plugin-import/pull/2588
[#2582]: https://github.com/import-js/eslint-plugin-import/pull/2582
Expand Down Expand Up @@ -1697,6 +1699,7 @@ for info on changes for earlier releases.
[@mgwalker]: https://github.com/mgwalker
[@mhmadhamster]: https://github.com/MhMadHamster
[@MikeyBeLike]: https://github.com/MikeyBeLike
[@mpint]: https://github.com/mpint
[@mplewis]: https://github.com/mplewis
[@mrmckeb]: https://github.com/mrmckeb
[@msvab]: https://github.com/msvab
Expand Down
5 changes: 4 additions & 1 deletion src/rules/no-unused-modules.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"browser": {
"browserObject": "./index.js"
"browserObject": "./index.js",
"an-ignored-module": false
}
}
10 changes: 5 additions & 5 deletions tests/src/core/getExports.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ describe('ExportMap', function () {

let imports;
before('load imports', function () {
this.timeout(20000); // takes a long time :shrug:
this.timeout(20e3); // takes a long time :shrug:
sinon.spy(tsConfigLoader, 'tsConfigLoader');
imports = ExportMap.get('./typescript.ts', context);
});
Expand Down Expand Up @@ -436,13 +436,13 @@ describe('ExportMap', function () {
it('should cache after parsing for an ambiguous module', function () {
const source = './typescript-declare-module.ts';
const parseSpy = sinon.spy(ExportMap, 'parse');

expect(ExportMap.get(source, context)).to.be.null;

ExportMap.get(source, context);

expect(parseSpy.callCount).to.equal(1);

parseSpy.restore();
});
});
Expand Down
4 changes: 2 additions & 2 deletions tests/src/core/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ describe('resolve', function () {

// special behavior for infinity
describe('infinite cache', function () {
this.timeout(1500);
this.timeout(1.5e3);

before((done) => setTimeout(done, 1100));

Expand All @@ -414,7 +414,7 @@ describe('resolve', function () {
});

describe('finite cache', function () {
this.timeout(1200);
this.timeout(1.2e3);
before((done) => setTimeout(done, 1000));
it('gets correct values after cache lifetime', function () {
expect(resolve(original, context)).not.to.exist;
Expand Down
4 changes: 3 additions & 1 deletion tests/src/rules/no-unused-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,16 @@ ruleTester.run('no-unused-modules', rule, {
});


describe('dynamic imports', () => {
describe('dynamic imports', function () {
if (semver.satisfies(eslintPkg.version, '< 6')) {
beforeEach(function () {
this.skip();
});
return;
}

this.timeout(10e3);

// test for unused exports with `import()`
ruleTester.run('no-unused-modules', rule, {
valid: [
Expand Down