Open jfmengels opened 7 years ago
I might take a crack at this.
no-named-as-default
seems to be the closest existing rule to the one you're describing. It prevents the use of a named export's name when importing the default export. Docs. Perhaps that rule could be generalized for the case you're describing?
That'd be great @ntdb! Just wait on a :+1: from @benmosher maybe?
Yes, no-named-as-default
is very close. I think we can copy most of the logic inside it, but it should be a separate rule, as it would be an unwarranted breaking change IMO (an the name would be misleading).
@ntdb any chance you'd be able to still make this PR?
I just noticed the the following is considered to be valid syntax by both espree and babel-eslint.
We should add a rule that forbids:
{a, a}
{a, b as a}
{b as a, c as a}
To discuss:
{b as a, c as b}
I'm pretty sure we had a rule to forbid
import {b as a} from 'foo'
whena
is also a named export of that module, but I don't remember which one. If we don't, let me know, and I'll create an issue, because that sounds like a nice style issue to have. That might fill the role of the lastto discuss
item?I propose the name
no-duplicate-named
, but I'm open to better names :)