chore: add eslint-plugin-react-compiler for lint-time compiler validation#7536
chore: add eslint-plugin-react-compiler for lint-time compiler validation#7536hectahertz wants to merge 8 commits intomainfrom
Conversation
…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
|
|
👋 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 |
There was a problem hiding this comment.
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-compilerv19.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.mjsto exportunsupportedPatternsas 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 |
.changeset/react-compiler-linting.md
Outdated
There was a problem hiding this comment.
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 😇
siddharthkp
left a comment
There was a problem hiding this comment.
This looks great!
Left a tiny comment, approving in advance
|
🤖 Lint issues have been automatically fixed and committed to this PR. |
|
👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/13976 |
|
Integration test results from github/github-ui:
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. |
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-compilerto surface compiler diagnostics as ESLint warnings duringnpm run lint, giving developers immediate feedback in their editor and in CI.Changes:
eslint-plugin-react-compileras a dev dependencyreact-compiler/react-compilerrule aswarnineslint.config.mjspackages/react/script/react-compiler.mjsto export the rawunsupportedPatternsarray, so both the Babel plugin and ESLint plugin share a single source of truth for excluded filesChangelog
New
eslint-plugin-react-compilerlint rule (warnlevel) for compiler-compatible filesChanged
react-compiler.mjsnow exportsunsupportedPatternsarray for shared use by Babel and ESLint configsRemoved
N/A
Rollout strategy
Testing & Reviewing
Verified the ESLint rule resolves correctly for both supported and unsupported files:
Ran
npx eslinton all ActionList source files with zeroreact-compiler/react-compilerwarnings.Note: ActionList is intentionally kept in
unsupportedPatternsin this PR to scope the change to linting infrastructure only. The follow-up PR #7537 removes ActionList from the exclusion list.Merge checklist