jscodeshift
jscodeshift copied to clipboard
A JavaScript codemod toolkit.
In #126 it was proposed to add a helper for generating custom cli for codemod collections. The reasoning mentioned there: > Another option worth considering is custom cli. I did...
If you have ``` /** * @providesModule Foo.react */ var React = require('React'); ``` and remove the require statement, the docblock is lost. This causes build errors and I had...
Some `ImportSpecifier`s have a `local` and `imported` fields that are of type `IdentifierKind`. But this type is not exported.
I've tried the following scripts ```sh npx jscodeshift -t ./transform.ts --parser=tsx ../packages/admin/src/**/*.stories.tsx npx jscodeshift -t ./transform.ts --parser=tsx ../packages/admin/src/**/*.stories.tsx --extensions=tsx ``` and they output the same message ``` Skipping path ../packages/admin/src/**/*.stories.tsx...
Hello. The typescript support is awesome, but it has a small drawback when testing: if your TS code has any type error, the tests will fail without any explanation nor...
Since #237, transformers can be async. However testing such transformers using `defineInlineTest` doesn't appear to be supported, and from the code also looks like it won't be suppored by any...
The docs currently say that `applyTransform` should be used like this: ```js const applyTransform = require('jscodeshift/dist/testUtils').applyTransform; const transform = require('../myTransform'); const transformOptions = {}; const output = applyTransform(transform, transformOptions, 'input');...
## [See this example](https://astexplorer.net/#/gist/e68dc557486730b096ed3d9d393ac6ed/7019959f763cc08fb1f1e81c5b943f45484d8c7e). I am trying to remove some comments which can appear before or after object properties. And I want to preserve the location (leading/trailing) of other comments....
I have the following code (it's part of a larger function, this is the simplified version): ```jsx const aaaa = root.find(j.JSXElement, { openingElement: { name: { type: 'JSXIdentifier', name: "Button"...
Im trying to use jscodeshift but when I say directory to `/src` it doesn't recurse correctly. For example: When trying `./src` I get 4 files: (.venv) ./client$ jscodeshift -t ./scripts/flow-stats/coverage-transform.js...