From ab81bf734e284fd6fae7e3cef755afcb8df7ccf4 Mon Sep 17 00:00:00 2001 From: Jean Pierre Date: Thu, 20 May 2021 14:13:38 -0500 Subject: [PATCH] Fix regression no codefix for ts2657 (#43635) * Fix regression no codefix for ts2657 Fixes #43454 * remove unnecessary check --- src/services/codefixes/wrapJsxInFragment.ts | 4 ---- tests/cases/fourslash/codeFixWrapJsxInFragment3.ts | 7 +++++++ tests/cases/fourslash/codeFixWrapJsxInFragment4.ts | 7 +++++++ 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 tests/cases/fourslash/codeFixWrapJsxInFragment3.ts create mode 100644 tests/cases/fourslash/codeFixWrapJsxInFragment4.ts diff --git a/src/services/codefixes/wrapJsxInFragment.ts b/src/services/codefixes/wrapJsxInFragment.ts index e14bfcfcbb4..c70ee0833d7 100644 --- a/src/services/codefixes/wrapJsxInFragment.ts +++ b/src/services/codefixes/wrapJsxInFragment.ts @@ -5,10 +5,6 @@ namespace ts.codefix { registerCodeFix({ errorCodes, getCodeActions: context => { - const { jsx } = context.program.getCompilerOptions(); - if (jsx !== JsxEmit.React && jsx !== JsxEmit.ReactNative) { - return undefined; - } const { sourceFile, span } = context; const node = findNodeToFix(sourceFile, span.start); if (!node) return undefined; diff --git a/tests/cases/fourslash/codeFixWrapJsxInFragment3.ts b/tests/cases/fourslash/codeFixWrapJsxInFragment3.ts new file mode 100644 index 00000000000..a44b5780107 --- /dev/null +++ b/tests/cases/fourslash/codeFixWrapJsxInFragment3.ts @@ -0,0 +1,7 @@ +/// + +// @jsx: react-jsx +// @Filename: /a.tsx +////[||] + +verify.rangeAfterCodeFix(`<>`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0); diff --git a/tests/cases/fourslash/codeFixWrapJsxInFragment4.ts b/tests/cases/fourslash/codeFixWrapJsxInFragment4.ts new file mode 100644 index 00000000000..310d881c904 --- /dev/null +++ b/tests/cases/fourslash/codeFixWrapJsxInFragment4.ts @@ -0,0 +1,7 @@ +/// + +// @jsx: react-jsxdev +// @Filename: /a.tsx +////[||] + +verify.rangeAfterCodeFix(`<>`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0);