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

I am using tslint with the default configuration tslint:recommendedand I want to adapt as few rules as possible.

Certain rules provide that imports must be in alphabetical order :

src/core/task/TaskMockDecorator.ts[2, 1]: Import sources within a group must be alphabetized.
src/core/task/taskRunner.ts[1, 16]: Named imports must be alphabetized.

I do not want to sort the import alphabetically by myself. Before disabling this listing: can WebStorm / PhpStorm do this for me?

+4
source share
2 answers

TSLint 4.0 . CLI --fix.

+10

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

WebStorm , TSLint > .

, , ⌥⏎, TSLint: . , , TSLint: .

+1

Source: https://habr.com/ru/post/1662776/


All Articles