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

fix: import date-number from i18n instance #5

Merged
merged 3 commits into from
Oct 28, 2020
Merged

Conversation

semoal
Copy link
Contributor

@semoal semoal commented Oct 27, 2020

Fixes

  • I tough on a first instance that @lingui/core was exporting date, and number but isn't. So I've changed the codemod to do:
import { i18n } from "@lingui/core"

i18n.date()
i18n.number()
  • JSX expressions are sometimes different, like early returns, parenthesis etc, now practically all of them are handled correctly 💯

  • Select, Plural, SelectOrdinal imports from @lingui/react moved succesfully to @lingui/macro

I'll introduce some other minor fixes on this pull request that i found migrating other projects of my company, so pls don't merge yet

@semoal semoal added the enhancement New feature or request label Oct 27, 2020
@tricoder42
Copy link
Contributor

Yeah, sorry, date and number macros were removed

@semoal
Copy link
Contributor Author

semoal commented Oct 28, 2020

@tricoder42 https://lingui.js.org/ref/react.html

should we remove from this section the React components?, Plural, DateFormat,Numberformat, select, selectOrdinal doesn't exist anymore, am i right=?

@tricoder42
Copy link
Contributor

@semoal It's already removed in the new docs: https://js-lingui-git-next.lingui-js.now.sh/ref/react.html

@semoal
Copy link
Contributor Author

semoal commented Oct 28, 2020

Well after running this version of the codemod to 5 enterprise projects, the only pending issue was removing all the unused i18n variables. I searched a codemod to fix this but has too much nooks and crannies, so that's the only thing that the user has to search his i18n variables and remove the unused ones.. (eslint does the same, brings an error of remove-unused-vars, but eslint --fix doesnt fix cuz security)

I'll merge this and deploy this new version, probably enough stable for 99% cases 👍🏻

@semoal semoal marked this pull request as ready for review October 28, 2020 12:07
@semoal semoal merged commit e6ecd7e into main Oct 28, 2020
@semoal semoal deleted the improved-codemod branch October 28, 2020 12:07
@tricoder42
Copy link
Contributor

🎉 This PR is included in version 1.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants