Skip to content

Commit cfb64fc

Browse files
committed
feat(schematics/angular): add a '.prettierrc' file to generated workspaces and add Prettier as dev dependency
The config was added as JSON, as this is the preferred format over executable configuration. '.prettierignore' was not added as the '.gitignore' rules are applied by default. Closes #32216 and closes #32222
1 parent 98a24d0 commit cfb64fc

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

packages/schematics/angular/utility/latest-versions/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"jsdom": "^27.1.0",
1919
"less": "^4.2.0",
2020
"postcss": "^8.5.3",
21+
"prettier": "^3.8.1",
2122
"protractor": "~7.0.0",
2223
"rxjs": "~7.8.0",
2324
"tailwindcss": "^4.1.12",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"printWidth": 100,
3+
"singleQuote": true,
4+
"overrides": [
5+
{
6+
"files": "*.html",
7+
"options": {
8+
"parser": "angular"
9+
}
10+
}
11+
]
12+
}

packages/schematics/angular/workspace/files/package.json.template

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@
88
"watch": "ng build --watch --configuration development"<% if (!minimal) { %>,
99
"test": "ng test"<% } %>
1010
},
11-
"prettier": {
12-
"printWidth": 100,
13-
"singleQuote": true,
14-
"overrides": [
15-
{
16-
"files": "*.html",
17-
"options": {
18-
"parser": "angular"
19-
}
20-
}
21-
]
22-
},
2311
"private": true,
2412
<% if (packageManagerWithVersion) { %>"packageManager": "<%= packageManagerWithVersion %>",<% } %>
2513
"dependencies": {
@@ -35,6 +23,7 @@
3523
"devDependencies": {
3624
"@angular/cli": "<%= '^' + version %>",
3725
"@angular/compiler-cli": "<%= latestVersions.Angular %>",
26+
"prettier": "<%= latestVersions['prettier'] %>",
3827
"typescript": "<%= latestVersions['typescript'] %>"
3928
}
4029
}

0 commit comments

Comments
 (0)