prettier recurses into directories ignored by .prettierignore
prettier does not prune directories from the tree when they are ignored by `.prettierignore`. This seems to mean that there is no way to avoid errors from directories which are not readable by the user running prettier. ## Environments - Prettier Version: 2.4.1 - Running Prettier via: CLI - Runtime: Node.js v14 - Operating System: openSUSE Linux - Prettier plugins (if any): none ## Steps to reproduce ```sh mkdir -p prettier-test/ignore-me/root-only-dir cd prettier-test/ echo ignore-me > .prettierignore echo '{}' > foo.json echo '{}' > ignore-me/root-only-dir/foo.json sudo chown root:root ignore-me/root-only-dir/ sudo chmod 700 ignore-me/root-only-dir/ ``` ## Expected behavior `prettier -c .` runs with no errors. ## Actual behavior `prettier -c .` issues an `EACCES` error due to trying to read `root-only-dir` and failing: ``` $ prettier -c . --loglevel debug [debug] normalized argv: {"_":["."],"color":true,"editorconfig":true,"loglevel":"debug","config-precedence":"cli-override","debug-repeat":0,"ignore-path":".prettierignore","plugin":[],"plugin-search-dir":[],"check":true} Checking formatting... [error] Unable to expand directory: . [error] EACCES: permission denied, scandir '/home/adam/prettier-test/ignore-me/root-owned-dir' All matched files use Prettier code style! ``` ## Example use case If docker containers are run from a subtree, this may cause files and directories owned by `root`. It should be possible to tell prettier to prune that entire subtree from i
Posted by aspiers on Sep 22, 2021, 4:03 PM
Tags
Related issues
- Custom games stuck on "finding server" for all european servers
- Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
- Forza Horizon 6 (2483190)
- Turn off integrated browser for default
- Weekly updates are too frequent
- [BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments
github (Sysadmin)
Custom games stuck on "finding server" for all european servers
Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
Forza Horizon 6 (2483190)
Turn off integrated browser for default
Weekly updates are too frequent
[BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Add gemini-3.1-pro-preview
[TF2] Feature request: Bring Back Quickplay
prettier recurses into directories ignored by .prettierignore
prettier does not prune directories from the tree when they are ignored by `.prettierignore`. This seems to mean that there is no way to avoid errors from directories which are not readable by the user running prettier. ## Environments - Prettier Version: 2.4.1 - Running Prettier via: CLI - Runtime: Node.js v14 - Operating System: openSUSE Linux - Prettier plugins (if any): none ## Steps to reproduce ```sh mkdir -p prettier-test/ignore-me/root-only-dir cd prettier-test/ echo ignore-me > .prettierignore echo '{}' > foo.json echo '{}' > ignore-me/root-only-dir/foo.json sudo chown root:root ignore-me/root-only-dir/ sudo chmod 700 ignore-me/root-only-dir/ ``` ## Expected behavior `prettier -c .` runs with no errors. ## Actual behavior `prettier -c .` issues an `EACCES` error due to trying to read `root-only-dir` and failing: ``` $ prettier -c . --loglevel debug [debug] normalized argv: {"_":["."],"color":true,"editorconfig":true,"loglevel":"debug","config-precedence":"cli-override","debug-repeat":0,"ignore-path":".prettierignore","plugin":[],"plugin-search-dir":[],"check":true} Checking formatting... [error] Unable to expand directory: . [error] EACCES: permission denied, scandir '/home/adam/prettier-test/ignore-me/root-owned-dir' All matched files use Prettier code style! ``` ## Example use case If docker containers are run from a subtree, this may cause files and directories owned by `root`. It should be possible to tell prettier to prune that entire subtree from i
Comments (0)
No comments yet. Start the discussion.