Skip to content

Commit 032a574

Browse files
committed
Fix auto-import tests referencing removed options
1 parent bd8d942 commit 032a574

11 files changed

+47
-55
lines changed

tests/cases/fourslash/codeFixClassImplementInterfaceAutoImports_typeOnly.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// <reference path='fourslash.ts' />
22

3-
// @importsNotUsedAsValues: error
3+
// @module: esnext
4+
// @verbatimModuleSyntax: true
45

56
// @Filename: types1.ts
67
////type A = {};
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// <reference path="fourslash.ts" />
22

3-
// @importsNotUsedAsValues: error
3+
// @module: esnext
4+
// @verbatimModuleSyntax: true
45

56
// @Filename: exports.ts
67
////export default class A {}
@@ -18,15 +19,13 @@
1819
////console.log(b, c);
1920

2021
goTo.file("imports.ts");
21-
verify.codeFix({
22-
index: 0,
23-
description: ts.Diagnostics.Use_import_type.message,
24-
newFileContent: `import type {
25-
B,
26-
C,
27-
} from './exports';
28-
29-
declare const b: B;
30-
declare const c: C;
31-
console.log(b, c);`
32-
});
22+
// This test previously showed that a codefix could be applied to turn
23+
// these imports, only used in type positions, into type-only imports.
24+
// The code fix was triggered by the error issued by
25+
// `--importsNotUsedAsValues error`, for which there is no analog in
26+
// the compiler after its removal. `verbatimModuleSyntax` does not
27+
// error here since the imported names are values, and so will not
28+
// crash at runtime. Users have replaced this error and codefix with
29+
// an eslint rule. We could consider bringing it back as a suggestion
30+
// diagnostic, a refactor, or an organizeImports feature.
31+
verify.not.codeFixAvailable();
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// <reference path="fourslash.ts" />
22

3-
// @importsNotUsedAsValues: error
3+
// @module: esnext
4+
// @verbatimModuleSyntax: true
45

56
// @Filename: exports.ts
67
////export default class A {}
@@ -16,14 +17,13 @@
1617
////console.log(a, b, c);
1718

1819
goTo.file("imports.ts");
19-
verify.codeFix({
20-
index: 0,
21-
description: ts.Diagnostics.Use_import_type.message,
22-
newFileContent: `import type A from './exports';
23-
import type { B, C } from './exports';
24-
25-
declare const a: A;
26-
declare const b: B;
27-
declare const c: C;
28-
console.log(a, b, c);`
29-
});
20+
// This test previously showed that a codefix could be applied to turn
21+
// these imports, only used in type positions, into type-only imports.
22+
// The code fix was triggered by the error issued by
23+
// `--importsNotUsedAsValues error`, for which there is no analog in
24+
// the compiler after its removal. `verbatimModuleSyntax` does not
25+
// error here since the imported names are values, and so will not
26+
// crash at runtime. Users have replaced this error and codefix with
27+
// an eslint rule. We could consider bringing it back as a suggestion
28+
// diagnostic, a refactor, or an organizeImports feature.
29+
verify.not.codeFixAvailable();
Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// <reference path="fourslash.ts" />
22

3-
// @importsNotUsedAsValues: error
3+
// @module: esnext
4+
// @verbatimModuleSyntax: true
45

56
// @Filename: exports1.ts
67
////export default class A {}
@@ -24,18 +25,13 @@
2425
////console.log(a, b, c, d, o);
2526

2627
goTo.file("imports.ts");
27-
verify.codeFixAll({
28-
fixId: "convertToTypeOnlyImport",
29-
fixAllDescription: ts.Diagnostics.Fix_all_with_type_only_imports.message,
30-
newFileContent: `import type A from './exports1';
31-
import type { B, C } from './exports1';
32-
import type D from "./exports2";
33-
import type * as others from "./exports2";
34-
35-
declare const a: A;
36-
declare const b: B;
37-
declare const c: C;
38-
declare const d: D;
39-
declare const o: typeof others;
40-
console.log(a, b, c, d, o);`
41-
});
28+
// This test previously showed that a codefix could be applied to turn
29+
// these imports, only used in type positions, into type-only imports.
30+
// The code fix was triggered by the error issued by
31+
// `--importsNotUsedAsValues error`, for which there is no analog in
32+
// the compiler after its removal. `verbatimModuleSyntax` does not
33+
// error here since the imported names are values, and so will not
34+
// crash at runtime. Users have replaced this error and codefix with
35+
// an eslint rule. We could consider bringing it back as a suggestion
36+
// diagnostic, a refactor, or an organizeImports feature.
37+
verify.not.codeFixAvailable();

tests/cases/fourslash/completionsImport_promoteTypeOnly4.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/// <reference path="fourslash.ts" />
22
// @module: es2015
3-
// @isolatedModules: true
4-
// @preserveValueImports: true
3+
// @verbatimModuleSyntax: true
54

65
// @Filename: /exports.ts
76
//// export interface SomeInterface {}

tests/cases/fourslash/importNameCodeFix_importType1.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/// <reference path="fourslash.ts" />
22

3-
// @preserveValueImports: true
4-
// @isolatedModules: true
3+
// @verbatimModuleSyntax: true
54
// @module: es2015
65

76
// @Filename: /exports.ts

tests/cases/fourslash/importNameCodeFix_importType2.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/// <reference path="fourslash.ts" />
22

3-
// @importsNotUsedAsValues: error
4-
// @preserveValueImports: true
5-
// @isolatedModules: true
3+
// @verbatimModuleSyntax: true
64
// @module: es2015
75

86
// @Filename: /exports1.ts

tests/cases/fourslash/importNameCodeFix_importType3.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/// <reference path="fourslash.ts" />
22

3-
// @preserveValueImports: true
4-
// @isolatedModules: true
3+
// @verbatimModuleSyntax: true
54
// @module: es2015
65

76
// @Filename: /exports.ts

tests/cases/fourslash/importNameCodeFix_importType8.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/// <reference path="fourslash.ts" />
22

33
// @module: es2015
4-
// @isolatedModules: true
5-
// @preserveValueImports: true
4+
// @verbatimModuleSyntax: true
65

76
// @Filename: /exports.ts
87
//// export interface SomeInterface {}

tests/cases/fourslash/importNameCodeFix_typeOnly.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// <reference path="fourslash.ts" />
22

3-
// @importsNotUsedAsValues: error
3+
// @module: esnext
4+
// @verbatimModuleSyntax: true
45

56
// @Filename: types.ts
67
////export class A {}

tests/cases/fourslash/importNameCodeFix_typeOnly3.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// <reference path="fourslash.ts" />
22

3-
// @importsNotUsedAsValues: error
3+
// @module: esnext
4+
// @verbatimModuleSyntax: true
45

56
// @Filename: Presenter.ts
67
//// export type DisplayStyle = "normal" | "compact";

0 commit comments

Comments
 (0)