How to sort imports alphabetically for TypeScript files automatically in WebStorm / PhpStorm?

As of TSLint 4.0, the ordered-imports rule features automatic fixing of violations. You can run it through the CLI with the --fix flag.


According to webstorm: https://www.jetbrains.com/help/webstorm/tslint.html

With WebStorm, you can fix some of the issues reported by TSLint > automatically.

To fix a specific error, place the cursor at the highlighted code, press ⌥⏎, and then choose TSLint: fix current error from the pop-up menu. To fix all the issues detected in the file, choose TSLint: fix current file.