Skip to content

Angular with prettier configuration confusion #17683

Closed as not planned
Closed as not planned

Description

@robertIsaac

background story
in angular 20 there is a change that components doesn't end with component.html by default
which made this issue
the angular team fixed it by adding prettier to the package.json in this PR

the way prettier work now is that if there is prettier property in the package.json it will ignore the .prettierrc
which can be reproduced here
https://github.com/robertIsaac/ng-prettier
now running prettier . -wl will do nothing (while it should change the spaces to 4, and remove all training comma)
while this is documented, it will for sure confuse many people who expect generating a prettierrc file take effect and many plugins docs ask people to add it to the configuration file (including the plugins docs of prettier)and when it doesn't work people won't understand why

there are 3 solutions to this (unless we decide to ignore it)

  1. to merge the configuration between package.json and prettierrc files if they don't conflict
  2. to warn the user if prettierrc file is found while also prettier exist in the package.json (suggested by @jkrems)
  3. that the angular team generate prettierrc file instead of adding prettier to package.json (my suggestion which is discussed in the PR

it's up to prettier and angular team to decide how to proceed, personally all solutions seems valid to me

Activity

  1. changed the title [-]Angular feature request: warn user if multiple configurations is observed[/-] [+]Angular with prettier configuration confusion[/+] on Jun 26, 2025
  2. fisker commented on Jun 26, 2025

    @fisker
    Member

    First, I want share that we have an open issue about performance issue of config resolution #15653

    to merge the configuration between package.json and prettierrc files if they don't conflict

    That's not going to happen, it will just make the config difficult to understand.

    to warn the user if prettierrc file is found while also prettier exist in the package.json

    This is actually a good idea, anyway we already have a performance bottleneck about finding config file mentioned earlier, because we support many formats, and allow it at any level, search for multiple files will make the performance worse. We probably should avoid doing this.

    that the angular team generate prettierrc file instead of adding prettier to package.json (my suggestion which is discussed in the PR

    package.json and .prettierrc are both config file for Prettier, we treat them with no difference, please pick any format you think the best.

  3. added
    status:awaiting response
    on Jun 26, 2025
  4. github-actions commented on Jul 11, 2025

    @github-actions
    Contributor

    This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

  5. robertIsaac commented on Jul 11, 2025

    @robertIsaac
    Author

    no response to our request for more information from the original author

    what kind of response you want me to give?

  6. removed
    status:awaiting response
    on Jul 11, 2025
  7. fisker commented on Jul 13, 2025

    @fisker
    Member

    Close since we are not going to do anything.

  8. robertIsaac commented on Jul 13, 2025

    @robertIsaac
    Author

    But you said This is actually a good idea for

    to warn the user if prettierrc file is found while also prettier exist in the package.json

  9. fisker commented on Jul 13, 2025

    @fisker
    Member

    The idea is good, but it will have a huge impact on performance. I also said

    We probably should avoid doing this.

  10. added
    locked-due-to-inactivity
    on Oct 12, 2025
  11. locked as resolved and limited conversation to collaborators on Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    locked-due-to-inactivity

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions