Repository navigation
Fix unstable comments before generic function type parameters - #20374
Arham-Begani wants to merge 2 commits into
Conversation
Keep comments between a named function and its type parameters attached to the type parameters across formatting passes, and print the separating space. Add repeat-format and parser-consistency coverage for TypeScript and Flow. Fixes prettier#9570
✅ Deploy Preview for prettier ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Record the TypeScript and Flow behavior correction for prettier#20374, with the verified Prettier 3.9.9 before/after example.
|
The final head is The current Dev, Prod, Lint, Check Sizes and autofix.ci workflows are awaiting fork-CI authorization. Could a maintainer approve these runs when convenient? The PR description records the local regression evidence, 72,932-test broad run and final focused checks; no upstream test pass is claimed. This status update was prepared with AI assistance, as disclosed in the PR. |
|
Following up on ab35073. Could a maintainer approve the pending fork-CI runs and review the generic function type comment fix when convenient? The implementation is unchanged, and the branch merges cleanly with current main. Please let me know if an additional regression case or scope adjustment would help. |
Description
Fixes #9570. A comment between a function's name and its type parameters attached to different nodes depending on surrounding line breaks. Formatting therefore changed its own output on subsequent passes.
Keep these comments attached to the type parameters in all three comment placements, and print a separating space after the function name. The change covers named function declarations and expressions, including TypeScript ambient declarations. Anonymous functions and non-generic functions retain their existing handling.
The regression fails on the parent: four repeat-format checks fail. With the fix, the JavaScript/TypeScript/Flow run passes 72,932 tests across 1,037 suites under FULL_TEST=1, including AST and repeat-format checks. After adding Flow coverage and renaming the private node guard, the final focused run passes 183 tests without updating snapshots. Type checking, focused ESLint and formatting checks pass on Node 24.19.0 with the pinned Yarn 4.18.1.
This implementation, analysis and description were prepared with OpenAI Codex assistance. The contributor personally reviewed the implementation and tests, confirmed understanding and ability to explain them, and authorized submission.
Checklist
docs/directory). No API or CLI change.changelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md. Added changelog_unreleased/typescript/20374.md after PR creation, as CONTRIBUTING.md specifies.Upstream Actions on
ab350738669c8ab84cf90825b479053456c34dc8have not executed yet: Dev, Prod, Lint, Check Sizes and autofix.ci await maintainer authorization. Local results above are separate from upstream validation.