facebook / facebook/jscodeshift
Better error message when trying to replace CallExpressions instead of ExpressionStatement or VariableDeclarator
- Dominant language
- JavaScript
- Stars
- 10k
- Forks
- 498
- PR merge metrics
- No merged PRs in 30d
Description
I hit a vague "Could not replace path" error today: http://astexplorer.net/#/gist/cfb2f93a39c4a80a1ecf44930092b59f/edca9a554a9aad19c62f098b07ee024a9c418241
After digging around for a while, I found #157, where @fkling wrote:
> You should not be looking for CallExpressions but for ExpressionStatements that contain a CallExpression that matches your constraints.
This was exactly my issue! Changing the script to instead look for the `ExpressionStatement` worked fine: http://astexplorer.net/#/gist/cfb2f93a39c4a80a1ecf44930092b59f/7b4a6f22da67d31cb18e768e0da975f26244ea1e
Can we make the "Could not replace path" error better?
Contributor guide
Assessment
This issue has not been assessed yet.