Default exports
alexlafroscia opened this issue · 5 comments
Is there a reason that default exports aren't supported by this?
I tried to prevent named things to be tagged twice or more.
const foo = 1;
export default foo;
foo
is already taken care of by another rule so I don't need it to be tagged a second time.
In the examples given on MDN:
export default expression;
export default function (…) { … } // also class, function*
export default function name1(…) { … } // also class, function*
export { name1 as default, … };
the only case that would warrant tagging would be the third one but I'm not sure how common it is. The others are not named so they are not interesting.
Yeah, that makes sense. However, there is the use case where the default export has no other name.
For example, there's no reason a module can't just do
export default 1;
That doesn't actually make sense, but this pattern is really common with Ember applications where you export a Controller
or Route
import Controller from '@ember/controller';
export default Controller.extend({
// ... stuff
});
Unfortunately they're not "real" classes so the normal Class tagging doesn't help at all.
Point taken. If you feel like writing basic regexp you are welcome to send a PR otherwise I'll probably tackle the problem this week-end.
No rush. I also totally understand your reasoning and if you're not interesting in supporting it, that's fine too. Eventually Ember will get ES6 classes and this particular use-case will go away, but in the meantime it's hard to use CTags with an Ember project, even with these improvements.