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

Default exports #7

Closed
alexlafroscia opened this issue Mar 20, 2018 · 5 comments
Closed

Default exports #7

alexlafroscia opened this issue Mar 20, 2018 · 5 comments

Comments

@alexlafroscia
Copy link

Is there a reason that default exports aren't supported by this?

@romainl
Copy link
Owner

romainl commented Mar 21, 2018

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.

@alexlafroscia
Copy link
Author

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.

@romainl
Copy link
Owner

romainl commented Mar 21, 2018

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.

@alexlafroscia
Copy link
Author

alexlafroscia commented Mar 21, 2018

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.

sukima added a commit to sukima/ctags-patterns-for-javascript that referenced this issue Aug 19, 2018
Example:

    export default function foobar() {}

Fixes issue romainl#7
@romainl
Copy link
Owner

romainl commented Aug 19, 2018

@sukima's PR seems to fix this for good.

@romainl romainl closed this as completed Aug 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants