facebook / facebook/jscodeshift
replaceWith templateElement add blank space
- Dominant language
- JavaScript
- Stars
- 10k
- Forks
- 498
- PR merge metrics
- No merged PRs in 30d
Description
```javascript
import { default as j } from 'jscodeshift';
const source ='var a = `aaa-1${a}`\nconsole.log(123);';
// console.log('source:', source);
let c = j(source)
.find(j.TemplateElement, { value: { raw: 'aaa-1' } })
.forEach(path => {
j(path).replaceWith(
j.templateElement({ cooked: 'aaa-1', raw: 'aaa-1' }, false)
);
// console.log('123:', path.value);
})
.map(path => {
console.log('get:', path.value);
})
.toSource();
console.log(' c:', c);
```
i expect result :
```
var a = `aaa-1${a}`
console.log(123);
```
but transform:
```
var a = `aaa-1 ${a}`
console.log(123);
```
One more space
Contributor guide
Assessment
This issue has not been assessed yet.