mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint
This commit is contained in:
commit
a7f41621fb
59 files changed
+1235
-330
No files matched your search
@@ -0,0 +1,35 @@
|
||||
/* @internal */
|
||||
namespace ts.codefix {
|
||||
const fixID = "fixEnableJsxFlag";
|
||||
const errorCodes = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
||||
registerCodeFix({
|
||||
errorCodes,
|
||||
getCodeActions: context => {
|
||||
const { configFile } = context.program.getCompilerOptions();
|
||||
if (configFile === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const changes = textChanges.ChangeTracker.with(context, changeTracker =>
|
||||
doChange(changeTracker, configFile)
|
||||
);
|
||||
return [
|
||||
createCodeFixActionNoFixId(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)
|
||||
];
|
||||
},
|
||||
fixIds: [fixID],
|
||||
getAllCodeActions: context =>
|
||||
codeFixAll(context, errorCodes, changes => {
|
||||
const { configFile } = context.program.getCompilerOptions();
|
||||
if (configFile === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
doChange(changes, configFile);
|
||||
})
|
||||
});
|
||||
|
||||
function doChange(changeTracker: textChanges.ChangeTracker, configFile: TsConfigSourceFile) {
|
||||
setJsonCompilerOptionValue(changeTracker, configFile, "jsx", createStringLiteral("react"));
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,7 @@
|
||||
"codefixes/fixClassSuperMustPrecedeThisAccess.ts",
|
||||
"codefixes/fixConstructorForDerivedNeedSuperCall.ts",
|
||||
"codefixes/fixEnableExperimentalDecorators.ts",
|
||||
"codefixes/fixEnableJsxFlag.ts",
|
||||
"codefixes/fixExtendsInterfaceBecomesImplements.ts",
|
||||
"codefixes/fixForgottenThisPropertyAccess.ts",
|
||||
"codefixes/fixUnusedIdentifier.ts",
|
||||
|
||||
Reference in new issue
Block a user