The e2e platform for creating, sharing, and running codemods, built on top of your favorite codemod engine. Automate code migrations, cleanups, and refactors for yourself, colleagues, and the community.
import { Foo } from "somewhere"; // Foo is { x: string, y: number }
const y = 0;
const handler = http.get("/url", (_req, res, ctx) =>
res(
ctx.json<Foo>({
x: "string",
y,
}),
)
);
Expected code after transformation
import { Foo } from "somewhere"; // Foo is { x: string, y: number }
const y = 0;
const handler = http.get("/url", () =>
HttpResponse.json<Foo>({
x: "string",
y,
}),
);
Actual code after transformation
import { Foo } from "somewhere"; // Foo is { x: string, y: number }
const handler = http.get("/url", () =>
HttpResponse.json(Foo),
);
Estimated severity
Fairly low - was easy to find because it's a type error. I had one occurrence of this out of ~50 MSW handlers and it wasn't too hard to put the original body back, and put back any references that were wrongly "cleaned up" (const y = 0; in my above example)
Environment:
Codemod CLI version: 0.11.17
OS: MacOS 14.5
Node.js version: v20.14.0
Additional context
Add any other context about the problem here. This might include the target project, explanation of faulty output related to business logic, relevant links, etc.
Faulty codemod
msw/2/response-usages
-> codemod source to be updatedCode before transformation
Expected code after transformation
Actual code after transformation
Estimated severity
Fairly low - was easy to find because it's a type error. I had one occurrence of this out of ~50 MSW handlers and it wasn't too hard to put the original body back, and put back any references that were wrongly "cleaned up" (
const y = 0;
in my above example)Environment:
Additional context
Add any other context about the problem here. This might include the target project, explanation of faulty output related to business logic, relevant links, etc.