Skip to content

fix(format/js): preserve newline in type alias if right side has a comment#8910

Merged
dyc3 merged 2 commits intomainfrom
dyc3/fix-8774
Jan 29, 2026
Merged

fix(format/js): preserve newline in type alias if right side has a comment#8910
dyc3 merged 2 commits intomainfrom
dyc3/fix-8774

Conversation

@dyc3
Copy link
Copy Markdown
Contributor

@dyc3 dyc3 commented Jan 29, 2026

Summary

Generated by glm-4.7

fixes #8774

Test Plan

snapshots

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 29, 2026

🦋 Changeset detected

Latest commit: 3ccc616

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages labels Jan 29, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 29, 2026

Walkthrough

This change fixes incorrect indentation of comments that appear after the equals sign in TypeScript type aliases with generic parameters that use extends. It adds a special-case in the AssignmentLike layout logic to prefer breaking after the operator for TsTypeAliasDeclaration, adds a test file exercising multiple type-alias/comment scenarios, and includes a changeset documenting the formatting fix for issue #8774.

Possibly related PRs

  • PR #8225: Adjusts assignment_like.rs/should_break_after_operator logic for TypeScript right-hand-side types (e.g., conditional types) and touches the same formatting decision path.

Suggested reviewers

  • dyc3
  • ematipico
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: preserving newlines in type aliases when comments follow the equals sign.
Description check ✅ Passed The description references the linked issue #8774 and explains the motivation, though it mentions AI-generation and provides minimal detail.
Linked Issues check ✅ Passed The PR successfully addresses the core requirement from #8774 by adding a special case for TsTypeAliasDeclaration to preserve newlines when comments appear after the equals sign.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the type alias comment indentation issue: formatter logic, test cases, and changelog.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jan 29, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing dyc3/fix-8774 (3ccc616) with main (f788cff)

Summary

✅ 58 untouched benchmarks
⏩ 95 skipped benchmarks1

Footnotes

  1. 95 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@dyc3 dyc3 merged commit 2fb63a4 into main Jan 29, 2026
17 checks passed
@dyc3 dyc3 deleted the dyc3/fix-8774 branch January 29, 2026 21:45
@github-actions github-actions Bot mentioned this pull request Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bad indentation in TypeScript generic type with comment after equals sign

2 participants