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

Unexpected comma at the end of condition block #38

Closed
sangxxh opened this issue Jun 15, 2023 · 1 comment
Closed

Unexpected comma at the end of condition block #38

sangxxh opened this issue Jun 15, 2023 · 1 comment

Comments

@sangxxh
Copy link

sangxxh commented Jun 15, 2023

Version: 1.5.0

Details

Related to marko-js/language-server#170

The root cause may be this prettier package.
Also if I remove the problematic comma mentioned in the linked issue, prettier check will complain.

Expected Behavior

  • It shouldn't cause Marko VSCode extension to insert the problematic comma
  • prettier --check shouldn't expect the problematic comma to be there.

Actual Behavior

It wants to put a comma indicated here, which break the TypeScript checking for the props when passed to <person-card>

- <if(thisPerson.address && thisPerson.phone && thisPerson.age && thisPerson.nationality)>
+ <if(
+   thisPerson.address &&
+   thisPerson.phone &&
+   thisPerson.age &&
+   thisPerson.nationality, <!-- -----------------NOTICE THIS COMMA HERE! -->
+ )>
  <person-card
    address=thisPerson.address
    phone=thisPerson.phone
    age=thisPerson.age
  />
</if>

Your Environment

  • Environment name and version (e.g. Chrome 39, node.js 5.4): Node v18.16.0.
  • Operating System and version (desktop or mobile): Windows 11, Ubuntu 20

Steps to Reproduce

See marko-js/language-server#170

Stack Trace

See marko-js/language-server#170

@DylanPiercey DylanPiercey mentioned this issue Jun 16, 2023
2 tasks
@DylanPiercey
Copy link
Contributor

#39 now causes prettier-plugin-marko to not emit trailing commas for args by default (better aligns with prettier for js).
The core issue is in the language server which we'll track in marko-js/language-server#170

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants