File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,15 @@ module.exports = {
15
15
16
16
create ( context ) {
17
17
function checkDefault ( nameKey , defaultSpecifier ) {
18
+
19
+ /**
20
+ * For ImportDefaultSpecifier we're interested in the "local" name (`foo` for `import {bar as foo} ...`)
21
+ * For ExportDefaultSpecifier we're interested in the "exported" name (`foo` for `export {bar as foo} ...`)
22
+ */
23
+ const analyzedName = defaultSpecifier [ nameKey ] . name ;
24
+
18
25
// #566: default is a valid specifier
19
- if ( defaultSpecifier [ nameKey ] . name === 'default' ) { return ; }
26
+ if ( analyzedName === 'default' ) { return ; }
20
27
21
28
const declaration = importDeclaration ( context ) ;
22
29
@@ -28,7 +35,15 @@ module.exports = {
28
35
return ;
29
36
}
30
37
31
- if ( imports . has ( 'default' ) && imports . has ( defaultSpecifier [ nameKey ] . name ) ) {
38
+ if ( imports . has ( 'default' ) && imports . has ( analyzedName ) ) {
39
+
40
+ // #1594: the imported module exports the same thing via a default export and a named export
41
+ const namedExportInImportedModule = imports . reexports . get ( analyzedName ) ;
42
+ const defaultExportInImportedModule = imports . reexports . get ( 'default' ) ;
43
+ if ( defaultExportInImportedModule . getImport ( ) . path === namedExportInImportedModule . getImport ( ) . path
44
+ && defaultExportInImportedModule . local === namedExportInImportedModule . local ) {
45
+ return ;
46
+ }
32
47
33
48
context . report (
34
49
defaultSpecifier ,
You can’t perform that action at this time.
0 commit comments