Skip to content

Prettier config in package.json overrides singleQuote for .ts files in --minimal projects #30744

Closed

Description

@steven-panxd

Command

new

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

20.0.3

Description

After @angular/[email protected], the following Prettier configuration was introduced in package.json via PR #30590, related to issue #30548 and commit 2316fe2:

"prettier": {
    "overrides": [
      {
        "files": "*.html",
        "options": {
          "parser": "angular"
        }
      }
    ]
  }

This works well in standard Angular templates, which include an .editorconfig file in the root folder. However, in the --minimal template, there is no .editorconfig file, yet the same Prettier configuration is still present in package.json.

I’ve noticed that in --minimal projects, this Prettier override seems to cause TypeScript files to format using double quotes, even when my Prettier settings specify singleQuote: true. As soon as I remove the overrides block, Prettier respects the single quote rule again in .ts files.

This seems unintended, as the override is only targeting *.html files.

Image

Minimal Reproduction

To reproduce the issue, install the latest version of Angular CLI and create a project using:

ng new <project-name> --minimal

Then open any .ts file and try saving it. You’ll observe that all single quotes are replaced with double quotes, as demonstrated in the GIF above.

Exception or Error


Your Environment

Angular CLI: 20.1.1
Node: 22.14.0
Package Manager: npm 11.4.2
OS: darwin arm64

Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2001.1 (cli-only)
@angular-devkit/core         20.1.1 (cli-only)
@angular-devkit/schematics   20.1.1 (cli-only)
@schematics/angular          20.1.1 (cli-only)


esbenp.prettier-vscode version 11.0.0

Anything else relevant?

I tested with an older version of Angular CLI, specifically v20.0.3 (before commit 2316fe2), and the issue did not occur there.

As a workaround, I added an additional overrides entry in package.json to explicitly force Prettier to use single quotes for .ts files:

"prettier": {
    "overrides": [
      {
        "files": "*.html",
        "options": {
          "parser": "angular"
        }
      },
      {
        "files": "*.ts",
        "options": {
          "singleQuote": true
        }
      }
    ]
  }

Image

This seems to restore the expected formatting behavior for TypeScript files, though I’m not certain whether this workaround could introduce unintended side effects. Further testing would be helpful.

Activity

  1. changed the title [-]Unexpected Interaction Between Prettier Override and TypeScript Formatting in --minimal Template[/-] [+]Prettier config in package.json overrides singleQuote for .ts files in --minimal projects[/+] on Jul 21, 2025
  2. added
    freq1: low
    on Jul 21, 2025
  3. added theissue type on Jul 21, 2025
  4. added
    help wanted
    good first issue
    on Jul 21, 2025
  5. steven-panxd commented on Jul 22, 2025

    @steven-panxd
    Author

    According to the prettier-vscode README, Visual Studio Code settings are ignored if any other Prettier configuration is present (see this section).

    Therefore, even if we only define the overrides field in package.json, it becomes the sole configuration Prettier uses in VS Code. Any unspecified settings will fall back to Prettier's defaults, which may not comply with the Google TypeScript Style Guide as recommended by the Angular Style Guide, such as defaulting to double quotes instead of the preferred single quotes.

  6. robertIsaac commented on Aug 14, 2025

    @robertIsaac

    I have already said here #30548 that the way Angular is configuring things will make people confused
    and the suggestion for prettier to warn if two ways to configure prettier was detected has been rejected prettier/prettier#17683

    I'd ask the Angular team again to reconsider adding the prettier configuration inside the package.json, it's much cleaner to have it in the .prettierrc

  7. angular-automatic-lock-bot commented on Sep 14, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  8. locked and limited conversation to collaborators on Sep 14, 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

    area: @schematics/angularfreq1: lowgood first issuehelp wantedseverity5: regressiontype: bug/fix

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions