Skip to content

auto-import inserts new import before first comment #39922

Closed
@jessetrinity

Description

@jessetrinity

Discovered in VS integration tests

TypeScript Version: 4.1.0-dev.20200804

Search Terms:
header, import

For the purposes of organize imports, we do not move the first comment as we assume that it is a copyright header. Auto imports now inserts imports alphabetically with the first comment remaining attached to the first import, so a new import can come before our "copyright header".

Code

/* Copyright */

import { bar } from "./src/b";

bar;

Expected behavior:

/* Copyright */

import { foo } from "./src/a";
import { bar } from "./src/b";

bar;
foo

Actual behavior:

import { foo } from "./src/a";
/* Copyright */

import { bar } from "./src/b";

bar;
foo

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions