More assertions for usage pattern
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
context: I'm maintaining https://github.com/cometkim/vite-plugin-relay-lite
Specifically, It would be nice to move this assertion to the compiler, not the Babel plugin.
https://github.com/facebook/relay/blob/b22d53f/packages/babel-plugin-relay/compileGraphQLTag.js#L50-L54
I recently got a user report that vite-plugin-relay-lite has an unintended feature. He showed me that it was locating fragment definitions right next to a query, which was clearly not recommended in Relay.
I immediately asked, "Shouldn't that be banned?", but the assertion only exists at the Babel plugin, not the compiler. I often find cases where I opt into Relay but still end up breaking out of it, and I wish the compiler had more guardrails.
Contributor guide
Research direction
Start with the assertion in compileGraphQLTag.js linked in the issue, then trace the Relay compiler validation path that handles the same usage pattern. Define done as enforcing the restriction in the compiler so fragment definitions placed next to a query are rejected, rather than relying only on the Babel plugin.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript, react, rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100