From 92b2b4d71953cb121bd099e9a9af2465b6bc0538 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Tue, 20 Feb 2024 14:39:18 -0800 Subject: [PATCH 1/2] Revert "Explicitly pass all extensions by default when calling jscodeshift (#767)" This reverts commit 9b6cca76e876d7e6e4aa76c5c65d2e80a0b0199e. --- src/cli.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 77313fba2..5fdec539b 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -24,7 +24,6 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-nocheck import path from "path"; -import { DEFAULT_EXTENSIONS } from "@babel/core"; import Runner from "jscodeshift/dist/Runner"; import { @@ -41,16 +40,6 @@ if (args[2] === "--help" || args[2] === "-h") { process.stdout.write(getHelpParagraph(transforms)); } -// Refs: https://github.com/facebook/jscodeshift/issues/582 -if (!args.some((arg) => arg.startsWith("--extensions"))) { - // Explicitly add all extensions as default to avoid bug in jscodeshift. - // Refs: https://github.com/facebook/jscodeshift/blob/51da1a5c4ba3707adb84416663634d4fc3141cbb/src/Worker.js#L80 - const babelExtensions = DEFAULT_EXTENSIONS.map((ext) => - ext.startsWith(".") ? ext.substring(1) : ext - ); - args.push(`--extensions=${[...babelExtensions, "ts", "tsx"].join(",")}`); -} - const disclaimerLines = [ `╔════════════════════════════════════════════════════════╗`, `║ Please review the code change thoroughly for required ║`, From 7f2e124555b9611a2af8f409128ec7f40a7827a4 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Tue, 20 Feb 2024 14:39:43 -0800 Subject: [PATCH 2/2] Process all extensions by default --- src/utils/getJsCodeshiftParser.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/getJsCodeshiftParser.ts b/src/utils/getJsCodeshiftParser.ts index 2a765ee2b..e595898a0 100644 --- a/src/utils/getJsCodeshiftParser.ts +++ b/src/utils/getJsCodeshiftParser.ts @@ -76,7 +76,8 @@ export const getJsCodeshiftParser = () => }, extensions: { display_index: 3, - default: "js", + // Refs: https://github.com/facebook/jscodeshift/issues/582 + // default: "js", help: "transform files with these file extensions (comma separated list)", metavar: "EXT", },