Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-named-as-default-member false positive, with default export with 'default' property #507

Closed
jquense opened this issue Aug 22, 2016 · 2 comments
Labels
Milestone

Comments

@jquense
Copy link
Contributor

jquense commented Aug 22, 2016

The following produces the incorrect error;

//bar.js
export default { 
  default: 'baz'
};
//foo.js
import bar from './bar';

const qux = bar.default;

It's incorrectly noting that there is a named export named "default", following the suggestion would lead to this: import bar, { default } from './bar which is clearly not right, and I'd suggest not ever what you want to do in this situation. Perhaps that if the property is from the default export, special case allowing 'default' as a property of that export?

edit: actually that would hold true for any named export, with a property of the same name as the export on it.

@benmosher
Copy link
Member

Your edit is correct. The nature of this rule is not to tell you that you've definitely done something wrong, just that you've matched a pattern that is likely a mistake.

In your case, it isn't a mistake, but not because it's named default.

I don't know if there is enough of a case for special-casing default versus other names. It would certainly be the only one.

Let me think about it for a little bit.

@benmosher
Copy link
Member

Yeah, okay, I think it makes sense to ignore default. Seems reasonably unlikely that anyone would be surprised that the default export is not a property of the default export. 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants