Eslint-plugin-import: [import/default] False positive when exporting a default value using destructuring

Created on 7 Sep 2016  路  5Comments  路  Source: benmosher/eslint-plugin-import

Exporting a default value using destructuring seems to cause a false positive. Example:

_store.js_

// Export a default value
export { mapGetters as default } from 'vuex';
// This is the equivalent that correctly works
// import { mapGetters } from 'vuex';
// export default mapGetters;

// Other exports...
export const USER = 'user';

_file.js_

import mapGetters, { USER } from './store.js';
// ESLint says: (import/default) No default export found in module.

I'm using transform-export-extensions.

bug help wanted

Most helpful comment

Ah, yeah, so this is the classic problem where deep checks don't properly respect ignore semantics.

TL;DR: will fix, have a failing test case 馃槑

All 5 comments

Wild. I could have sworn there was a test for this. Will check it out.

Ah, yeah, maybe it is the from 'vuex' that's killing it. There is a test for named default export, but not for exporting from. (though I'd expect it to work).

A PR with a failing test would be much appreciated. 馃

I tried but I can't understand the tests structure... I created a test that imports an unexististing file and it did pass anway... :confused:

Fair enough, thanks for trying.

(and yeah, the default rule does not enforce anything if the module can't be resolved; that responsibility is left to no-unresolved)

Ah, yeah, so this is the classic problem where deep checks don't properly respect ignore semantics.

TL;DR: will fix, have a failing test case 馃槑

Was this page helpful?
0 / 5 - 0 ratings