`--ignore-path` not respected when prettier executes in a subdirectory
See original GitHub issueEnvironments:
- Prettier Version: 1.19.1
- Running Prettier via: CLI
- Runtime: Node.js v13.8.0
- Operating System: macOS, etc.
Steps to reproduce: Repo for reproducing: https://github.com/heylookltsme/prettier-bug
.prettierignore
file at the root of a project.prettierrc
in subdirectories of the project- Run prettier in a subdirectory, passing the
--ignore-path
- The
.prettierignore
file is not respected
Correct behavior when run from the root:
Bad behavior when run from a subdirectory:
Expected behavior:
The .prettierignore
file is respected when prettier is run in a subdirectory.
Actual behavior: Prettier fails to ignore files when it’s run in a subdirectory.
It seems like the issue is that .prettierignore
must be at the root of the repo, but if prettier is executing in a subdirectory, then the ignored patterns aren’t matching because it’s comparing the file path relative to the current working directory, not to the root where the .prettierignore file lives.
I think I have a fix. This fixes the issue for me locally. I’ll submit a PR for feedback.
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
npm install prettier/prettier#next
is the latest.The release should happen very soon. Stay tuned. Thanks for the contribution.