diff --git a/rules/prevent-abbreviations.js b/rules/prevent-abbreviations.js
index e4bf84315d..8328724c3f 100644
--- a/rules/prevent-abbreviations.js
+++ b/rules/prevent-abbreviations.js
@@ -215,7 +215,13 @@ const isExportedIdentifier = identifier => {
return false;
};
-const shouldFix = variable => !getVariableIdentifiers(variable).some(identifier => isExportedIdentifier(identifier));
+const shouldFix = variable => getVariableIdentifiers(variable)
+ .every(identifier =>
+ !isExportedIdentifier(identifier)
+ // In typescript parser, only `JSXOpeningElement` is added to variable
+ // `` -> `` will cause parse error
+ && identifier.type !== 'JSXIdentifier',
+ );
const isDefaultOrNamespaceImportName = identifier => {
if (
diff --git a/test/prevent-abbreviations.mjs b/test/prevent-abbreviations.mjs
index 20d7c8df30..87ff815ad5 100644
--- a/test/prevent-abbreviations.mjs
+++ b/test/prevent-abbreviations.mjs
@@ -1858,6 +1858,30 @@ test.typescript({
],
});
+// JSX
+test.typescript({
+ testerOptions: {
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
+ },
+ valid: [],
+ invalid: [
+ // https://github.com/microsoft/fluentui/blob/ead191a8368bf64ecabffce5ea0e02565f449a95/packages/fluentui/docs/src/views/FocusTrapZoneDoc.tsx#L10
+ {
+ code: outdent`
+ import DocPage from '../components/DocPage';
+ export default () => (
+
+ );
+ `,
+ errors: 1,
+ },
+ ],
+});
+
// Filename
test({
valid: [