Run prettier in WebStorm or IntelliJ on Windows
Prettier can format your code, and one can have JetBrains WebStorm or IntelliJ do that from within the IDE.
This guide assumes you installed prettier globally.
Versions older than 2018.1
Preferences (WebStorm) or
Click the Plus sign to add a new External Tool.
Fill in the following data:
Arguments: — write $FilePathRelativeToProjectRoot$
Workin directory: $ProjectFileDir$
Now, to have a key shortcut to run prettier, and still on Preferences/Settings, go to
Keymap > External Tools > External Tools > prettier (if it doesn’t appear there, apply changes, close Preferences/Settings and reopen it).
Right-click the External Tool prettier and choose “Add Keyboard Shortcut”.
Choose the key shortcut you prefer and approve all the way to your code. For example:
Ctrl + Shift + s
That’s it. You’re all set to use prettier within WebStorm or IntelliJ on your Windows, with your selected key shortcut.
Version 2018.1 and later
Use the new File Watchers option.