facebook / facebook/jscodeshift

statement(s) templates yields some weird stuff

Open
#312 6 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
10k
Forks
498
PR merge metrics
No merged PRs in 30d

Description

consider the following snippet
```js
const statement = template.statements`const ${name} = require('${name}');
`;
```
the output is as follows:
```js
const range_1 = require('$jscodeshift1441$');
const minimal_connectivity_leg_1 = require('$jscodeshift1443$');
const connectivity_path_1 = require('$jscodeshift1445$');
const connectivity_ref_1 = require('$jscodeshift1447$');
const new_connectivity_path_1 = require('$jscodeshift1449$');
const core_1 = require('$jscodeshift1451$');
const menu_1 = require('$jscodeshift1453$');
const versioned_1 = require('$jscodeshift1455$');
```
note, that the first use of `name` is correct, whereas the second one takes some of jscodeshift internals

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.