-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
Extraction breaks for whole file when using shorthand JSX fragments #86
Comments
I have a PR ready which fixes this by replaces the unmaintained acorn-jsx-walk with the much more modern acorn-jsx. It still needs this change to be merged into and released by acorn-jsx, but as soon as it's out I'll submit my PR here. |
I am also having issues with the scanner and parsing some ES6 features. Looking forward to this! |
Yeah, still waiting for that PR to get merged upstream unfortunately :-/ |
Up. Buggy, it even can not extract translations from props e.g. |
@MiroslavPetrik Unless you're using shorthand JSX fragments you should probably open a separate issue. |
@MiroslavPetrik I opened a new issue #90 for this case. Fixed in v2.6.4 with test cases below: <Component render={(<Trans>translation from props</Trans>)} />
<Component render={(<Component render={(<Trans>translation from nested props</Trans>)} />)} /> |
@beheh since my patch has been released, can you check again with |
@ctavan Sorry for the delay and thanks for your work, this is indeed fixed now! |
When attempting to parse a file on 2.6.2 that contains a shorthand JSX fragment (
<>like this</>
), the scanner fails to parse the whole file and doesn't include any string from it.While we can replace the fragments in our code base with (
<React.Fragment>like this</React.Fragment>
), we'd like to be able to use them. The biggest problem is that the existance of one shorthand fragment breaks a whole file, not just the Trans components using it/inside it.From a cursory look it seems like
acorn-jsx-walk
hasn't been updated since 2016, so it may be using some old babel or custom code under the hood that is unable to cope with shorthand fragments. When runningi18next-scanner
in debug mode, I get the following message:Writing a test should be trivial.
Version
Configuration
The text was updated successfully, but these errors were encountered: