Skip to content

Commit

Permalink
fix(cli): jscodeshift failing spec (#5811)
Browse files Browse the repository at this point in the history
* chore: update @types/jscodeshift version

* fix(cli): construct  jsxElement to avoid parentheses
  • Loading branch information
BatuhanW committed Apr 2, 2024
1 parent 4e8188a commit 9a080df
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"@types/inquirer": "^8.2.5",
"@types/inquirer-autocomplete-prompt": "^2.0.0",
"@types/jest": "^29.2.4",
"@types/jscodeshift": "^0.11.5",
"@types/jscodeshift": "^0.11.11",
"@types/marked-terminal": "^3.1.5",
"@types/node-fetch": "^2.6.2",
"@types/prettier": "^2.7.3",
Expand Down
8 changes: 7 additions & 1 deletion packages/cli/src/utils/codeshift/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ export const wrapElement = (
const wrapperElement = j.jsxElement(
j.jsxOpeningElement(j.jsxIdentifier(wrapper), wrapperAttributes),
j.jsxClosingElement(j.jsxIdentifier(wrapper)),
[element.value],
[
j.jsxElement(
element.node.openingElement,
element.node.closingElement,
element.node.children,
),
],
);

j(element).replaceWith(wrapperElement);
Expand Down
2 changes: 1 addition & 1 deletion packages/codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@types/eslint": "^7.28.2",
"@types/inquirer": "^8.2.5",
"@types/jest": "^29.2.4",
"@types/jscodeshift": "^0.11.5",
"@types/jscodeshift": "^0.11.11",
"jest": "^29.3.1",
"ts-jest": "^29.1.2",
"tslib": "^2.6.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@types/dedent": "^0.7.0",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^29.2.4",
"@types/jscodeshift": "^0.11.5",
"@types/jscodeshift": "^0.11.11",
"@types/marked": "^5.0.1",
"@types/sanitize-html": "^2.9.0",
"@types/ws": "^8.5.5",
Expand Down

0 comments on commit 9a080df

Please sign in to comment.