Skip to content

Overrides not applied to dotfiles #6193

@felixfbecker

Description

@felixfbecker

Environments:

  • Prettier Version: 1.18.0
  • Running Prettier via: CLI
  • Runtime:
  • Operating System: macOS

Steps to reproduce:

.prettierrc.json

{
    "tabWidth": 4,
    "printWidth": 120,
    "semi": false,
    "trailingComma": "es5",
    "singleQuote": true,
    "overrides": [
        {
            "files": "*.json",
            "options": {
                "tabWidth": 2
            }
        }
    ]
}

I also tried with **/*.json, **.json, **/*.*.json, *.*.json.

Expected behavior:
prettier .prettierrc.json --write should format the file with 2 spaces.

Actual behavior:
It formats the filee with 4 spaces.

Logs:

> npx prettier ./.prettierrc.json --write --config ./.prettierrc.json --loglevel=debug
[debug] normalized argv: {"_":["./.prettierrc.json"],"color":true,"editorconfig":true,"write":true,"config":"./.prettierrc.json","loglevel":"debug","plugin-search-dir":[],"plugin":[],"ignore-path":".prettierignore","debug-repeat":0,"config-precedence":"cli-override"}
[debug] load config file from './.prettierrc.json'
[debug] loaded options `{"tabWidth":4,"printWidth":120,"semi":false,"trailingComma":"es5","singleQuote":true}`
[debug] applied config-precedence (cli-override): {"printWidth":120,"semi":false,"singleQuote":true,"tabWidth":4,"trailingComma":"es5"}
.prettierrc.json 25ms

Note how tabWidth: 4 is used.

Metadata

Metadata

Assignees

Labels

area:apiIssues with Prettier's Application Programming Interfacelocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions