Skip to content

feat(parser): improve trailing comma error messages#15267

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-03-feat_parser_improve_trailing_comma_error_messages
Nov 4, 2025
Merged

feat(parser): improve trailing comma error messages#15267
graphite-app[bot] merged 1 commit intomainfrom
11-03-feat_parser_improve_trailing_comma_error_messages

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Nov 4, 2025

Improved error message for trailing comma related errors (e.g. ('foo',), type A = { [key: string,]: string; }).

@github-actions github-actions bot added A-parser Area - Parser C-enhancement Category - New feature or request labels Nov 4, 2025
Copy link
Member Author

sapphi-red commented Nov 4, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 4, 2025

CodSpeed Performance Report

Merging #15267 will not alter performance

Comparing 11-03-feat_parser_improve_trailing_comma_error_messages (e0dba36) with main (d6996d0)

Summary

✅ 37 untouched

@sapphi-red sapphi-red force-pushed the 11-03-feat_parser_improve_trailing_comma_error_messages branch from dedfa97 to e0dba36 Compare November 4, 2025 12:18
@sapphi-red sapphi-red marked this pull request as ready for review November 4, 2025 12:24
Copilot AI review requested due to automatic review settings November 4, 2025 12:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors error messages for trailing commas in TypeScript and JavaScript parsers by introducing a new generic unexpected_trailing_comma function to provide more descriptive and consistent error messages.

  • Introduces a new unexpected_trailing_comma diagnostic function to standardize trailing comma error reporting
  • Updates error messages for index signatures and parenthesized expressions to be more descriptive
  • Refactors rest_element_trailing_comma to use the new generic function

Reviewed Changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/oxc_parser/src/diagnostics.rs Adds new unexpected_trailing_comma function and refactors rest_element_trailing_comma to use it
crates/oxc_parser/src/ts/types.rs Updates index signature trailing comma error to use new diagnostic function
crates/oxc_parser/src/js/expression.rs Updates parenthesized expression trailing comma error to use new diagnostic function
tasks/coverage/snapshots/parser_typescript.snap Updates snapshot tests to reflect improved error messages
tasks/coverage/snapshots/parser_babel.snap Updates snapshot tests to reflect improved error messages
tasks/track_memory_allocations/allocs_parser.snap Updates memory allocation statistics for cal.com.tsx

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Nov 4, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 4, 2025

Merge activity

Improved error message for trailing comma related errors (e.g. `('foo',)`, ` type A = { [key: string,]: string; }`).
@graphite-app graphite-app bot force-pushed the 11-03-feat_parser_improve_trailing_comma_error_messages branch from e0dba36 to 5f203c6 Compare November 4, 2025 13:13
@graphite-app graphite-app bot merged commit 5f203c6 into main Nov 4, 2025
21 checks passed
@graphite-app graphite-app bot deleted the 11-03-feat_parser_improve_trailing_comma_error_messages branch November 4, 2025 13:18
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments