Eslint-plugin-import: import/named and import/namespace errors after upgrading Babel

Created on 2 Jul 2020  路  10Comments  路  Source: benmosher/eslint-plugin-import

I was on @babel/core 7.8.x and upgraded to 7.10.x and suddenly started seeing errors for import/named and import/namespace.

I have something similar to:

./alpha/abc.js

export const A = 'A'
export const B = 'B'
export const C = 'C'

./alpha/def.js

export const D = 'D'
export const E = 'E'
export const F = 'F'

./alpha/index.js

export * as abc from './abc'
export * as def from './def'

And then in files that need it:

import * as alpha from 'path/to/alpha/index.js'

// do stuff with alpha.abc and alpha.def

I have babel-eslint and @babel/plugin-proposal-export-namespace-from installed. I'm on the latest eslint-plugin-import. Any thoughts?

bug help wanted

All 10 comments

What exact errors do you see?

'A' not found in imported namespace 'abc'      import/namespace
'B' not found in imported namespace 'abc'      import/namespace
'C' not found in imported namespace 'abc'      import/namespace
'D' not found in imported namespace 'def'      import/namespace
'E' not found in imported namespace 'def'      import/namespace
'F' not found in imported namespace 'def'      import/namespace

Thanks. Is there any chance you could make a PR with a failing test case? That's the fastest way I can make a fix and release it :-)

I was able to get a minimum repro of the issue here. I hope that helps!

Did the minimum repro help or do you still need a PR?

Sorry for the delay; the repro repo is perfect - now I just need to figure out how to fix it :-D

@eliw00d however, what i can't repro is everything working with babel/core 7.8. Any chance you can reproduce everything _passing_ with the same code (but different dep versions)?

Hi! Same issue :(

"@babel/core": "7.12.10",
"@babel/eslint-parser": "7.12.1",
"@babel/plugin-proposal-export-namespace-from": "7.12.1",

"eslint": "7.16.0",
"eslint-plugin-import": "2.22.1",

In the file where import ns - import/named: ns not found in module

export * as ns from 'mod';

nvim

@VladimirPal i can reproduce the failure, but i can't reproduce it ever working in the first place.

@ljharb @eliw00d Looks like the issue is with babel-eslint. It's 10.1.0 in the reproduction repo: package.json#L11

If you downgrade to a lower version (I used 8.2.6), the tests pass.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

msuntharesan picture msuntharesan  路  29Comments

JustFly1984 picture JustFly1984  路  41Comments

yamov picture yamov  路  29Comments

ljharb picture ljharb  路  29Comments

ThomasdenH picture ThomasdenH  路  31Comments