Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/NullVoxPopuli/optional-chaining-codemod

there should be more codemods for mundane stuff like this
https://github.com/NullVoxPopuli/optional-chaining-codemod

Last synced: 11 days ago
JSON representation

there should be more codemods for mundane stuff like this

Lists

README

        

# optional-chaining-codemod

Transforms:

```
foo && foo.bar;
foo.bar && foo.bar.baz;

(foo || {}).bar;
((foo || {}).bar || {}).baz;
((foo || {}).bar || {}).baz();
```

to

```
foo?.bar;
foo.bar?.baz;

foo?.bar;
foo?.bar?.baz;
foo?.bar?.baz();
```

## Usage

To run a specific codemod from this project, you would run the following:

```
npx @nullvoxpopuli/optional-chaining-codemod path/of/files/ or/some**/*glob.js

# or

yarn global add @nullvoxpopuli/optional-chaining-codemod
optional-chaining-codemod path/of/files/ or/some**/*glob.js

# or

volta install @nullvoxpopuli/optional-chaining-codemod
optional-chaining-codemod path/of/files/ or/some**/*glob.js
```

## Transforms

* [optional-chaining](transforms/optional-chaining/README.md)

## Contributing

### Installation

* clone the repo
* change into the repo directory
* `yarn`

### Running tests

* `yarn test`

### Update Documentation

* `yarn update-docs`