More assertions for usage pattern
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.
Yeah, this should be enforced by the compiler. Maybe somewhere around here? Would you like to work on a PR?
Yes. I'll make the PR