Prettier file watcher works on all files except one specific one Follow
I posted this on SO as well, but those guys are very quick to downvote a question, so I'm posting here as well.
I created a repo that contains the code for this question, including the .idea
files. There is a file watcher tasks file in there as well, though the tasks are global so I think there is probably another file specifying them. Where would this be located?
To create the repo, I simply used:
npx create-react-app ws-fw-issues
npm i -D prettier
I have some globally installed file watchers that run prettier on save; in particular, one that runs on save of simple .js
files. They work on all files except for App.js, which is created by create-react-app
.
I can create new files and prettier reformats them.
The prettier file watcher doesn't work for App.js
however, and only this file; I can delete it and create it again, prettier won't reformat. If I rename it, then it does get reformatted by the file watcher.
I actually see "Executing Prettier JS task" at the bottom but nothing happens. Actually even though I do see this at the bottom, it appears in a different color and different location than when I see this for other files. For other files the text is white and in the middle of the bottom bar; for App.js it is blue and way to the right.
To see this in the repo, just open the project in Webstorm and open App.js
. The formatting is all messed up, so change something and save; it won't reformat. Do the same thing for index.js
and it will reformat on save.
I am using Webstorm 2019.3 build #WS-193.5233.80.
By the way, if I were to install typescript as a dependency and change the extension to .tsx
, the TS file watcher I have does reformat that file. Why does it not reformat App.js specifically?
Please sign in to leave a comment.
What does your file watcher look like? App.js is formatted for me when using the default Prettier watcher settings: