Categories
JavaScript

How to Disable Prettier Checks for a Single File?

Spread the love

Sometimes, we want to disable Prettier checks for a single file.

In this article, we’ll look at how to disable Prettier checks for a single file.

Disable Prettier Checks for a Single File

To disable Prettier checks for a single file, we can add the path of the file we want Prettier to ignore into the .prettierignore file.

We follow the .gitignore file syntax to add it.

For instance, we write:

# Ignore artifacts: 
build 
coverage

# Ignore all HTML files:
*.html 

into .prettierignore to stop Prettier from checking all .html files in addition to anything in the build and coverage folders.

Conclusion

To disable Prettier checks for a single file, we can add the path of the file we want Prettier to ignore into the .prettierignore file.

We follow the .gitignore file syntax to add it.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *