You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 importswill 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
The text was updated successfully, but these errors were encountered:
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
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.
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
update-react-imports
through the repos of VTEX and opening a PR with these changesThe text was updated successfully, but these errors were encountered: