kentcdodds / kentcdodds/babel-plugin-preval
Bug: throw Unexpected Name when pass string literal
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 48
- PR merge metrics
- No merged PRs in 30d
Description
- `babel-plugin-preval` version: 5.0.0 (preval.macro 3.0.0)
- `node` version: v14.16.1
- `npm` (or `yarn`) version: 6.14.12
Relevant code or config
```javascript
export const searchPosts = preval`
const tool = require('../../graphql/utils');
module.exports = tool.maxDepth("searchPosts", 2);
`
```
What happened:
The `"searchPosts"` supposed to be a string literal, but this is what happened
```
preval.macro: Syntax Error: Unexpected Name "searchPosts". Learn more: https://www.npmjs.com/package/preval.macro
```
Reproduction repository:
I'll provide it when needed
Contributor guide
Research direction
Start with the preval tagged-template example and reproduce it with the listed babel-plugin-preval, preval.macro, Node, and npm versions. Check how the string literal passed to ../../graphql/utils is parsed; done means the example no longer reports Unexpected Name "searchPosts".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100