Skip to content

Inconsistent choice of quotes when using move to file #54376

Closed
@gabritto

Description

@gabritto

Bug Report

🔎 Search Terms

refactoring, move to file

💻 Code

source.ts:

import { b } from './other';
const a = 1;
const c = a + b;

target.ts:

export const tt = 2;

Select const c = a + b;, trigger move to file refactoring and select target.ts file.

🙁 Actual behavior

target.ts:

import { a } from './source';

import { b } from "./other";

export const tt = 2;
const c = a + b;

🙂 Expected behavior

The imports added should have the same quote style, maybe preferring the one from the source file when we can't detect a preference for the target file.

target.ts:

import { a } from './source';

import { b } from './other';

export const tt = 2;
const c = a + b;

or at least
target.ts:

import { a } from "./source";

import { b } from "./other";

export const tt = 2;
const c = a + b;

More examples in the test changes of #54358.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions