File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,13 @@ const isExportedIdentifier = identifier => {
215
215
return false ;
216
216
} ;
217
217
218
- const shouldFix = variable => ! getVariableIdentifiers ( variable ) . some ( identifier => isExportedIdentifier ( identifier ) ) ;
218
+ const shouldFix = variable => getVariableIdentifiers ( variable )
219
+ . every ( identifier =>
220
+ ! isExportedIdentifier ( identifier )
221
+ // In typescript parser, only `JSXOpeningElement` is added to variable
222
+ // `<foo></foo>` -> `<bar></foo>` will cause parse error
223
+ && identifier . type !== 'JSXIdentifier' ,
224
+ ) ;
219
225
220
226
const isDefaultOrNamespaceImportName = identifier => {
221
227
if (
Original file line number Diff line number Diff line change @@ -1858,6 +1858,30 @@ test.typescript({
1858
1858
] ,
1859
1859
} ) ;
1860
1860
1861
+ // JSX
1862
+ test . typescript ( {
1863
+ testerOptions : {
1864
+ parserOptions : {
1865
+ ecmaFeatures : {
1866
+ jsx : true ,
1867
+ } ,
1868
+ } ,
1869
+ } ,
1870
+ valid : [ ] ,
1871
+ invalid : [
1872
+ // https://github.com/microsoft/fluentui/blob/ead191a8368bf64ecabffce5ea0e02565f449a95/packages/fluentui/docs/src/views/FocusTrapZoneDoc.tsx#L10
1873
+ {
1874
+ code : outdent `
1875
+ import DocPage from '../components/DocPage';
1876
+ export default () => (
1877
+ <DocPage title="Focus Trap Zone"></DocPage>
1878
+ );
1879
+ ` ,
1880
+ errors : 1 ,
1881
+ } ,
1882
+ ] ,
1883
+ } ) ;
1884
+
1861
1885
// Filename
1862
1886
test ( {
1863
1887
valid : [
You can’t perform that action at this time.
0 commit comments