WebStorm Setup
JetBrains IDEs (WebStorm, IntelliJ IDEA, PyCharm, etc.)
WebStorm comes with built-in support for Prettier. If you’re using other JetBrains IDE like IntelliJ IDEA, PhpStorm, or PyCharm, make sure you have this plugin installed and enabled in Preferences / Settings | Plugins.
First, you need to install and configure Prettier. You can find instructions on how to do it here.
Once it’s done, you can do a few things in your IDE. You can use the Reformat with Prettier action (Opt+Shift+Cmd+P on macOS or Alt+Shift+Ctrl+P on Windows and Linux) to format the selected code, a file, or a whole directory.
You can also configure WebStorm to run Prettier on save (Cmd+S/Ctrl+S) or use it as the default formatter (Opt+Cmd+L/Ctrl+Alt+L). For this, open Preferences / Settings | Languages & Frameworks | JavaScript | Prettier and tick the corresponding checkbox: On save and/or On ‘Reformat Code’ action.
By default, WebStorm will apply formatting to all .js, .ts, .jsx, and .tsx files that you’ve edited in your project. To apply the formatting to other file types, or to limit formatting to files located only in specific directories, you can customize the default configuration by using glob patterns.
For more information, see WebStorm online help.