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: enable JSX parsing inside .vue files #3468

Merged
merged 3 commits into from
Aug 28, 2024
Merged

Conversation

ematipico
Copy link
Member

Summary

Closes #3464

Test Plan

I would like to add a test, but I couldn't find a file on the web

@github-actions github-actions bot added A-Project Area: project A-Changelog Area: changelog labels Jul 18, 2024
@ematipico ematipico requested review from a team July 18, 2024 15:00
@minht11
Copy link
Contributor

minht11 commented Jul 18, 2024

Vue supports jsx when lang attribute set as such lang=jsx without it, parser error is thrown, see

Should we also enable it based on attribute?

@ematipico
Copy link
Member Author

Vue supports jsx when lang attribute set as such lang=jsx without it, parser error is thrown, see

Should we also enable it based on attribute?

I believe the original issue comes from a V2 Vue component, but I'm not sure. I'm waiting for OP to share their whole code

@minht11
Copy link
Contributor

minht11 commented Jul 18, 2024

The problem enabling jsx on every vue file would that valid TS code like const fn = <T>() => {} would no longer be parsed correctly.

@ematipico
Copy link
Member Author

The problem enabling jsx on every vue file would that valid TS code like const fn = <T>() => {} would no longer be parsed correctly.

Wouldn't users need to add lang=ts in their <script> tag in order to do so?

@minht11
Copy link
Contributor

minht11 commented Jul 21, 2024

Sorry if I am wrong, doesn't this PR changes behavior that lang='ts' is being parsed as tsx and lang=js as jsx?

@ematipico
Copy link
Member Author

Ooooh, I see your point now! I'll fix it later

@github-actions github-actions bot added A-Parser Area: parser L-JavaScript Language: JavaScript and super languages labels Aug 27, 2024
Copy link
Contributor

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 48443 48443 0
Passed 47252 47252 0
Failed 1191 1191 0
Panics 0 0 0
Coverage 97.54% 97.54% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6568 6568 0
Passed 2201 2201 0
Failed 4367 4367 0
Panics 0 0 0
Coverage 33.51% 33.51% 0.00%

ts/babel

Test result main count This PR count Difference
Total 671 671 0
Passed 599 599 0
Failed 72 72 0
Panics 0 0 0
Coverage 89.27% 89.27% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18414 18414 0
Passed 14097 14097 0
Failed 4317 4317 0
Panics 0 0 0
Coverage 76.56% 76.56% 0.00%

@dyc3
Copy link
Contributor

dyc3 commented Aug 27, 2024

https://github.com/vuetifyjs/vuetify uses jsx/tsx a bunch, you could use those for tests

@ematipico ematipico merged commit ca10947 into main Aug 28, 2024
14 checks passed
@ematipico ematipico deleted the chore/fix-vue-module-kind branch August 28, 2024 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Parser Area: parser A-Project Area: project L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 JSX inside .vue files can not be formatted
5 participants