feat: add jsx-no-conflicting-pragmas rule - #1505
Open
bartlomieju wants to merge 2 commits into
Open
Conversation
Flags using the automatic-runtime pragma `@jsxImportSource` together with the classic-runtime pragmas `@jsx` / `@jsxFragment`. When both are present the classic pragmas are silently ignored, which is a footgun. The rule is tagged `react`/`jsx` but not `recommended`, so it must be enabled explicitly for now. Closes #969.
Member
Author
|
Verdict: LGTM — correct and well-tested. Recommend merge after resolving the schema conflict + rebase (new rule → maintainer product decision, which you've explicitly flagged). Not auto-merging (new rule). Correctness — verified the regex boundaries (the crux of this rule)
Perf: fine — two Minor
Housekeeping / blockers
No code changes requested. Solid rule; just docs + the schema-file conflict + rebase before landing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a rule that flags mixing the automatic-runtime pragma
@jsxImportSourcewith the classic-runtime pragmas@jsx/@jsxFragment(or@jsxFrag) in the same file:When
@jsxImportSourceis set the file uses the automatic runtime, so the@jsxand@jsxFragmentpragmas are silently ignored. Having both is afootgun — you should use one runtime or the other. The rule reports each
classic pragma when an
@jsxImportSourcepragma is also present, and onlylooks at the file's leading comments, where pragmas actually take effect.
The rule is tagged
react/jsxbut intentionally left out ofrecommended, so it must be enabled explicitly. Happy to promote it torecommendedif preferred — flagging the decision rather than making it.Closes #969.