.prettierignore ignore everything except specific folder
See original GitHub issue.prettierignore file:
# Ignore everything:
*
# Except myapp folder:
!myapp/
When running prettier from console - works great, changes in myapp folder are formatted by prettier and changes in other folders are ignored (I am using commit hook with husky and lint-staged configured exactly like in prettier docs).
When I run “Format document” from vscode on file inside myapp folder, it is not working. After removing .prettierignore file, “Format document” works great.
I think prettier-vscode is ignoring everything without exceptions when I use such prettierignore file?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Ignoring Code - Prettier
Use .prettierignore to ignore (i.e. not reformat) certain files and folders completely. Use “prettier-ignore” comments to ignore parts of files.
Read more >How to Ignore all folders with folder pattern using prettier
You can add .next or /.next to the .prettierignore file. -- ignore-path is the path to a file containing patterns that describe files...
Read more >prettier ignore folders | The search engine you control.
To exclude files from formatting, create a .prettierignore file in the root of ... .prettierignore ignore everything except specific folder #578 - GitHub....
Read more >prettier/prettier ignore Code Example - Code Grepper
All Languages >> Html >> prettier/prettier ignore. Grepper Logo Small. “prettier/prettier ignore” Code Answer's. how to ignore prettier.
Read more >Ignoring Code - ESLint - Pluggable JavaScript Linter
If the path to lint is a glob pattern or directory path and contains a dot-folder, all dot-files and dot-folders are linted. ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ok, maybe this is my fault, works ok with:
I have a similar problem to this, except my project is a monorepo. The solution that tlareg has does not seem to work for me.
Project structure:
I want to specify prettierignore so that only web-app dir files get formatted on save.
.prettierignore file:
When I run “Format document” from vscode on file inside web-app folder, it is not working. After removing .prettierignore file, “Format document” works great.
However, with pretty-quick pre-commit hook, the staged files inside web-app will be formatted. So it seems the prettierignore syntax is problematic only on prettier-vscode?
Update The above .prettierignore will work with prettier-vscode if I open the project from root, but does not work if it is opened from web-app directory
Update again Fixed this myself. Resolved by moving .prettierignore to root, and add files to ignore. In web-app, create a workspace setting to include prettier.ignorePath
Final result. Project structure:
.prettierignore file:
vscode settings.json in web-app dir includes