Skip to content

feat(@angular/cli): support Oxfmt for automatic file formatting - #34460

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
cexbrayat:feat/oxfmt-autoformatting
Oct 28, 2026
Merged

alan-agius4 merged 1 commit into
angular:mainfrom
cexbrayat:feat/oxfmt-autoformatting

Conversation

@cexbrayat

Copy link
Copy Markdown
Member

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

The only auto formatting supported out if the box is prettier

What is the new behavior?

If the project has oxfmt installed, then oxfmt is preferred. Prettier is then used as a fallback to preserve the existing behavior.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: @angular/cli labels Oct 21, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the Angular CLI formatting utility to support both oxfmt and prettier as formatters, renaming the utility file and updating imports and tests accordingly. The review feedback suggests improving robustness and performance by caching the resolved formatter path at the module level to avoid redundant disk I/O. Additionally, it points out that the --no-error-on-unmatched-pattern flag should only be passed to prettier, as oxfmt uses strict argument parsing and will fail if an unknown option is provided.

Comment thread packages/angular/cli/src/utilities/formatting.ts Outdated
Comment thread packages/angular/cli/src/utilities/formatting.ts
Comment thread packages/angular/cli/src/utilities/formatting.ts
@alan-agius4 alan-agius4 added target: minor This PR is targeted for the next minor release action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Oct 27, 2026

@alan-agius4 alan-agius4 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for working on this! Left a few comments regarding formatter precedence, caching during ng update, and E2E test cleanup.

Comment thread packages/angular/cli/src/utilities/formatting.ts Outdated
Comment thread packages/angular/cli/src/utilities/formatting.ts Outdated
Comment thread tests/e2e/tests/generate/formatting.ts Outdated
Comment thread tests/e2e/tests/generate/formatting.ts
@cexbrayat
cexbrayat force-pushed the feat/oxfmt-autoformatting branch from 8fc3c20 to b17c46a Compare October 27, 2026 22:55
@cexbrayat

Copy link
Copy Markdown
Member Author

Thanks for the review @alan-agius4 !

I amended the commit with your feedback.

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Oct 28, 2026
@alan-agius4

Copy link
Copy Markdown
Collaborator

@cexbrayat, thanks for this.

@alan-agius4
alan-agius4 merged commit 7d6550e into angular:main Oct 28, 2026
40 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/cli detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants