ts-importer icon indicating copy to clipboard operation
ts-importer copied to clipboard

Feature request: Remove unused imports

Open axefrog opened this issue 7 years ago • 2 comments

Out of the TS extensions I've tried, yours is the definitely best of the lot for managing imports. Would love to request the following:

  • Remove unused imports (an annoying chore I encounter frequently)
  • Have the context menu deprioritise options I never choose, and vice versa
  • Format/sort imports inside braces:
    • Inside braces: import { D, A, C, B } --> import { A, B, C, D }
    • Case sensitivity: import { fn1, Type1, fn2, Type2, someVar } --> import { Type1, Type2, fn1, fn2, someVar }
    • Multiline with line breaking when there are too many imports on one line:
import { someReallyLongFunctionOrVariableName, fn1, someVar2, Type1, fn2, Type2, SomeReallyLongTypeName, someVar1}

// becomes:

import {
  SomeReallyLongTypeName, Type1, Type2,
  fn1, fn2, someReallyLongFunctionOrVariableName, someVar2, someVar1
} from 'somewhere';

// or (as per settings):

import { SomeReallyLongTypeName, Type1, Type2,
         fn1, fn2, someReallyLongFunctionOrVariableName, someVar2, someVar1 } from 'somewhere';

axefrog avatar Aug 28 '17 23:08 axefrog

Why not using tslint? https://palantir.github.io/tslint/rules/ordered-imports/

pmneo avatar Sep 25 '17 04:09 pmneo

Ah, didn't know about that, thanks!

Still, the most important suggestion was removing unused imports.

axefrog avatar Sep 25 '17 06:09 axefrog