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

Adding an import with quick fix should respect sort order #16119

Copy link
Copy link

Description

@JoshuaKGoldberg
Issue body actions

TypeScript Version: 2.3

Code

Before the suggested B import is added:

import { A, C } from "./letters";

const b: B = new B(); // suggestion to import B from "./letters";

After:

import { A, C, B } from "./letters"; // TSLint's ordered-import rule is now offering a quick fix

const b: B = new B();

Expected behavior:

If the imports are sorted, adding a new one should add in sorted order. In this case it would be { A, B, C }.

Actual behavior:

The added import is tacked onto the end.

If the preference for keeping imports sorted will be added in #10020, it seems like it would make sense to respect that order in individual adds as well.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Quick FixesEditor-provided fixes, often called code actions.Editor-provided fixes, often called code actions.

    Type

    No 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.