mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Shrink span for convert-to-es6-module suggestion (#23441)
This commit is contained in:
parent
221ac50c4c
commit
40fd6aebdc
@ -6,7 +6,7 @@ namespace ts {
|
||||
const diags: Diagnostic[] = [];
|
||||
|
||||
if (sourceFile.commonJsModuleIndicator) {
|
||||
diags.push(createDiagnosticForNode(sourceFile.commonJsModuleIndicator, Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module));
|
||||
diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES6_module));
|
||||
}
|
||||
|
||||
const isJsFile = isSourceFileJavaScript(sourceFile);
|
||||
@ -61,4 +61,8 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function getErrorNodeFromCommonJsIndicator(commonJsModuleIndicator: Node): Node {
|
||||
return isBinaryExpression(commonJsModuleIndicator) ? commonJsModuleIndicator.left : commonJsModuleIndicator;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// @allowJs: true
|
||||
|
||||
// @Filename: /a.js
|
||||
////[|exports.f = function() {}|];
|
||||
////[|exports.f|] = function() {};
|
||||
////exports.C = class {};
|
||||
////exports.x = 0;
|
||||
////exports.a1 = () => {};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user