From 5faafa79fd7e11caca16429da27ea5a473868532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Exbrayat?= Date: Wed, 21 Oct 2026 02:00:17 +0000 Subject: [PATCH] feat(@schematics/angular): use Oxfmt in generated workspaces --- .../angular/utility/latest-versions/package.json | 2 +- .../angular/workspace/files/.oxfmtrc.json.template | 13 +++++++++++++ .../angular/workspace/files/.prettierrc.template | 12 ------------ .../angular/workspace/files/package.json.template | 2 +- packages/schematics/angular/workspace/index_spec.ts | 2 ++ 5 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 packages/schematics/angular/workspace/files/.oxfmtrc.json.template delete mode 100644 packages/schematics/angular/workspace/files/.prettierrc.template diff --git a/packages/schematics/angular/utility/latest-versions/package.json b/packages/schematics/angular/utility/latest-versions/package.json index 75481eb2b23d..6cdaf9696f55 100644 --- a/packages/schematics/angular/utility/latest-versions/package.json +++ b/packages/schematics/angular/utility/latest-versions/package.json @@ -18,8 +18,8 @@ "karma": "~6.4.0", "jsdom": "^30.0.0", "less": "^4.2.0", + "oxfmt": "^0.74.0", "postcss": "^8.5.3", - "prettier": "^3.8.1", "rxjs": "~7.8.0", "tailwindcss": "^4.1.12", "@tailwindcss/postcss": "^4.1.12", diff --git a/packages/schematics/angular/workspace/files/.oxfmtrc.json.template b/packages/schematics/angular/workspace/files/.oxfmtrc.json.template new file mode 100644 index 000000000000..ec1db9316ad3 --- /dev/null +++ b/packages/schematics/angular/workspace/files/.oxfmtrc.json.template @@ -0,0 +1,13 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "printWidth": 100, + "singleQuote": true, + "sortPackageJson": false, + "associations": [ + { + "files": ["**/*.html"], + "excludeFiles": ["**/index.html"], + "language": "angular-html" + } + ] +} diff --git a/packages/schematics/angular/workspace/files/.prettierrc.template b/packages/schematics/angular/workspace/files/.prettierrc.template deleted file mode 100644 index d6c16d7ee77b..000000000000 --- a/packages/schematics/angular/workspace/files/.prettierrc.template +++ /dev/null @@ -1,12 +0,0 @@ -{ - "printWidth": 100, - "singleQuote": true, - "overrides": [ - { - "files": "*.html", - "options": { - "parser": "angular" - } - } - ] -} diff --git a/packages/schematics/angular/workspace/files/package.json.template b/packages/schematics/angular/workspace/files/package.json.template index c72c727cacfc..4a382afb3f79 100644 --- a/packages/schematics/angular/workspace/files/package.json.template +++ b/packages/schematics/angular/workspace/files/package.json.template @@ -23,7 +23,7 @@ "devDependencies": { "@angular/cli": "<%= '^' + version %>", "@angular/compiler-cli": "<%= latestVersions.Angular %>", - "prettier": "<%= latestVersions['prettier'] %>", + "oxfmt": "<%= latestVersions['oxfmt'] %>", "typescript": "<%= latestVersions['typescript'] %>" } } diff --git a/packages/schematics/angular/workspace/index_spec.ts b/packages/schematics/angular/workspace/index_spec.ts index a13a7d3e1bb7..8ee77d41d7ef 100644 --- a/packages/schematics/angular/workspace/index_spec.ts +++ b/packages/schematics/angular/workspace/index_spec.ts @@ -57,6 +57,7 @@ describe('Workspace Schematic', () => { const pkg = JSON.parse(tree.readContent('/package.json')); expect(pkg.dependencies['@angular/core']).toEqual(latestVersions.Angular); expect(pkg.dependencies['rxjs']).toEqual(latestVersions['rxjs']); + expect(pkg.devDependencies['oxfmt']).toEqual(latestVersions['oxfmt']); expect(pkg.devDependencies['typescript']).toEqual(latestVersions['typescript']); }); @@ -79,6 +80,7 @@ describe('Workspace Schematic', () => { ]), ); + expect(files).toContain('/.oxfmtrc.json'); expect(files).not.toContain('/.editorconfig'); });