Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
fix(51301): Fixing an unused import at the end of a line removes the …
…newline (#51320) * fix(51301): keep the line break after removing the unused identifier * preserve line breaks in import specifiers * preserve line breaks in parameters and destructuring elements * remove preserveLineBreak option
- Loading branch information
Showing
23 changed files
with
489 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
// @noUnusedParameters: true | ||
|
||
////[|function f({ | ||
//// a, b, | ||
//// c, | ||
////}: any)|] { | ||
//// a; | ||
//// c; | ||
////} | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'b'", | ||
newRangeContent: | ||
`function f({ | ||
a, | ||
c, | ||
}: any)` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
// @noUnusedParameters: true | ||
|
||
////[|function f({ | ||
//// a, b, | ||
//// | ||
//// | ||
//// c, | ||
////}: any)|] { | ||
//// a; | ||
//// c; | ||
////} | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'b'", | ||
newRangeContent: | ||
`function f({ | ||
a, | ||
c, | ||
}: any)` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
// @noUnusedParameters: true | ||
|
||
////[|function f({ | ||
//// a, b, /* comment related to c */ | ||
//// c, | ||
////}: any)|] { | ||
//// a; | ||
//// c; | ||
////} | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'b'", | ||
newRangeContent: | ||
`function f({ | ||
a, /* comment related to c */ | ||
c, | ||
}: any)` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
// @noUnusedParameters: true | ||
|
||
////[|function f({ | ||
//// a, | ||
//// b, | ||
//// c, | ||
////}: any)|] { | ||
//// b; | ||
//// c; | ||
////} | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'a'", | ||
newRangeContent: | ||
`function f({ | ||
b, | ||
c, | ||
}: any)` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
// @noUnusedParameters: true | ||
|
||
////[|function f({ | ||
//// a, | ||
//// b, | ||
//// | ||
//// c, | ||
////}: any)|] { | ||
//// a; | ||
//// c; | ||
////} | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'b'", | ||
newRangeContent: | ||
`function f({ | ||
a, | ||
c, | ||
}: any)` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
////[|import { | ||
//// a, b, c, d, | ||
//// e, f, | ||
////} from "fs";|] | ||
//// | ||
////a; | ||
////b; | ||
////c; | ||
////e; | ||
////f; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'd'", | ||
newRangeContent: | ||
`import { | ||
a, b, c, | ||
e, f, | ||
} from "fs";` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
////[|import { | ||
//// a, b, c, d, | ||
//// | ||
//// | ||
//// | ||
//// | ||
//// e, f, | ||
////} from "fs";|] | ||
//// | ||
////a; | ||
////b; | ||
////c; | ||
////e; | ||
////f; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'd'", | ||
newRangeContent: | ||
`import { | ||
a, b, c, | ||
e, f, | ||
} from "fs";` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
////[|import { | ||
//// a, b, c, d, /** comment related to e */ | ||
//// e, f, | ||
////} from "fs";|] | ||
//// | ||
////a; | ||
////b; | ||
////c; | ||
////e; | ||
////f; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'd'", | ||
newRangeContent: | ||
`import { | ||
a, b, c, /** comment related to e */ | ||
e, f, | ||
} from "fs";` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
////[|import { | ||
//// a, | ||
//// b, | ||
//// c, | ||
////} from "fs";|] | ||
//// | ||
////a; | ||
////c; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'b'", | ||
newRangeContent: | ||
`import { | ||
a, | ||
c, | ||
} from "fs";` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
////[|import { | ||
//// a, | ||
//// b, | ||
//// | ||
//// | ||
//// c, | ||
////} from "fs";|] | ||
//// | ||
////a; | ||
////c; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'b'", | ||
newRangeContent: | ||
`import { | ||
a, | ||
c, | ||
} from "fs";` | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
// @noUnusedParameters: true | ||
|
||
////[|function f( | ||
//// a: number, b: number, | ||
//// c: number, | ||
////)|] { | ||
//// a; | ||
//// c; | ||
////} | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'b'", | ||
newRangeContent: | ||
`function f( | ||
a: number, | ||
c: number, | ||
)` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
// @noUnusedParameters: true | ||
|
||
////[|function f( | ||
//// a: number, b: number, | ||
//// | ||
//// // comment | ||
//// c: number, | ||
////)|] { | ||
//// a; | ||
//// c; | ||
////} | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'b'", | ||
newRangeContent: | ||
`function f( | ||
a: number, | ||
// comment | ||
c: number, | ||
)` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
// @noUnusedParameters: true | ||
|
||
////[|function f( | ||
//// a: number, b: number, /* comment related to c */ | ||
//// c: number, | ||
////)|] { | ||
//// a; | ||
//// c; | ||
////} | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'b'", | ||
newRangeContent: | ||
`function f( | ||
a: number, /* comment related to c */ | ||
c: number, | ||
)` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @noUnusedLocals: true | ||
// @noUnusedParameters: true | ||
|
||
////[|function f( | ||
//// a: number, | ||
//// b: number, | ||
//// c: number, | ||
////)|] { | ||
//// b; | ||
//// c; | ||
////} | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: "Remove unused declaration for: 'a'", | ||
newRangeContent: | ||
`function f( | ||
b: number, | ||
c: number, | ||
)` | ||
}); |
Oops, something went wrong.