https://github.com/vscodeshift/apply-jscodeshift
apply jscodeshift to active text editor in VSCode, passing selected range as options
https://github.com/vscodeshift/apply-jscodeshift
codemods jscodeshift vscode
Last synced: 6 months ago
JSON representation
apply jscodeshift to active text editor in VSCode, passing selected range as options
- Host: GitHub
- URL: https://github.com/vscodeshift/apply-jscodeshift
- Owner: vscodeshift
- License: mit
- Created: 2020-01-17T18:16:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T05:16:36.000Z (almost 3 years ago)
- Last Synced: 2025-02-10T09:15:15.008Z (8 months ago)
- Topics: codemods, jscodeshift, vscode
- Language: TypeScript
- Homepage:
- Size: 3.32 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# @vscodeshift/apply-jscodeshift
[](https://circleci.com/gh/vscodeshift/apply-jscodeshift)
[](https://codecov.io/gh/vscodeshift/apply-jscodeshift)
[](https://github.com/semantic-release/semantic-release)
[](http://commitizen.github.io/cz-cli/)
[](https://badge.fury.io/js/%40vscodeshift%2Fapply-jscodeshift)apply jscodeshift to active text editor, passing selected range as options.
Tries to intelligently determine the parser. If `@babel/core` is present in the project,
it will be used along with the project's babel config (except for ts/x files).## `applyTransform(transform, [options])`
```ts
import applyTransform from '@vscodeshift/apply-jscodeshift'
```Applies the given `jscodeshift` transform to the active text editor.
### Arguments
#### `transform` (`jscodeshift.Transform`, **required**)
The transform to apply.
#### `options` (`jscodeshift.Options`, _optional_)
Options to pass to the transform. By default, `selectionStart`
and `selectionEnd` will be passed to the transform.### Returns (`Promise`)
A promise that will resolve to the output of the transform
(which will have also been applied to the active text editor
if it returns a string)