-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Suggestion: @prettier flag #582
Description
I think it would be helpful to provide a way to programmatically include/exclude the js files that the cli scans. Sure, we love the work prettier does, but sometimes we have some code that we simply wish not to be changed. In order to achieve that with the current setup, one would need to separate the files and place them into different folders, prettify the directory with the code meant to be prettified, then merge back the two folders. As you can see, this is not practical at all. I believe this is a common use case and it should be addressed at an initial stage.
How can we approach this?
// @prettier
Similar to Flow, the cli would only format the files that include this annotation at the top of the file. This opens the door for some other features to be implemented later on, maybe .prettierconfig at some point? it is too early to tell at this stage of the project i think. Complexity-wise, this option takes away some of the ease that comes along with prettier, now we would have to annotate each file in our project.
Note: if this is the way to go, then this case should be addressed:
// @flow
// @prettier
or maybe combine into one line? // @flow @prettier, i like this one better but not sure how easy it is to implement. I think this would be a first, having to deal with multiple annotations in this fashion.
The other way that i can think of is /* prettier-disable */, which has similar characteristics to the previous approach. Think of Flow comments vs. ESlint comments.
Interested in hearing your thoughts on this.