I'm using prettier to format some json files with custom extensions (like VSCode's .code-workspace files). The files are in the parent directory of the project, so I'm running prettier --write ../**/*.{json-1,json-2}.
The problem I have is that I cannot tell prettier that parser for .json-1 files is "json". This is my config:
{
"overrides": [
{
"files": "*.json-1",
"options": {
"parser": "json"
}
}
]
}
And when I run prettier, it gives me this output:
[error] No parser could be inferred for file: ../test.json-1
I have also tried changing "files": "*.json-1" to "files": "**/*.json-1" and "files": "../**/*.json-1", but the behavior is the same.
Environments:
- Prettier Version: 2.7.1
- Running Prettier via: CLI
- Runtime: Node.js v16.14.2
- Operating System: Ubuntu 20.04.4
- Prettier plugins (if any): --
Steps to reproduce:
Here's the repro (in the prettier-parent-overrides branch): https://github.com/Shayan-To/repros/tree/prettier-parent-overrides
Go into the project directory cd prettier-proj, and after npm install, run npm run repro.
There are files both in the parent directory, and in the project directory. Prettier can infer the parser for none of the files in the parent directory.
Expected behavior:
The overrides configurations for the files in the parent directory can be set.
Actual behavior:
There seems to be no way to set overrides configurations for the files in the parent directory.
I'm using prettier to format some json files with custom extensions (like VSCode's
.code-workspacefiles). The files are in the parent directory of the project, so I'm runningprettier --write ../**/*.{json-1,json-2}.The problem I have is that I cannot tell prettier that parser for
.json-1files is"json". This is my config:{ "overrides": [ { "files": "*.json-1", "options": { "parser": "json" } } ] }And when I run prettier, it gives me this output:
I have also tried changing
"files": "*.json-1"to"files": "**/*.json-1"and"files": "../**/*.json-1", but the behavior is the same.Environments:
Steps to reproduce:
Here's the repro (in the
prettier-parent-overridesbranch): https://github.com/Shayan-To/repros/tree/prettier-parent-overridesGo into the project directory
cd prettier-proj, and afternpm install, runnpm run repro.There are files both in the parent directory, and in the project directory. Prettier can infer the parser for none of the files in the parent directory.
Expected behavior:
The
overridesconfigurations for the files in the parent directory can be set.Actual behavior:
There seems to be no way to set
overridesconfigurations for the files in the parent directory.