Skip to content

Commit d3082bd

Browse files
committed
Check if an imported name of 'default' is used.
1 parent 5f8469f commit d3082bd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/rules/no-unused-modules.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,12 @@ module.exports = {
453453
}
454454
}
455455

456-
const exportStatement = exports.get(exportedValue)
456+
// exportsList will always map any imported value of 'default' to 'ImportDefaultSpecifier'
457+
const exportsKey = exportedValue === DEFAULT ? IMPORT_DEFAULT_SPECIFIER : exportedValue
457458

458-
const value = exportedValue === IMPORT_DEFAULT_SPECIFIER ? DEFAULT : exportedValue
459+
const exportStatement = exports.get(exportsKey)
460+
461+
const value = exportsKey === IMPORT_DEFAULT_SPECIFIER ? DEFAULT : exportsKey
459462

460463
if (typeof exportStatement !== 'undefined'){
461464
if (exportStatement.whereUsed.size < 1) {

0 commit comments

Comments
 (0)