Skip to content

Fix parsing of stray commas in let/const declarations#1249

Open
skdoosh wants to merge 1 commit intoquick-lint:masterfrom
skdoosh:fix-trailing-comma-const-diagnostic
Open

Fix parsing of stray commas in let/const declarations#1249
skdoosh wants to merge 1 commit intoquick-lint:masterfrom
skdoosh:fix-trailing-comma-const-diagnostic

Conversation

@skdoosh
Copy link

@skdoosh skdoosh commented Mar 3, 2026

Fix parsing diagnostics for let and const statements. Fixes issue #639 :

  • Correctly distinguishes between no bindings (e.g., let\nx) and stray commas in multi-variable declarations (e.g., const [a, setA] = useState(), const [b, setB] = useState();).

  • Ensures the appropriate diagnostic is emitted:

    • Diag_Let_With_No_Bindings for entirely missing bindings.

    • Diag_Stray_Comma_In_Let_Statement for extra commas between declarations.

    • Diag_Unexpected_Token_In_Variable_Declaration otherwise.

  • Does not add any new tests or change existing functionality outside this parsing case.

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

CLA Assistant Lite bot Thank you for your contribution! Like many free software projects, you must sign our Contributor License Agreement before we can accept your contribution.

EDIT: All contributors have signed quick-lint-js' Contributor License Agreement (CLA-v1.md).

@skdoosh
Copy link
Author

skdoosh commented Mar 3, 2026

I have read and hereby agree to quick-lint-js' Contributor License Agreement (CLA-v1.md).

@skdoosh
Copy link
Author

skdoosh commented Mar 3, 2026

recheck

@skdoosh skdoosh marked this pull request as ready for review March 3, 2026 06:22
@skdoosh
Copy link
Author

skdoosh commented Mar 3, 2026

Hi @strager , this PR fixes the stray comma / unexpected token diagnostic in parse-let-bindings. All other tests pass and no other code is changed. Ready for review.

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

Successfully merging this pull request may close these issues.

1 participant