Introduction

Plenty of times in a project we’d wish to ignore the linting of certain files when using Prettier.

Ignoring files: .prettierignore

To ignore certain files, add the file name to .prettieringore file in your project root and prettier will ignore the file. Remember .prettieringore file uses the .gitignore file syntax.

Example

In our .prettierignore:

# inside our .prettierignore:

# ignore artifacts:
build
coverage

# ignore all HTML files(matches all the files with the .html extension)
**/*.html

For multiple files, use a wild card to exclude all of the files at once, inside .prettierignore:

**/*.xlsx
**/*.cvs

The above tells prettier to ignore all files with .xlsx and .cvs extensio

TLDR

Itโ€™s recommended to have a .prettierignore in your project! This way you can run prettier –write . to make sure that everything is formatted (without mangling files you donโ€™t want, or choking on generated files). And โ€“ your editor will know which files not to format! ~ Prettier Docs

Read more about Prettier here


Find me on Twitter/ where I tweet about interesting topics on software development.