Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Move Prettier config to it's on file according to best practices #32222

Open
@L-X-T

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',
 },
 },
 ],
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /