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

Prefer destructured named imports in React instead default export #68

Open
gtkatakura opened this issue Sep 22, 2020 · 1 comment
Open
Labels
enhancement stale This will not be worked on

Comments

@gtkatakura
Copy link
Contributor

Is your feature request related to a problem? Please describe.

React has a new release candidate with the New JSX Transform that says in the post that destructured named imports will be the preferred style to import code in React. Using named imports we can have tree shaking and more readability. I think we could have a rule to enforces this pattern for React.

Describe the solution you'd like

Create a lint rule for detects the use of React's functions that could be a named import (like React.createContext, React.useEffect, React.useMemo, etc) and notify an error (we could implement an auto-correction to named import based in update-react-imports or see another lint that maybe already do it)

** Maybe we can do it to some imports of TypeScript like React.FC, etc.

Describe alternatives you've considered

  • Create a eslint rule
  • Extra: create a script to run the update-react-imports through the repos of VTEX and opening a PR with these changes
@gtkatakura gtkatakura changed the title Prefer destructured named imports in React instead using default export Prefer destructured named imports in React instead default export Sep 22, 2020
@stale
Copy link

stale bot commented Oct 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
You can add the fresh label to prevent me from taking any action.
If this is a discussion thread, the most voted option will be final. Thank you for your contributions.

@stale stale bot added the stale This will not be worked on label Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement stale This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants