facebook / facebook/jscodeshift

Babel transpilation skipped if codemod is installed globally

Open
#250 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10k
Forks
498
PR merge metrics
No merged PRs in 30d

Description

When a codemod is installed globally (`npm i -g`), for example because a custom CLI command is supplied that wraps `jscodeshift`, Babel transpilation is skipped. This is because `babel-register` will not process any files that have a `node_modules` in their path (see https://github.com/babel/babel/blob/6.x/packages/babel-register/src/node.js#L91). But this is always the case when the package is installed globally (e.g. at `/usr/local/lib/node_modules`).

It would be possible to customize Babel's behavior when a custom `ignore` or `only` option could be used, but unfortunately these options are hardcoded in jscodeshift (related #245).

See also https://github.com/babel/website/issues/703

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.