Skip to content

fix(eslint-plugin-react-dom): add React 19 precedence and blocking attributes, closes #1789 - #1790

Merged
Rel1cx merged 1 commit into
mainfrom
fix/react-19-precedence-blocking-attrs
May 19, 2026
Merged

fix(eslint-plugin-react-dom): add React 19 precedence and blocking attributes, closes #1789#1790
Rel1cx merged 1 commit into
mainfrom
fix/react-19-precedence-blocking-attrs

Conversation

@Rel1cx

@Rel1cx Rel1cx commented May 19, 2026

Copy link
Copy Markdown
Owner

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Perf
  • Docs
  • Test
  • Chore
  • Enhancement
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • I have added a convincing reason for adding this feature, if necessary

Other information

Added React 19 precedence and blocking attributes to the tag-specific attribute checks in no-unknown-property, preventing false positives on <style>, <link>, and <script> elements when using React 19 or later.

…tributes

- Add precedence and blocking to tag-specific attribute checks
- Version-gate these attributes behind React >= 19.0.0-rc.0
- Update tests and changelog
@vercel

vercel Bot commented May 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
eslint-react Ready Ready Preview, Comment May 19, 2026 9:07pm

Request Review

@Rel1cx
Rel1cx requested a review from Copilot May 19, 2026 21:07
@Rel1cx
Rel1cx merged commit 5d0d459 into main May 19, 2026
14 checks passed
@Rel1cx
Rel1cx deleted the fix/react-19-precedence-blocking-attrs branch May 19, 2026 21:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the react-dom/no-unknown-property rule to recognize React 19’s new tag-specific attributes (precedence, blocking) and apply tag-allowlist checks to avoid false positives on <style>, <link>, and <script> when targeting React 19+.

Changes:

  • Added React 19 tag-specific attribute allowlists (precedence, blocking) gated behind React >= 19.0.0-rc.0.
  • Updated the rule to use a React-version-aware attribute→allowed-tags map instead of the static map.
  • Added/updated rule tests and documented the fix in the rule changelog.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
plugins/eslint-plugin-react-dom/src/rules/no-unknown-property/no-unknown-property.ts Switches to a version-aware attribute-tags map when validating tag-specific attributes.
plugins/eslint-plugin-react-dom/src/rules/no-unknown-property/lib.ts Introduces React 19 tag-specific attribute map and an accessor to return the correct map per React version.
plugins/eslint-plugin-react-dom/src/rules/no-unknown-property/no-unknown-property.spec.ts Adds coverage for precedence/blocking, including React 18 gating cases and new valid examples.
plugins/eslint-plugin-react-dom/src/rules/no-unknown-property/CHANGELOG.md Documents the React 19 attribute fix under Unreleased.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 165 to 169
// Check if attribute is allowed only on specific tags
const allowedTags = has(ATTRIBUTE_TAGS_MAP, name)
? ATTRIBUTE_TAGS_MAP[name]
const attributeTagsMap = getAttributeTagsMap(context);
const allowedTags = has(attributeTagsMap, name)
? attributeTagsMap[name]
: null;
Comment on lines +914 to +918
export const REACT_19_PROPS: string[] = [
...POPOVER_API_PROPS,
];

/**
Comment on lines +653 to 656
{ code: '<link rel="stylesheet" href="styles.css" precedence="medium" />' },
{ code: '<style href="style.css" precedence="default">{`body { color: red; }`}</style>' },
{ code: '<script async src="script.js" blocking="render" />' },
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants