Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

auto-import with alphabetized order by default #33839

Copy link
Copy link
@shiqimei

Description

@shiqimei
Issue body actions

Search Terms

auto-import; import; auto import

Suggestion

Support auto-import with alphabetized order by default

Use Cases

image
Currently, Typescript auto-import by adding the new module at the end. But it does not obey tslint rule: ordered-imports It will be better if typescript can auto-import with alphabetized order by default :)

Examples

import { B } from 'moduleB';
...
const a = new A(); // Ctrl+. -> Do you want to import A?

then

import { A, B } from 'moduleB'; // A is auto-imported in front of B
...
const a = new a();
...
classs ModuleA implements IModuleA { // Ctrl+. -> Do you want to import IModuleA?
...

then

import { IModuleA } from 'moduleA'; // moduleA is auto-imported above moduleB
import { A, B } from 'moduleB';
...
const a = new a();
...
class ModuleA implements IModuleA {
...

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsFix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScriptVS Code PriorityCritical issues that VS Code needs fixed in the current TypeScript milestoneCritical issues that VS Code needs fixed in the current TypeScript milestone

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.