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

Should we implement eslint rule: import/no-default-export? #4

Closed
ThijsTyZ opened this issue Nov 13, 2020 · 5 comments · Fixed by #39
Closed

Should we implement eslint rule: import/no-default-export? #4

ThijsTyZ opened this issue Nov 13, 2020 · 5 comments · Fixed by #39

Comments

@ThijsTyZ
Copy link

Maybe we should also consider this rule: import/no-default-export. I never worked with that rule enabled so I don't know the downsides, but sometimes I run into problems when refactoring in the IDE that names are not updated because of the default export. I don't know if there is an added value for default exports over named exports.

Originally posted by @hjeti in mediamonks/frontend-coding-standards#6 (comment)

@psimk psimk transferred this issue from mediamonks/frontend-coding-standards Feb 8, 2021
@psimk
Copy link

psimk commented Mar 18, 2022

yes; can I add it now ? :)

@ThaNarie
Copy link
Member

I suggest looking at your codebases, and see how often this is still used.

Maybe not in the normal "components" that you write, but more in other supported files (often around tooling).

  • Especially files that are loaded as "configuration" dynamically are expected to have a single default export (like webpack, monck, plop, etc)
  • So do story files (their meta)

Are we okay with either manually configuring them all, or constantly disabling those linting rules there?

@psimk
Copy link

psimk commented Mar 18, 2022

We use it often, because we are used to it. The vue-skeleton even has the opposite rule - prefer default export, when there's a single export.

We can enable this rule only for the /src directory, excluding *.stories.ts files. This would having to deal with it in configuration files.

@ThaNarie
Copy link
Member

We use it often, because we are used to it

Sorry, I meant to say; legitimate use (according to our proposed conventions)

We can enable this rule only for the /src directory, excluding *.stories.ts files.

That would be a sound option.

👿 Are we okay with "hardcoding" the src folder in our linting rules? File extensions are pretty universal, but folder names or their location in projects could change?

@leroykorterink
Copy link
Collaborator

Default exports are used to export components in pages in the NextJS framework. I'm updating the configuration to disallow unnamed default exports, default exports will still be allowed.

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

Successfully merging a pull request may close this issue.

4 participants