Does Prettier have a way to specify different rules for different file types?
For example, I want a greater maximum line length in our template files (.tsx) because it's more common for markup to be more deeply nested than application code. But for all other files I would like to enforce the standard 80 char width.
You can add overrides like this:
{
"printWidth": 80,
"overrides": [
{
"files": "**/*.tsx",
"options": {
"printWidth": 120
}
}
]
}
In that, printWidth option will be set to 80 for everything except files matching **/*.tsx, for which the printWidth will be 120.
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