Different Prettier rules for different file types?

Viewed 850

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.

1 Answers

you can add overrides like this:

 {
   "printWidth": 80,   // applies to everything except overrides
   "overrides": [
      {
      "files": "**/*.tsx",
      "options": {
         "printWidth": 120
      }        
   ]
}
Related