feat(parser): improve trailing comma error messages#15267
feat(parser): improve trailing comma error messages#15267graphite-app[bot] merged 1 commit intomainfrom
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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 Performance ReportMerging #15267 will not alter performanceComparing Summary
|
dedfa97 to
e0dba36
Compare
There was a problem hiding this comment.
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_commadiagnostic function to standardize trailing comma error reporting - Updates error messages for index signatures and parenthesized expressions to be more descriptive
- Refactors
rest_element_trailing_commato 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.
Merge activity
|
Improved error message for trailing comma related errors (e.g. `('foo',)`, ` type A = { [key: string,]: string; }`).
e0dba36 to
5f203c6
Compare

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