-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Open
Description
Command
new
Description
The included Angular Prettier config should go into it's own file, instead of being added to the package.json.
package.json
{
"prettier": {
"printWidth": 100,
"singleQuote": true,
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular"
}
}
]
}
}
Describe the solution you'd like
While ".prettierrc" is the most common variant, I recommend using the modern approach "prettier.config.js" - this aligns with other tools like ESLint, Cypress or Playwright and allows comments:
prettier.config.js
module.exports = {
bracketSameLine: true, // default: false; true for fewer lines in .html
printWidth: 120, // default: 80; adjust to your team's preference
singleQuote: true, // default: false; true for JS community style
overrides: [
{
files: '*.html',
options: {
parser: 'angular',
},
},
],
};
Additionally, ".prettierignore" should be added with the minimal content like this:
.prettierignore
/.angular
/coverage
/dist
/node_modules
Describe alternatives you've considered
If you don't like "bracketSameLine: true" and insist on "printWidth: 100" that's okay, then we would have:
prettier.config.js
module.exports = {
printWidth: 100, // default: 80; adjust to your team's preference
singleQuote: true, // default: false; true for JS community style
overrides: [
{
files: '*.html',
options: {
parser: 'angular',
},
},
],
};
robertIsaac