Skip to content

Fix Angular ngIf microsyntax colon formatting - #20051

Merged
fisker merged 1 commit into
prettier:mainfrom
splincode:fix/angular-ngif-else-microsyntax
Sep 13, 2026
Merged

fisker merged 1 commit into
prettier:mainfrom
splincode:fix/angular-ngif-else-microsyntax

Conversation

@splincode

Copy link
Copy Markdown
Contributor

Description

Fixes #15719.

Angular microsyntax printing only omitted the colon for then, else, and as at specific hard-coded positions. When a let declaration appeared before else, the key shifted to a later position and Prettier printed else:, producing invalid Angular syntax.

This change makes then, else, and as independent of their position in the microsyntax body while keeping the existing track handling unchanged.

Regression tests cover let before else, then / else after let, and multiple let declarations before else.

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.
  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

@pkg-pr-new

pkg-pr-new Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

yarn add https://pkg.pr.new/@prettier/[email protected]
yarn add https://pkg.pr.new/@prettier/[email protected]
yarn add https://pkg.pr.new/@prettier/[email protected]
yarn add https://pkg.pr.new/[email protected]

commit: e3a65bb

@netlify

netlify Bot commented Sep 13, 2026

Copy link
Copy Markdown

✅ Deploy Preview for prettier ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 3f3dd9f
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/6aa679182030c700089ddcbc
😎 Deploy Preview https://deploy-preview-20051--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for prettier ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit e3a65bb
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/6aa67b3a502cb30008f93c6c
😎 Deploy Preview https://deploy-preview-20051--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@splincode
splincode force-pushed the fix/angular-ngif-else-microsyntax branch from 56e7e3d to e3a65bb Compare September 13, 2026 10:30
@fisker
fisker merged commit d00ebd1 into prettier:main Sep 13, 2026
35 checks passed
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.

Prettier incorrectly adds a colon after ngIf else statement

2 participants