prettier / prettier/plugin-php

Configuration ignored when defined in multiple sources

Open
#2,498 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.9k
Forks
139
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the configuration using both .prettierrc and the "prettier" property in package.json, then compare it with the case where .prettierrc is removed. Trace how these two sources are resolved and verify that braceStyle and singleQuote are retained when both sources define them.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.