You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, with the prettier-vscode extension installed, the extension will recognize prettier configs (e.g. .prettierrc) that are on the root of the vscode workspace/project, but it will not recognize configs that are within folders in that vscode workspace.
It would be helpful to have the prettier-vscode extension recognize and honor the prettier configs that are within folders in a vscode workspace. This is especially helpful in a monorepo context, where different folders of the monorepo can have different package.jsons and different prettier configs.
If, for examble, you have a folder structure in a workspace like so:
It is currently possible to cd into codebase-1/ and codebase-2/ and run, e.g. npx prettier --write src/, for each, but that does not happen automatically on save like the prettier-vscode extension so helpfully enables.
However, with the vscode workspace opened on code structure above, opening codebase-1/src/first-script.ts and saving the file (with Format On Save enabled), prettier-vscode will not use the config from codebase-1/.prettierrc.
The text was updated successfully, but these errors were encountered:
To add to the issue, this also affects .prettierignore files. The current workaround is to duplicate the ignore file contents from subfolders into the repo root.
I can also verify this behaviour with .prettierignore files in my setup as reported in this StackOverflow post. Reading the documentation I expected to be able to create a .prettierignore file in my project but it was being ignored and like the other reports it has to be in the workspace root which in a multiroot workspace is the parent of all projects.
After some further tests it seems .prettierrc.json is recognised in any directory and does not have to be in the root directory of the project, however .prettierignore still has to be in the root directory to work at all. The workaround I've found is to create a prettierrc.json in any folder I want to ignore with a single { "requirePragma": true }rule inside.
Right now, with the
prettier-vscode
extension installed, the extension will recognize prettier configs (e.g..prettierrc
) that are on the root of the vscode workspace/project, but it will not recognize configs that are within folders in that vscode workspace.It would be helpful to have the
prettier-vscode
extension recognize and honor the prettier configs that are within folders in a vscode workspace. This is especially helpful in a monorepo context, where different folders of the monorepo can have differentpackage.json
s and different prettier configs.If, for examble, you have a folder structure in a workspace like so:
It is currently possible to
cd
intocodebase-1/
andcodebase-2/
and run, e.g.npx prettier --write src/
, for each, but that does not happen automatically on save like theprettier-vscode
extension so helpfully enables.However, with the vscode workspace opened on code structure above, opening
codebase-1/src/first-script.ts
and saving the file (with Format On Save enabled),prettier-vscode
will not use the config fromcodebase-1/.prettierrc
.The text was updated successfully, but these errors were encountered: