Skip to content

Conversation

@hectahertz
Copy link
Contributor

Summary

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

This PR 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 (build-time) and ESLint plugin (lint-time) share a single source of truth for excluded files

When a component is migrated to support the compiler, removing it from the unsupportedPatterns list in react-compiler.mjs will automatically enable both build-time compilation and lint-time validation.

How did you test this change?

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 — zero react-compiler/react-compiler warnings, confirming the source is compiler-compatible.

…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: 7f363f1

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

return path.join(PACKAGE_DIR, match)
})
const unsupportedPatterns = [
'src/ActionList/**/*.tsx',
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

The PR description states "Ran npx eslint on all ActionList source files — zero react-compiler/react-compiler warnings, confirming the source is compiler-compatible." However, ActionList is still included in the unsupportedPatterns array at line 15, which means the react-compiler rule is disabled for ActionList files. If ActionList is truly compiler-compatible with zero warnings, it should be removed from this exclusion list to enable both build-time compilation and lint-time validation for those files.

Copilot uses AI. Check for mistakes.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant