Skip to content

Commit

Permalink
feat(ts-migrate/rename): support react fragment's short syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
runjuu committed Feb 28, 2021
1 parent be941d8 commit e852a1e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/ts-migrate/commands/rename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function findJSFiles(rootDir: string, configFile: string, sources?: string | str
*/
function jsFileContainsJsx(jsFileName: string): boolean {
const contents = fs.readFileSync(jsFileName, 'utf8');
return /(from ['"]react['"]|@jsx)/.test(contents) && /<[A-Za-z]/.test(contents);
return /(from ['"]react['"]|@jsx)/.test(contents) && /<[A-Za-z>]/.test(contents);
}

function updateProjectJson(rootDir: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React from 'react';

// eslint-disable-next-line no-unused-vars
const jsxInJsFile = <>Fragment</>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React from 'react';

// eslint-disable-next-line no-unused-vars
const jsxInJsFile = <>Fragment</>;

0 comments on commit e852a1e

Please sign in to comment.