sibelius / ast-i18n

Easily migrate your existing React codebase to use i18n
MIT License
215 stars 18 forks source link

Update babel to support newer syntax #77

Closed wdoug closed 3 years ago

wdoug commented 3 years ago

Summary

Currently, if I try to run the string extractor from this project it fails to parse any newer syntax that the current versions of babel in this project don't support. One specific example is that it fails to parse TypeScript 3.8's import type syntax. This results in a BABEL_PARSE_ERROR being logged and that file failing to successfully extract strings to the resources.tsx file.

Test Plan

After upgrading these babel dependencies, I ran the string extractor (yarn start --src=FILES) on a bunch of different files and different selections of files and it had no issue. I also ran the codemod on a bunch of files and that continued to work as expected.

What's required for testing (prerequisites)?

Pulling this branch, installing, and running it on some code

What are the steps to reproduce (after prerequisites)?

You can reproduce the original bug by running the master version of this project on code that has import type Foo from 'bar'; in the file.

Compatibility

OS Implemented
iOS

Checklist

sibelius commented 3 years ago

Can you also bump package.json?

wdoug commented 3 years ago

I bumped the patch version. Let me know if there is anything else

sibelius commented 3 years ago

You should the dependencies and devDependencies

Use yarn outdated or yarn upgrade

sibelius commented 3 years ago

the bump should be like this https://github.com/sibelius/ast-i18n/pull/78

that pr is breaking a few tests, feel free to try to fix them

or just upgrade the babel packages on package.json

wdoug commented 3 years ago

the bump should be like this #78

When I did that it broke things so I just used yarn upgrade --scope @babel instead, which fixed the problem that I was having and didn't break tests.

My personal request would be to merge this first to address that one specific issue and then do a follow-up that does a more thorough update of versions like you have in #78 when there is time to investigate why things are breaking there. What do you think?

sibelius commented 3 years ago

let's try that, tks

wdoug commented 3 years ago

Thanks!