Skip to content

Configuration ignored when defined in multiple sources #2498

Open

Description

@robertoaceves

Hi.

The plugin configuration is ignored when it is defined in multiple sources. For example, I set the next two config values in .prettierrc

    "braceStyle": "1tbs",
    "singleQuote": true

but the plugin reports the following Resolved config:

{
  "parser": "php",
  "phpVersion": "7.4",
  "plugins": [
    "@prettier/plugin-php"
  ]
}

Then, I noticed I also had some "prettier": {...} configuration in package.json. The new configuration was still ignored after I added the same two config values to the Prettier property in this file. At this point, both configuration sources are the same.

Finally, the new configuration was in effect after I deleted the .prettierrc file.

Activity

  1. benjaminkincses commented on Nov 3, 2026

    @benjaminkincses
    Contributor

    this is prettier core, not the plugin. prettier resolves exactly one config source per file, sources are never merged.

    verified on prettier 3.9.10: with a prettier key in package.json and a .prettierrc in the same folder, resolveConfig returns only one source's values. the other source is ignored whole, nothing is merged in. remove one source and the other applies on its own.

    so with config split across .prettierrc and package.json, one wins and the rest is dropped, which matches what you saw (deleting .prettierrc unblocked the package.json values). fix is to keep the config in one place. plugin options like braceStyle and phpVersion follow the same rule, they come from whichever single source wins.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions