I am using prettier-standard because the project uses the standard for linting.
Following the prettier pre-commit hook example I am running prettier on commits. However I would like to ignore the package.json file. I tried adding package.json
to a .prettierignore file but this did not work.
Code from the prettier pre-commit hook example that I am using in my package.json
{
"scripts": {
"precommit": "lint-staged"
},
"lint-staged": {
"*.{js,json,css}": [
"prettier --write",
"git add"
]
}
}
```
Enable “Only format if prettier is found in your project's dependencies” or “Only format if a Prettier config is found” Disable format on save, save the file, then re-enable it again. Disable format on save and manually run format each time you want to format a file as desired from the command pallette.
Prettier should process all files with relevant file extensions, but it should ignore the patterns from . gitignore . In other words, ignore the build outputs.
Ignoring Files or Folders To exclude files from formatting, add entries to a . prettierignore file in the project root or set the --ignore-path CLI option. . prettierignore uses gitignore syntax.
Use . prettierignore to ignore (i.e. not reformat) certain files and folders completely. Use “prettier-ignore” comments to ignore parts of files.
you can also use a .prettierignore
file.
See the prettier project itself for a reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With