I have seen some React files that start with:
/**
* @prettier
*/
What is the intention of this?
I have seen some React files that start with:
/**
* @prettier
*/
What is the intention of this?
The term is called a pragma
Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file. This is very useful when gradually transitioning large, unformatted codebases to prettier.
Require pragma
Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file. This is very useful when gradually transitioning large, unformatted codebases to prettier.
For example, a file with the following as its first comment will be formatted when --require-pragma is supplied:
/**
* @prettier
*/
or
/**
* @format
*/
API Override:
requirePragma: <bool>