Skip to content

chore: add eslint-plugin-react-compiler for lint-time compiler validation#7536

Open
hectahertz wants to merge 8 commits intomainfrom
hectahertz/enable-react-compiler-linting
Open

chore: add eslint-plugin-react-compiler for lint-time compiler validation#7536
hectahertz wants to merge 8 commits intomainfrom
hectahertz/enable-react-compiler-linting

Conversation

@hectahertz
Copy link
Contributor

@hectahertz hectahertz commented Feb 12, 2026

Closes #

React Compiler compatibility is currently only validated at build time via the Babel plugin. If a component violates the Rules of React, the issue is only surfaced during npm run build, not during local development or in CI lint checks.

This adds eslint-plugin-react-compiler to surface compiler diagnostics as ESLint warnings during npm run lint, giving developers immediate feedback in their editor and in CI.

Changes:

  • Install eslint-plugin-react-compiler as a dev dependency
  • Add react-compiler/react-compiler rule as warn in eslint.config.mjs
  • Disable the rule for files not yet migrated to React Compiler (matching the existing exclusion list)
  • Refactor packages/react/script/react-compiler.mjs to export the raw unsupportedPatterns array, so both the Babel plugin and ESLint plugin share a single source of truth for excluded files

Changelog

New

  • eslint-plugin-react-compiler lint rule (warn level) for compiler-compatible files

Changed

  • react-compiler.mjs now exports unsupportedPatterns array for shared use by Babel and ESLint configs

Removed

N/A

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; dev dependency and lint config only

Testing & Reviewing

Verified the ESLint rule resolves correctly for both supported and unsupported files:

# Supported file -> rule is "warn" (1)
$ npx eslint --print-config packages/react/src/ActionList/Item.tsx | grep -A2 react-compiler/react-compiler
"react-compiler/react-compiler": [1]

# Unsupported file -> rule is "off" (0)
$ npx eslint --print-config packages/react/src/Button/Button.tsx | grep -A2 react-compiler/react-compiler
"react-compiler/react-compiler": [0]

Ran npx eslint on all ActionList source files with zero react-compiler/react-compiler warnings.

Note: ActionList is intentionally kept in unsupportedPatterns in this PR to scope the change to linting infrastructure only. The follow-up PR #7537 removes ActionList from the exclusion list.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Storybook)
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge
  • (GitHub staff only) Integration tests pass at github/github

…tion

- Install eslint-plugin-react-compiler as a dev dependency
- Add react-compiler/react-compiler rule as 'warn' in eslint.config.mjs
- Disable the rule for files not yet migrated to React Compiler
- Export unsupportedPatterns from react-compiler.mjs so both the
  Babel plugin (build-time) and ESLint plugin (lint-time) share a
  single source of truth for excluded files
@hectahertz hectahertz requested a review from a team as a code owner February 12, 2026 19:47
@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

⚠️ No Changeset found

Latest commit: efee7fc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Feb 12, 2026
@github-actions
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

Copy link
Contributor

Copilot AI left a comment

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 adds ESLint-based linting for React Compiler compatibility by installing eslint-plugin-react-compiler and configuring it to run during npm run lint. The goal is to surface React Compiler violations earlier in the development cycle (during linting) rather than only at build time.

Changes:

  • Installed eslint-plugin-react-compiler v19.1.0-rc.2 as a dev dependency
  • Configured the plugin in ESLint to warn on compiler violations, with exclusions for files not yet migrated
  • Refactored react-compiler.mjs to export unsupportedPatterns as a shared source of truth between build-time and lint-time exclusions

Reviewed changes

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

File Description
package.json Added eslint-plugin-react-compiler v19.1.0-rc.2 as a dev dependency; minor alphabetization adjustment for @github-ui/storybook-addon-performance-panel
package-lock.json Lockfile updates for the new dependency and its transitive dependencies; version bumps for example apps
packages/react/script/react-compiler.mjs Extracted unsupported patterns into a named array and exported it for use by ESLint config
eslint.config.mjs Added react-compiler plugin configuration with warnings enabled globally and disabled for unsupported file patterns

Copy link
Member

Choose a reason for hiding this comment

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

The changelog is for the devs who read the release notes. If this is an internal change, we don't need to publish a changeset, you can add the label skip-changesets instead 😇

Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

This looks great!

Left a tiny comment, approving in advance

@hectahertz hectahertz added the skip changeset This change does not need a changelog label Feb 16, 2026
@primer
Copy link
Contributor

primer bot commented Feb 18, 2026

🤖 Lint issues have been automatically fixed and committed to this PR.

@primer-integration
Copy link

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/13976

@primer-integration
Copy link

Integration test results from github/github-ui:

Failed  CI   Failed
Passed  VRT   Passed
Passed  Projects   Passed

CI check runs linting, type checking, and unit tests. Check the workflow logs for specific failures.

Need help? If you believe this failure is unrelated to your changes, please reach out to the Primer team for assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments