prettier-emacs icon indicating copy to clipboard operation
prettier-emacs copied to clipboard

Convenient way to disable per file

Open steinarb opened this issue 2 years ago • 1 comments

There are some files I would like to exclude from prettier formatting, because they are more readable if I can have one line per declaration:

  1. The redux actions definitions files (e.g. like this one)
  2. The reduxjs toolkit reducers (e.g. like this one)

Currently I solve this by switching to fundamental-mode before saving.

But this is a nuisance, and especially when I forget to switch mode before saving, and don't see it until the change has been committed and pushed (like what happened today).

So it would be nice to have the exclusion automated.

steinarb avatar Oct 15 '21 07:10 steinarb

I always mark the files that should be left alone with this (so eslint won't fail the build):

/* eslint-disable prettier/prettier */

steinarb avatar Oct 15 '21 08:10 steinarb