Skip to content

[eslint-plugin-react-hooks] Skip compilation for non-React files - #35589

Merged
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks
Jan 21, 2026
Merged

[eslint-plugin-react-hooks] Skip compilation for non-React files#35589
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks

Conversation

@josephsavona

Copy link
Copy Markdown
Contributor

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.

The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:

  • Capitalized functions: MyComponent, Button, App
  • Hook pattern functions: useEffect, useState, useMyCustomHook

Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.

Also adds test coverage for the heuristic edge cases.

@github-actionsgithub-actionsBot added the React Core Team Opened by a member of the React Core Team label Jan 21, 2026
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 4294b40 to 69acef3CompareJanuary 21, 2026 19:49
@react-sizebot

react-sizebot commented Jan 21, 2026

Copy link
Copy Markdown

Comparing: cdbd55f...16049c8

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-stable/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB=1.88 kB1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js+0.01%608.67 kB608.73 kB+0.02%107.63 kB107.65 kB
oss-experimental/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB+0.05%1.88 kB1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js=674.60 kB674.66 kB+0.02%118.57 kB118.59 kB
facebook-www/ReactDOM-prod.classic.js=694.04 kB694.11 kB+0.01%122.01 kB122.02 kB
facebook-www/ReactDOM-prod.modern.js=684.43 kB684.50 kB+0.02%120.40 kB120.42 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB

Generated by 🚫 dangerJS against 16049c8

@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 69acef3 to bcdfcecCompareJanuary 21, 2026 20:01
@josephsavona

Copy link
Copy Markdown
ContributorAuthor

Mitigates #35395 — internally at Meta we don't see a major issue with time from the React Compiler rules. That's almost certainly because we selectively apply rules based on files, and only apply the RC rules to likely React files.

This PR applies a similar heuristic to eprh itself. Before, we would eagerly reparse the source of every single file, only to have RC to bail out of analyzing it if there weren't any React functions. Now we do a quick scan of the ESTree (no conversion) to decide if there are candidate React functions.

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:
- Capitalized names: MyComponent, Button, App
- Hook-like names: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from bcdfcec to 16049c8CompareJanuary 21, 2026 20:17

@potetopoteto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice!

@josephsavona
josephsavona merged commit 03ee29d into react:mainJan 21, 2026
234 checks passed
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
736-c41-2c1-e464fc974 pushed a commit to Swiss-Armed-Forces/Loom that referenced this pull request Apr 27, 2026
This MR contains the following updates:
| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [ajv](https://ajv.js.org) ([source](https://github.com/ajv-validator/ajv)) | dependencies | minor | [`8.18.0` → `8.20.0`](https://renovatebot.com/diffs/npm/ajv/8.18.0/8.20.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ajv-validator/ajv/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ajv-validator/ajv) |
| [eslint-plugin-react-hooks](https://react.dev/) ([source](https://github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks)) | devDependencies | minor | [`7.0.1` → `7.1.1`](https://renovatebot.com/diffs/npm/eslint-plugin-react-hooks/7.0.1/7.1.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/facebook/react/badge)](https://securityscorecards.dev/viewer/?uri=github.com/facebook/react) |
| [react-toastify](https://github.com/fkhadra/react-toastify) | dependencies | minor | [`11.0.5` → `11.1.0`](https://renovatebot.com/diffs/npm/react-toastify/11.0.5/11.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/fkhadra/react-toastify/badge)](https://securityscorecards.dev/viewer/?uri=github.com/fkhadra/react-toastify) |
| [typescript-eslint](https://typescript-eslint.io/packages/typescript-eslint) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/typescript-eslint/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [vite-plugin-static-copy](https://github.com/sapphi-red/vite-plugin-static-copy) | devDependencies | minor | [`4.0.1` → `4.1.0`](https://renovatebot.com/diffs/npm/vite-plugin-static-copy/4.0.1/4.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sapphi-red/vite-plugin-static-copy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/sapphi-red/vite-plugin-static-copy) |
---
### Release Notes
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
##### 🚀 Features
- **eslint-plugin:** \[no-unnecessary-type-assertion] report more cases based on assignability ([#&#8203;11789](typescript-eslint/typescript-eslint#11789))
##### ❤️ Thank You
- Ulrich Stark
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for parser to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>ajv-validator/ajv (ajv)</summary>
### [`v8.20.0`](https://github.com/ajv-validator/ajv/releases/tag/v8.20.0)
[Compare Source](ajv-validator/ajv@v8.18.0...v8.20.0)
#### What's Changed
- fix: add support for node 22/24, drop node 16/21 by [@&#8203;jasoniangreen](https://github.com/jasoniangreen) in [#&#8203;2580](ajv-validator/ajv#2580)
- fix: add ES2022.RegExp for RegExpIndicesArray by [@&#8203;SignpostMarv](https://github.com/SignpostMarv) in [#&#8203;2604](ajv-validator/ajv#2604)
**Full Changelog**: <ajv-validator/ajv@v8.19.0...v8.20.0>
</details>
<details>
<summary>facebook/react (eslint-plugin-react-hooks)</summary>
### [`v7.1.1`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#711)
[Compare Source](https://github.com/facebook/react/compare/eslint-plugin-react-hooks@7.1.0...eslint-plugin-react-hooks@7.1.1)
**Note:** 7.1.0 accidentally removed the `component-hook-factories` rule, causing errors for users who referenced it in their ESLint config. This is now fixed.
- Add deprecated no-op `component-hook-factories` rule for backwards compatibility. ([@&#8203;mofeiZ](https://github.com/mofeiZ) in [#&#8203;36307](react/react#36307))
### [`v7.1.0`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#710)
[Compare Source](https://github.com/facebook/react/compare/408b38ef7304faf022d2a37110c57efce12c6bad...eslint-plugin-react-hooks@7.1.0)
This release adds ESLint v10 support, improves performance by skipping compilation for non-React files, and includes compiler lint improvements including better `set-state-in-effect` detection, improved ref validation, and more helpful error reporting.
- Add ESLint v10 support. ([@&#8203;azat-io](https://github.com/azat-io) in [#&#8203;35720](react/react#35720))
- Skip compilation for non-React files to improve performance. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35589](react/react#35589))
- Fix exhaustive deps bug with Flow type casting. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35691](react/react#35691))
- Fix `useEffectEvent` checks in component syntax. ([@&#8203;jbrown215](https://github.com/jbrown215) in [#&#8203;35041](react/react#35041))
- Improved `set-state-in-effect` validation with fewer false negatives. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35134](react/react#35134), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35147](react/react#35147), [@&#8203;jackpope](https://github.com/jackpope) in [#&#8203;35214](react/react#35214), [@&#8203;chesnokov-tony](https://github.com/chesnokov-tony) in [#&#8203;35419](react/react#35419), [@&#8203;jsleitor](https://github.com/jsleitor) in [#&#8203;36107](react/react#36107))
- Improved ref validation for non-mutating functions and event handler props. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35893](react/react#35893), [@&#8203;kolvian](https://github.com/kolvian) in [#&#8203;35062](react/react#35062))
- Compiler now reports all errors instead of stopping at the first. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35873](https://github.com/facebook/react/pull/35873)–[#&#8203;35884](https://github.com/facebook/react/pull/35884))
- Improved source locations and error display in compiler diagnostics. ([@&#8203;nathanmarks](https://github.com/nathanmarks) in [#&#8203;35348](react/react#35348), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;34963](react/react#34963))
</details>
<details>
<summary>fkhadra/react-toastify (react-toastify)</summary>
### [`v11.1.0`](https://github.com/fkhadra/react-toastify/releases/tag/v11.1.0)
[Compare Source](fkhadra/react-toastify@v11.0.5...v11.1.0)
### Release Notes
#### Features
- **CSP nonce support.** `<ToastContainer nonce={...}>` applies the nonce to the
injected `<style>` tag. Closes [#&#8203;1209](fkhadra/react-toastify#1209).
#### Fixes
- `onChange` fires `status: 'removed'` synchronously on `toast.dismiss()` instead
of after the exit animation — observers (incl. `useNotificationCenter`) now
see correctly ordered events. Also guards against double-`onClose`. Closes [#&#8203;1275](fkhadra/react-toastify#1275).
- Touch drag no longer re-pauses the toast on release — the old check compared a
PointerEvent against `'touchend'`, which never matched. Closes [#&#8203;1217](fkhadra/react-toastify#1217).
- Vertical drag now visually moves the toast (`--y` gets a unit). Thanks
[@&#8203;janpaepke](https://github.com/janpaepke), [#&#8203;1277](fkhadra/react-toastify#1277).
- Stacked scale is clamped at 0.5, preventing zero/negative scale in deep
stacks. Closes [#&#8203;1171](fkhadra/react-toastify#1171), [#&#8203;1174](fkhadra/react-toastify#1174).
- Stacked container respects mobile `100vw` again. Closes [#&#8203;1234](fkhadra/react-toastify#1234).
#### Accessibility
- `role="progressbar"` now includes `aria-valuenow`, `aria-valuemin`, `aria-valuemax`.
Thanks [@&#8203;singhankit001](https://github.com/singhankit001), [#&#8203;1283](fkhadra/react-toastify#1283). Closes [#&#8203;1259](fkhadra/react-toastify#1259).
#### Internal
- Migrated to a pnpm workspace (`pnpm link .` no longer required for contributors).
Publish layout unchanged — addon still ships inside the main package.
- CSS now injected at mount via `useStyleSheet` (prerequisite for `nonce`).
- Dep bumps: TypeScript 6, Vite 8, Cypress 15, React 19.2, plus the rest.
- CI: `upload-artifact` v3 → v4.
Thanks to [@&#8203;janpaepke](https://github.com/janpaepke), [@&#8203;singhankit001](https://github.com/singhankit001), and reporters of the fixed issues.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (typescript-eslint)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/typescript-eslint/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for typescript-eslint to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>sapphi-red/vite-plugin-static-copy (vite-plugin-static-copy)</summary>
### [`v4.1.0`](https://github.com/sapphi-red/vite-plugin-static-copy/blob/HEAD/CHANGELOG.md#410)
[Compare Source](https://github.com/sapphi-red/vite-plugin-static-copy/compare/vite-plugin-static-copy@4.0.1...vite-plugin-static-copy@4.1.0)
##### Minor Changes
- [#&#8203;251](sapphi-red/vite-plugin-static-copy#251) [`7672842`](sapphi-red/vite-plugin-static-copy@7672842) Thanks [@&#8203;sapphi-red](https://github.com/sapphi-red)! - Add `name` property to the `rename` object form and allow rename functions to return a `RenameObject`. The `name` property replaces the file's basename (filename + extension), and can be combined with `stripBase` to both flatten directory structure and rename the file in one step. Rename functions can now return `{ name, stripBase }` objects instead of only strings, making it easier to declaratively control output paths from dynamic rename logic.
```js
// node_modules/lib/dist/index.js → vendor/lib.js
{ src: 'node_modules/lib/dist/index.js', dest: 'vendor', rename: { name: 'lib.js', stripBase: true } }
// src/pages/events/test.html → dist/events/index.html
{ src: 'src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2, name: 'index.html' } }
```
</details>
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box
---
This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjkuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE0MS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->
See merge request swiss-armed-forces/cyber-command/cea/loom!480
Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedReact Core TeamOpened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@josephsavona@react-sizebot@poteto
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
[eslint-plugin-react-hooks] Skip compilation for non-React files by josephsavona · Pull Request #35589 · react/react · GitHub
Skip to content

[eslint-plugin-react-hooks] Skip compilation for non-React files - #35589

Merged
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks
Jan 21, 2026
Merged

[eslint-plugin-react-hooks] Skip compilation for non-React files#35589
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks

Conversation

@josephsavona

Copy link
Copy Markdown
Contributor

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.

The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:

  • Capitalized functions: MyComponent, Button, App
  • Hook pattern functions: useEffect, useState, useMyCustomHook

Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.

Also adds test coverage for the heuristic edge cases.

@github-actionsgithub-actionsBot added the React Core Team Opened by a member of the React Core Team label Jan 21, 2026
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 4294b40 to 69acef3CompareJanuary 21, 2026 19:49
@react-sizebot

react-sizebot commented Jan 21, 2026

Copy link
Copy Markdown

Comparing: cdbd55f...16049c8

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-stable/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB=1.88 kB1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js+0.01%608.67 kB608.73 kB+0.02%107.63 kB107.65 kB
oss-experimental/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB+0.05%1.88 kB1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js=674.60 kB674.66 kB+0.02%118.57 kB118.59 kB
facebook-www/ReactDOM-prod.classic.js=694.04 kB694.11 kB+0.01%122.01 kB122.02 kB
facebook-www/ReactDOM-prod.modern.js=684.43 kB684.50 kB+0.02%120.40 kB120.42 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB

Generated by 🚫 dangerJS against 16049c8

@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 69acef3 to bcdfcecCompareJanuary 21, 2026 20:01
@josephsavona

Copy link
Copy Markdown
ContributorAuthor

Mitigates #35395 — internally at Meta we don't see a major issue with time from the React Compiler rules. That's almost certainly because we selectively apply rules based on files, and only apply the RC rules to likely React files.

This PR applies a similar heuristic to eprh itself. Before, we would eagerly reparse the source of every single file, only to have RC to bail out of analyzing it if there weren't any React functions. Now we do a quick scan of the ESTree (no conversion) to decide if there are candidate React functions.

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:
- Capitalized names: MyComponent, Button, App
- Hook-like names: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from bcdfcec to 16049c8CompareJanuary 21, 2026 20:17

@potetopoteto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice!

@josephsavona
josephsavona merged commit 03ee29d into react:mainJan 21, 2026
234 checks passed
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
736-c41-2c1-e464fc974 pushed a commit to Swiss-Armed-Forces/Loom that referenced this pull request Apr 27, 2026
This MR contains the following updates:
| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [ajv](https://ajv.js.org) ([source](https://github.com/ajv-validator/ajv)) | dependencies | minor | [`8.18.0` → `8.20.0`](https://renovatebot.com/diffs/npm/ajv/8.18.0/8.20.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ajv-validator/ajv/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ajv-validator/ajv) |
| [eslint-plugin-react-hooks](https://react.dev/) ([source](https://github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks)) | devDependencies | minor | [`7.0.1` → `7.1.1`](https://renovatebot.com/diffs/npm/eslint-plugin-react-hooks/7.0.1/7.1.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/facebook/react/badge)](https://securityscorecards.dev/viewer/?uri=github.com/facebook/react) |
| [react-toastify](https://github.com/fkhadra/react-toastify) | dependencies | minor | [`11.0.5` → `11.1.0`](https://renovatebot.com/diffs/npm/react-toastify/11.0.5/11.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/fkhadra/react-toastify/badge)](https://securityscorecards.dev/viewer/?uri=github.com/fkhadra/react-toastify) |
| [typescript-eslint](https://typescript-eslint.io/packages/typescript-eslint) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/typescript-eslint/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [vite-plugin-static-copy](https://github.com/sapphi-red/vite-plugin-static-copy) | devDependencies | minor | [`4.0.1` → `4.1.0`](https://renovatebot.com/diffs/npm/vite-plugin-static-copy/4.0.1/4.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sapphi-red/vite-plugin-static-copy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/sapphi-red/vite-plugin-static-copy) |
---
### Release Notes
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
##### 🚀 Features
- **eslint-plugin:** \[no-unnecessary-type-assertion] report more cases based on assignability ([#&#8203;11789](typescript-eslint/typescript-eslint#11789))
##### ❤️ Thank You
- Ulrich Stark
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for parser to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>ajv-validator/ajv (ajv)</summary>
### [`v8.20.0`](https://github.com/ajv-validator/ajv/releases/tag/v8.20.0)
[Compare Source](ajv-validator/ajv@v8.18.0...v8.20.0)
#### What's Changed
- fix: add support for node 22/24, drop node 16/21 by [@&#8203;jasoniangreen](https://github.com/jasoniangreen) in [#&#8203;2580](ajv-validator/ajv#2580)
- fix: add ES2022.RegExp for RegExpIndicesArray by [@&#8203;SignpostMarv](https://github.com/SignpostMarv) in [#&#8203;2604](ajv-validator/ajv#2604)
**Full Changelog**: <ajv-validator/ajv@v8.19.0...v8.20.0>
</details>
<details>
<summary>facebook/react (eslint-plugin-react-hooks)</summary>
### [`v7.1.1`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#711)
[Compare Source](https://github.com/facebook/react/compare/eslint-plugin-react-hooks@7.1.0...eslint-plugin-react-hooks@7.1.1)
**Note:** 7.1.0 accidentally removed the `component-hook-factories` rule, causing errors for users who referenced it in their ESLint config. This is now fixed.
- Add deprecated no-op `component-hook-factories` rule for backwards compatibility. ([@&#8203;mofeiZ](https://github.com/mofeiZ) in [#&#8203;36307](react/react#36307))
### [`v7.1.0`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#710)
[Compare Source](https://github.com/facebook/react/compare/408b38ef7304faf022d2a37110c57efce12c6bad...eslint-plugin-react-hooks@7.1.0)
This release adds ESLint v10 support, improves performance by skipping compilation for non-React files, and includes compiler lint improvements including better `set-state-in-effect` detection, improved ref validation, and more helpful error reporting.
- Add ESLint v10 support. ([@&#8203;azat-io](https://github.com/azat-io) in [#&#8203;35720](react/react#35720))
- Skip compilation for non-React files to improve performance. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35589](react/react#35589))
- Fix exhaustive deps bug with Flow type casting. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35691](react/react#35691))
- Fix `useEffectEvent` checks in component syntax. ([@&#8203;jbrown215](https://github.com/jbrown215) in [#&#8203;35041](react/react#35041))
- Improved `set-state-in-effect` validation with fewer false negatives. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35134](react/react#35134), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35147](react/react#35147), [@&#8203;jackpope](https://github.com/jackpope) in [#&#8203;35214](react/react#35214), [@&#8203;chesnokov-tony](https://github.com/chesnokov-tony) in [#&#8203;35419](react/react#35419), [@&#8203;jsleitor](https://github.com/jsleitor) in [#&#8203;36107](react/react#36107))
- Improved ref validation for non-mutating functions and event handler props. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35893](react/react#35893), [@&#8203;kolvian](https://github.com/kolvian) in [#&#8203;35062](react/react#35062))
- Compiler now reports all errors instead of stopping at the first. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35873](https://github.com/facebook/react/pull/35873)–[#&#8203;35884](https://github.com/facebook/react/pull/35884))
- Improved source locations and error display in compiler diagnostics. ([@&#8203;nathanmarks](https://github.com/nathanmarks) in [#&#8203;35348](react/react#35348), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;34963](react/react#34963))
</details>
<details>
<summary>fkhadra/react-toastify (react-toastify)</summary>
### [`v11.1.0`](https://github.com/fkhadra/react-toastify/releases/tag/v11.1.0)
[Compare Source](fkhadra/react-toastify@v11.0.5...v11.1.0)
### Release Notes
#### Features
- **CSP nonce support.** `<ToastContainer nonce={...}>` applies the nonce to the
injected `<style>` tag. Closes [#&#8203;1209](fkhadra/react-toastify#1209).
#### Fixes
- `onChange` fires `status: 'removed'` synchronously on `toast.dismiss()` instead
of after the exit animation — observers (incl. `useNotificationCenter`) now
see correctly ordered events. Also guards against double-`onClose`. Closes [#&#8203;1275](fkhadra/react-toastify#1275).
- Touch drag no longer re-pauses the toast on release — the old check compared a
PointerEvent against `'touchend'`, which never matched. Closes [#&#8203;1217](fkhadra/react-toastify#1217).
- Vertical drag now visually moves the toast (`--y` gets a unit). Thanks
[@&#8203;janpaepke](https://github.com/janpaepke), [#&#8203;1277](fkhadra/react-toastify#1277).
- Stacked scale is clamped at 0.5, preventing zero/negative scale in deep
stacks. Closes [#&#8203;1171](fkhadra/react-toastify#1171), [#&#8203;1174](fkhadra/react-toastify#1174).
- Stacked container respects mobile `100vw` again. Closes [#&#8203;1234](fkhadra/react-toastify#1234).
#### Accessibility
- `role="progressbar"` now includes `aria-valuenow`, `aria-valuemin`, `aria-valuemax`.
Thanks [@&#8203;singhankit001](https://github.com/singhankit001), [#&#8203;1283](fkhadra/react-toastify#1283). Closes [#&#8203;1259](fkhadra/react-toastify#1259).
#### Internal
- Migrated to a pnpm workspace (`pnpm link .` no longer required for contributors).
Publish layout unchanged — addon still ships inside the main package.
- CSS now injected at mount via `useStyleSheet` (prerequisite for `nonce`).
- Dep bumps: TypeScript 6, Vite 8, Cypress 15, React 19.2, plus the rest.
- CI: `upload-artifact` v3 → v4.
Thanks to [@&#8203;janpaepke](https://github.com/janpaepke), [@&#8203;singhankit001](https://github.com/singhankit001), and reporters of the fixed issues.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (typescript-eslint)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/typescript-eslint/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for typescript-eslint to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>sapphi-red/vite-plugin-static-copy (vite-plugin-static-copy)</summary>
### [`v4.1.0`](https://github.com/sapphi-red/vite-plugin-static-copy/blob/HEAD/CHANGELOG.md#410)
[Compare Source](https://github.com/sapphi-red/vite-plugin-static-copy/compare/vite-plugin-static-copy@4.0.1...vite-plugin-static-copy@4.1.0)
##### Minor Changes
- [#&#8203;251](sapphi-red/vite-plugin-static-copy#251) [`7672842`](sapphi-red/vite-plugin-static-copy@7672842) Thanks [@&#8203;sapphi-red](https://github.com/sapphi-red)! - Add `name` property to the `rename` object form and allow rename functions to return a `RenameObject`. The `name` property replaces the file's basename (filename + extension), and can be combined with `stripBase` to both flatten directory structure and rename the file in one step. Rename functions can now return `{ name, stripBase }` objects instead of only strings, making it easier to declaratively control output paths from dynamic rename logic.
```js
// node_modules/lib/dist/index.js → vendor/lib.js
{ src: 'node_modules/lib/dist/index.js', dest: 'vendor', rename: { name: 'lib.js', stripBase: true } }
// src/pages/events/test.html → dist/events/index.html
{ src: 'src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2, name: 'index.html' } }
```
</details>
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box
---
This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjkuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE0MS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->
See merge request swiss-armed-forces/cyber-command/cea/loom!480
Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedReact Core TeamOpened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@josephsavona@react-sizebot@poteto
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [eslint-plugin-react-hooks] Skip compilation for non-React files by josephsavona · Pull Request #35589 · react/react · GitHub
Skip to content

[eslint-plugin-react-hooks] Skip compilation for non-React files - #35589

Merged
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks
Jan 21, 2026
Merged

[eslint-plugin-react-hooks] Skip compilation for non-React files#35589
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks

Conversation

@josephsavona

Copy link
Copy Markdown
Contributor

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.

The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:

  • Capitalized functions: MyComponent, Button, App
  • Hook pattern functions: useEffect, useState, useMyCustomHook

Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.

Also adds test coverage for the heuristic edge cases.

@github-actionsgithub-actionsBot added the React Core Team Opened by a member of the React Core Team label Jan 21, 2026
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 4294b40 to 69acef3CompareJanuary 21, 2026 19:49
@react-sizebot

react-sizebot commented Jan 21, 2026

Copy link
Copy Markdown

Comparing: cdbd55f...16049c8

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-stable/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB=1.88 kB1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js+0.01%608.67 kB608.73 kB+0.02%107.63 kB107.65 kB
oss-experimental/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB+0.05%1.88 kB1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js=674.60 kB674.66 kB+0.02%118.57 kB118.59 kB
facebook-www/ReactDOM-prod.classic.js=694.04 kB694.11 kB+0.01%122.01 kB122.02 kB
facebook-www/ReactDOM-prod.modern.js=684.43 kB684.50 kB+0.02%120.40 kB120.42 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB

Generated by 🚫 dangerJS against 16049c8

@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 69acef3 to bcdfcecCompareJanuary 21, 2026 20:01
@josephsavona

Copy link
Copy Markdown
ContributorAuthor

Mitigates #35395 — internally at Meta we don't see a major issue with time from the React Compiler rules. That's almost certainly because we selectively apply rules based on files, and only apply the RC rules to likely React files.

This PR applies a similar heuristic to eprh itself. Before, we would eagerly reparse the source of every single file, only to have RC to bail out of analyzing it if there weren't any React functions. Now we do a quick scan of the ESTree (no conversion) to decide if there are candidate React functions.

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:
- Capitalized names: MyComponent, Button, App
- Hook-like names: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from bcdfcec to 16049c8CompareJanuary 21, 2026 20:17

@potetopoteto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice!

@josephsavona
josephsavona merged commit 03ee29d into react:mainJan 21, 2026
234 checks passed
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
736-c41-2c1-e464fc974 pushed a commit to Swiss-Armed-Forces/Loom that referenced this pull request Apr 27, 2026
This MR contains the following updates:
| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [ajv](https://ajv.js.org) ([source](https://github.com/ajv-validator/ajv)) | dependencies | minor | [`8.18.0` → `8.20.0`](https://renovatebot.com/diffs/npm/ajv/8.18.0/8.20.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ajv-validator/ajv/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ajv-validator/ajv) |
| [eslint-plugin-react-hooks](https://react.dev/) ([source](https://github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks)) | devDependencies | minor | [`7.0.1` → `7.1.1`](https://renovatebot.com/diffs/npm/eslint-plugin-react-hooks/7.0.1/7.1.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/facebook/react/badge)](https://securityscorecards.dev/viewer/?uri=github.com/facebook/react) |
| [react-toastify](https://github.com/fkhadra/react-toastify) | dependencies | minor | [`11.0.5` → `11.1.0`](https://renovatebot.com/diffs/npm/react-toastify/11.0.5/11.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/fkhadra/react-toastify/badge)](https://securityscorecards.dev/viewer/?uri=github.com/fkhadra/react-toastify) |
| [typescript-eslint](https://typescript-eslint.io/packages/typescript-eslint) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/typescript-eslint/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [vite-plugin-static-copy](https://github.com/sapphi-red/vite-plugin-static-copy) | devDependencies | minor | [`4.0.1` → `4.1.0`](https://renovatebot.com/diffs/npm/vite-plugin-static-copy/4.0.1/4.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sapphi-red/vite-plugin-static-copy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/sapphi-red/vite-plugin-static-copy) |
---
### Release Notes
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
##### 🚀 Features
- **eslint-plugin:** \[no-unnecessary-type-assertion] report more cases based on assignability ([#&#8203;11789](typescript-eslint/typescript-eslint#11789))
##### ❤️ Thank You
- Ulrich Stark
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for parser to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>ajv-validator/ajv (ajv)</summary>
### [`v8.20.0`](https://github.com/ajv-validator/ajv/releases/tag/v8.20.0)
[Compare Source](ajv-validator/ajv@v8.18.0...v8.20.0)
#### What's Changed
- fix: add support for node 22/24, drop node 16/21 by [@&#8203;jasoniangreen](https://github.com/jasoniangreen) in [#&#8203;2580](ajv-validator/ajv#2580)
- fix: add ES2022.RegExp for RegExpIndicesArray by [@&#8203;SignpostMarv](https://github.com/SignpostMarv) in [#&#8203;2604](ajv-validator/ajv#2604)
**Full Changelog**: <ajv-validator/ajv@v8.19.0...v8.20.0>
</details>
<details>
<summary>facebook/react (eslint-plugin-react-hooks)</summary>
### [`v7.1.1`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#711)
[Compare Source](https://github.com/facebook/react/compare/eslint-plugin-react-hooks@7.1.0...eslint-plugin-react-hooks@7.1.1)
**Note:** 7.1.0 accidentally removed the `component-hook-factories` rule, causing errors for users who referenced it in their ESLint config. This is now fixed.
- Add deprecated no-op `component-hook-factories` rule for backwards compatibility. ([@&#8203;mofeiZ](https://github.com/mofeiZ) in [#&#8203;36307](react/react#36307))
### [`v7.1.0`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#710)
[Compare Source](https://github.com/facebook/react/compare/408b38ef7304faf022d2a37110c57efce12c6bad...eslint-plugin-react-hooks@7.1.0)
This release adds ESLint v10 support, improves performance by skipping compilation for non-React files, and includes compiler lint improvements including better `set-state-in-effect` detection, improved ref validation, and more helpful error reporting.
- Add ESLint v10 support. ([@&#8203;azat-io](https://github.com/azat-io) in [#&#8203;35720](react/react#35720))
- Skip compilation for non-React files to improve performance. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35589](react/react#35589))
- Fix exhaustive deps bug with Flow type casting. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35691](react/react#35691))
- Fix `useEffectEvent` checks in component syntax. ([@&#8203;jbrown215](https://github.com/jbrown215) in [#&#8203;35041](react/react#35041))
- Improved `set-state-in-effect` validation with fewer false negatives. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35134](react/react#35134), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35147](react/react#35147), [@&#8203;jackpope](https://github.com/jackpope) in [#&#8203;35214](react/react#35214), [@&#8203;chesnokov-tony](https://github.com/chesnokov-tony) in [#&#8203;35419](react/react#35419), [@&#8203;jsleitor](https://github.com/jsleitor) in [#&#8203;36107](react/react#36107))
- Improved ref validation for non-mutating functions and event handler props. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35893](react/react#35893), [@&#8203;kolvian](https://github.com/kolvian) in [#&#8203;35062](react/react#35062))
- Compiler now reports all errors instead of stopping at the first. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35873](https://github.com/facebook/react/pull/35873)–[#&#8203;35884](https://github.com/facebook/react/pull/35884))
- Improved source locations and error display in compiler diagnostics. ([@&#8203;nathanmarks](https://github.com/nathanmarks) in [#&#8203;35348](react/react#35348), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;34963](react/react#34963))
</details>
<details>
<summary>fkhadra/react-toastify (react-toastify)</summary>
### [`v11.1.0`](https://github.com/fkhadra/react-toastify/releases/tag/v11.1.0)
[Compare Source](fkhadra/react-toastify@v11.0.5...v11.1.0)
### Release Notes
#### Features
- **CSP nonce support.** `<ToastContainer nonce={...}>` applies the nonce to the
injected `<style>` tag. Closes [#&#8203;1209](fkhadra/react-toastify#1209).
#### Fixes
- `onChange` fires `status: 'removed'` synchronously on `toast.dismiss()` instead
of after the exit animation — observers (incl. `useNotificationCenter`) now
see correctly ordered events. Also guards against double-`onClose`. Closes [#&#8203;1275](fkhadra/react-toastify#1275).
- Touch drag no longer re-pauses the toast on release — the old check compared a
PointerEvent against `'touchend'`, which never matched. Closes [#&#8203;1217](fkhadra/react-toastify#1217).
- Vertical drag now visually moves the toast (`--y` gets a unit). Thanks
[@&#8203;janpaepke](https://github.com/janpaepke), [#&#8203;1277](fkhadra/react-toastify#1277).
- Stacked scale is clamped at 0.5, preventing zero/negative scale in deep
stacks. Closes [#&#8203;1171](fkhadra/react-toastify#1171), [#&#8203;1174](fkhadra/react-toastify#1174).
- Stacked container respects mobile `100vw` again. Closes [#&#8203;1234](fkhadra/react-toastify#1234).
#### Accessibility
- `role="progressbar"` now includes `aria-valuenow`, `aria-valuemin`, `aria-valuemax`.
Thanks [@&#8203;singhankit001](https://github.com/singhankit001), [#&#8203;1283](fkhadra/react-toastify#1283). Closes [#&#8203;1259](fkhadra/react-toastify#1259).
#### Internal
- Migrated to a pnpm workspace (`pnpm link .` no longer required for contributors).
Publish layout unchanged — addon still ships inside the main package.
- CSS now injected at mount via `useStyleSheet` (prerequisite for `nonce`).
- Dep bumps: TypeScript 6, Vite 8, Cypress 15, React 19.2, plus the rest.
- CI: `upload-artifact` v3 → v4.
Thanks to [@&#8203;janpaepke](https://github.com/janpaepke), [@&#8203;singhankit001](https://github.com/singhankit001), and reporters of the fixed issues.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (typescript-eslint)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/typescript-eslint/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for typescript-eslint to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>sapphi-red/vite-plugin-static-copy (vite-plugin-static-copy)</summary>
### [`v4.1.0`](https://github.com/sapphi-red/vite-plugin-static-copy/blob/HEAD/CHANGELOG.md#410)
[Compare Source](https://github.com/sapphi-red/vite-plugin-static-copy/compare/vite-plugin-static-copy@4.0.1...vite-plugin-static-copy@4.1.0)
##### Minor Changes
- [#&#8203;251](sapphi-red/vite-plugin-static-copy#251) [`7672842`](sapphi-red/vite-plugin-static-copy@7672842) Thanks [@&#8203;sapphi-red](https://github.com/sapphi-red)! - Add `name` property to the `rename` object form and allow rename functions to return a `RenameObject`. The `name` property replaces the file's basename (filename + extension), and can be combined with `stripBase` to both flatten directory structure and rename the file in one step. Rename functions can now return `{ name, stripBase }` objects instead of only strings, making it easier to declaratively control output paths from dynamic rename logic.
```js
// node_modules/lib/dist/index.js → vendor/lib.js
{ src: 'node_modules/lib/dist/index.js', dest: 'vendor', rename: { name: 'lib.js', stripBase: true } }
// src/pages/events/test.html → dist/events/index.html
{ src: 'src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2, name: 'index.html' } }
```
</details>
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box
---
This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjkuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE0MS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->
See merge request swiss-armed-forces/cyber-command/cea/loom!480
Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedReact Core TeamOpened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@josephsavona@react-sizebot@poteto
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [eslint-plugin-react-hooks] Skip compilation for non-React files by josephsavona · Pull Request #35589 · react/react · GitHub
Skip to content

[eslint-plugin-react-hooks] Skip compilation for non-React files - #35589

Merged
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks
Jan 21, 2026
Merged

[eslint-plugin-react-hooks] Skip compilation for non-React files#35589
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks

Conversation

@josephsavona

Copy link
Copy Markdown
Contributor

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.

The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:

  • Capitalized functions: MyComponent, Button, App
  • Hook pattern functions: useEffect, useState, useMyCustomHook

Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.

Also adds test coverage for the heuristic edge cases.

@github-actionsgithub-actionsBot added the React Core Team Opened by a member of the React Core Team label Jan 21, 2026
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 4294b40 to 69acef3CompareJanuary 21, 2026 19:49
@react-sizebot

react-sizebot commented Jan 21, 2026

Copy link
Copy Markdown

Comparing: cdbd55f...16049c8

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-stable/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB=1.88 kB1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js+0.01%608.67 kB608.73 kB+0.02%107.63 kB107.65 kB
oss-experimental/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB+0.05%1.88 kB1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js=674.60 kB674.66 kB+0.02%118.57 kB118.59 kB
facebook-www/ReactDOM-prod.classic.js=694.04 kB694.11 kB+0.01%122.01 kB122.02 kB
facebook-www/ReactDOM-prod.modern.js=684.43 kB684.50 kB+0.02%120.40 kB120.42 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB

Generated by 🚫 dangerJS against 16049c8

@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 69acef3 to bcdfcecCompareJanuary 21, 2026 20:01
@josephsavona

Copy link
Copy Markdown
ContributorAuthor

Mitigates #35395 — internally at Meta we don't see a major issue with time from the React Compiler rules. That's almost certainly because we selectively apply rules based on files, and only apply the RC rules to likely React files.

This PR applies a similar heuristic to eprh itself. Before, we would eagerly reparse the source of every single file, only to have RC to bail out of analyzing it if there weren't any React functions. Now we do a quick scan of the ESTree (no conversion) to decide if there are candidate React functions.

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:
- Capitalized names: MyComponent, Button, App
- Hook-like names: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from bcdfcec to 16049c8CompareJanuary 21, 2026 20:17

@potetopoteto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice!

@josephsavona
josephsavona merged commit 03ee29d into react:mainJan 21, 2026
234 checks passed
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
736-c41-2c1-e464fc974 pushed a commit to Swiss-Armed-Forces/Loom that referenced this pull request Apr 27, 2026
This MR contains the following updates:
| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [ajv](https://ajv.js.org) ([source](https://github.com/ajv-validator/ajv)) | dependencies | minor | [`8.18.0` → `8.20.0`](https://renovatebot.com/diffs/npm/ajv/8.18.0/8.20.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ajv-validator/ajv/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ajv-validator/ajv) |
| [eslint-plugin-react-hooks](https://react.dev/) ([source](https://github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks)) | devDependencies | minor | [`7.0.1` → `7.1.1`](https://renovatebot.com/diffs/npm/eslint-plugin-react-hooks/7.0.1/7.1.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/facebook/react/badge)](https://securityscorecards.dev/viewer/?uri=github.com/facebook/react) |
| [react-toastify](https://github.com/fkhadra/react-toastify) | dependencies | minor | [`11.0.5` → `11.1.0`](https://renovatebot.com/diffs/npm/react-toastify/11.0.5/11.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/fkhadra/react-toastify/badge)](https://securityscorecards.dev/viewer/?uri=github.com/fkhadra/react-toastify) |
| [typescript-eslint](https://typescript-eslint.io/packages/typescript-eslint) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/typescript-eslint/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [vite-plugin-static-copy](https://github.com/sapphi-red/vite-plugin-static-copy) | devDependencies | minor | [`4.0.1` → `4.1.0`](https://renovatebot.com/diffs/npm/vite-plugin-static-copy/4.0.1/4.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sapphi-red/vite-plugin-static-copy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/sapphi-red/vite-plugin-static-copy) |
---
### Release Notes
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
##### 🚀 Features
- **eslint-plugin:** \[no-unnecessary-type-assertion] report more cases based on assignability ([#&#8203;11789](typescript-eslint/typescript-eslint#11789))
##### ❤️ Thank You
- Ulrich Stark
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for parser to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>ajv-validator/ajv (ajv)</summary>
### [`v8.20.0`](https://github.com/ajv-validator/ajv/releases/tag/v8.20.0)
[Compare Source](ajv-validator/ajv@v8.18.0...v8.20.0)
#### What's Changed
- fix: add support for node 22/24, drop node 16/21 by [@&#8203;jasoniangreen](https://github.com/jasoniangreen) in [#&#8203;2580](ajv-validator/ajv#2580)
- fix: add ES2022.RegExp for RegExpIndicesArray by [@&#8203;SignpostMarv](https://github.com/SignpostMarv) in [#&#8203;2604](ajv-validator/ajv#2604)
**Full Changelog**: <ajv-validator/ajv@v8.19.0...v8.20.0>
</details>
<details>
<summary>facebook/react (eslint-plugin-react-hooks)</summary>
### [`v7.1.1`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#711)
[Compare Source](https://github.com/facebook/react/compare/eslint-plugin-react-hooks@7.1.0...eslint-plugin-react-hooks@7.1.1)
**Note:** 7.1.0 accidentally removed the `component-hook-factories` rule, causing errors for users who referenced it in their ESLint config. This is now fixed.
- Add deprecated no-op `component-hook-factories` rule for backwards compatibility. ([@&#8203;mofeiZ](https://github.com/mofeiZ) in [#&#8203;36307](react/react#36307))
### [`v7.1.0`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#710)
[Compare Source](https://github.com/facebook/react/compare/408b38ef7304faf022d2a37110c57efce12c6bad...eslint-plugin-react-hooks@7.1.0)
This release adds ESLint v10 support, improves performance by skipping compilation for non-React files, and includes compiler lint improvements including better `set-state-in-effect` detection, improved ref validation, and more helpful error reporting.
- Add ESLint v10 support. ([@&#8203;azat-io](https://github.com/azat-io) in [#&#8203;35720](react/react#35720))
- Skip compilation for non-React files to improve performance. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35589](react/react#35589))
- Fix exhaustive deps bug with Flow type casting. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35691](react/react#35691))
- Fix `useEffectEvent` checks in component syntax. ([@&#8203;jbrown215](https://github.com/jbrown215) in [#&#8203;35041](react/react#35041))
- Improved `set-state-in-effect` validation with fewer false negatives. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35134](react/react#35134), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35147](react/react#35147), [@&#8203;jackpope](https://github.com/jackpope) in [#&#8203;35214](react/react#35214), [@&#8203;chesnokov-tony](https://github.com/chesnokov-tony) in [#&#8203;35419](react/react#35419), [@&#8203;jsleitor](https://github.com/jsleitor) in [#&#8203;36107](react/react#36107))
- Improved ref validation for non-mutating functions and event handler props. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35893](react/react#35893), [@&#8203;kolvian](https://github.com/kolvian) in [#&#8203;35062](react/react#35062))
- Compiler now reports all errors instead of stopping at the first. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35873](https://github.com/facebook/react/pull/35873)–[#&#8203;35884](https://github.com/facebook/react/pull/35884))
- Improved source locations and error display in compiler diagnostics. ([@&#8203;nathanmarks](https://github.com/nathanmarks) in [#&#8203;35348](react/react#35348), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;34963](react/react#34963))
</details>
<details>
<summary>fkhadra/react-toastify (react-toastify)</summary>
### [`v11.1.0`](https://github.com/fkhadra/react-toastify/releases/tag/v11.1.0)
[Compare Source](fkhadra/react-toastify@v11.0.5...v11.1.0)
### Release Notes
#### Features
- **CSP nonce support.** `<ToastContainer nonce={...}>` applies the nonce to the
injected `<style>` tag. Closes [#&#8203;1209](fkhadra/react-toastify#1209).
#### Fixes
- `onChange` fires `status: 'removed'` synchronously on `toast.dismiss()` instead
of after the exit animation — observers (incl. `useNotificationCenter`) now
see correctly ordered events. Also guards against double-`onClose`. Closes [#&#8203;1275](fkhadra/react-toastify#1275).
- Touch drag no longer re-pauses the toast on release — the old check compared a
PointerEvent against `'touchend'`, which never matched. Closes [#&#8203;1217](fkhadra/react-toastify#1217).
- Vertical drag now visually moves the toast (`--y` gets a unit). Thanks
[@&#8203;janpaepke](https://github.com/janpaepke), [#&#8203;1277](fkhadra/react-toastify#1277).
- Stacked scale is clamped at 0.5, preventing zero/negative scale in deep
stacks. Closes [#&#8203;1171](fkhadra/react-toastify#1171), [#&#8203;1174](fkhadra/react-toastify#1174).
- Stacked container respects mobile `100vw` again. Closes [#&#8203;1234](fkhadra/react-toastify#1234).
#### Accessibility
- `role="progressbar"` now includes `aria-valuenow`, `aria-valuemin`, `aria-valuemax`.
Thanks [@&#8203;singhankit001](https://github.com/singhankit001), [#&#8203;1283](fkhadra/react-toastify#1283). Closes [#&#8203;1259](fkhadra/react-toastify#1259).
#### Internal
- Migrated to a pnpm workspace (`pnpm link .` no longer required for contributors).
Publish layout unchanged — addon still ships inside the main package.
- CSS now injected at mount via `useStyleSheet` (prerequisite for `nonce`).
- Dep bumps: TypeScript 6, Vite 8, Cypress 15, React 19.2, plus the rest.
- CI: `upload-artifact` v3 → v4.
Thanks to [@&#8203;janpaepke](https://github.com/janpaepke), [@&#8203;singhankit001](https://github.com/singhankit001), and reporters of the fixed issues.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (typescript-eslint)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/typescript-eslint/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for typescript-eslint to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>sapphi-red/vite-plugin-static-copy (vite-plugin-static-copy)</summary>
### [`v4.1.0`](https://github.com/sapphi-red/vite-plugin-static-copy/blob/HEAD/CHANGELOG.md#410)
[Compare Source](https://github.com/sapphi-red/vite-plugin-static-copy/compare/vite-plugin-static-copy@4.0.1...vite-plugin-static-copy@4.1.0)
##### Minor Changes
- [#&#8203;251](sapphi-red/vite-plugin-static-copy#251) [`7672842`](sapphi-red/vite-plugin-static-copy@7672842) Thanks [@&#8203;sapphi-red](https://github.com/sapphi-red)! - Add `name` property to the `rename` object form and allow rename functions to return a `RenameObject`. The `name` property replaces the file's basename (filename + extension), and can be combined with `stripBase` to both flatten directory structure and rename the file in one step. Rename functions can now return `{ name, stripBase }` objects instead of only strings, making it easier to declaratively control output paths from dynamic rename logic.
```js
// node_modules/lib/dist/index.js → vendor/lib.js
{ src: 'node_modules/lib/dist/index.js', dest: 'vendor', rename: { name: 'lib.js', stripBase: true } }
// src/pages/events/test.html → dist/events/index.html
{ src: 'src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2, name: 'index.html' } }
```
</details>
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box
---
This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjkuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE0MS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->
See merge request swiss-armed-forces/cyber-command/cea/loom!480
Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedReact Core TeamOpened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@josephsavona@react-sizebot@poteto
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' [eslint-plugin-react-hooks] Skip compilation for non-React files by josephsavona · Pull Request #35589 · react/react · GitHub
Skip to content

[eslint-plugin-react-hooks] Skip compilation for non-React files - #35589

Merged
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks
Jan 21, 2026
Merged

[eslint-plugin-react-hooks] Skip compilation for non-React files#35589
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks

Conversation

@josephsavona

Copy link
Copy Markdown
Contributor

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.

The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:

  • Capitalized functions: MyComponent, Button, App
  • Hook pattern functions: useEffect, useState, useMyCustomHook

Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.

Also adds test coverage for the heuristic edge cases.

@github-actionsgithub-actionsBot added the React Core Team Opened by a member of the React Core Team label Jan 21, 2026
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 4294b40 to 69acef3CompareJanuary 21, 2026 19:49
@react-sizebot

react-sizebot commented Jan 21, 2026

Copy link
Copy Markdown

Comparing: cdbd55f...16049c8

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-stable/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB=1.88 kB1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js+0.01%608.67 kB608.73 kB+0.02%107.63 kB107.65 kB
oss-experimental/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB+0.05%1.88 kB1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js=674.60 kB674.66 kB+0.02%118.57 kB118.59 kB
facebook-www/ReactDOM-prod.classic.js=694.04 kB694.11 kB+0.01%122.01 kB122.02 kB
facebook-www/ReactDOM-prod.modern.js=684.43 kB684.50 kB+0.02%120.40 kB120.42 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB

Generated by 🚫 dangerJS against 16049c8

@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 69acef3 to bcdfcecCompareJanuary 21, 2026 20:01
@josephsavona

Copy link
Copy Markdown
ContributorAuthor

Mitigates #35395 — internally at Meta we don't see a major issue with time from the React Compiler rules. That's almost certainly because we selectively apply rules based on files, and only apply the RC rules to likely React files.

This PR applies a similar heuristic to eprh itself. Before, we would eagerly reparse the source of every single file, only to have RC to bail out of analyzing it if there weren't any React functions. Now we do a quick scan of the ESTree (no conversion) to decide if there are candidate React functions.

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:
- Capitalized names: MyComponent, Button, App
- Hook-like names: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from bcdfcec to 16049c8CompareJanuary 21, 2026 20:17

@potetopoteto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice!

@josephsavona
josephsavona merged commit 03ee29d into react:mainJan 21, 2026
234 checks passed
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
736-c41-2c1-e464fc974 pushed a commit to Swiss-Armed-Forces/Loom that referenced this pull request Apr 27, 2026
This MR contains the following updates:
| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [ajv](https://ajv.js.org) ([source](https://github.com/ajv-validator/ajv)) | dependencies | minor | [`8.18.0` → `8.20.0`](https://renovatebot.com/diffs/npm/ajv/8.18.0/8.20.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ajv-validator/ajv/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ajv-validator/ajv) |
| [eslint-plugin-react-hooks](https://react.dev/) ([source](https://github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks)) | devDependencies | minor | [`7.0.1` → `7.1.1`](https://renovatebot.com/diffs/npm/eslint-plugin-react-hooks/7.0.1/7.1.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/facebook/react/badge)](https://securityscorecards.dev/viewer/?uri=github.com/facebook/react) |
| [react-toastify](https://github.com/fkhadra/react-toastify) | dependencies | minor | [`11.0.5` → `11.1.0`](https://renovatebot.com/diffs/npm/react-toastify/11.0.5/11.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/fkhadra/react-toastify/badge)](https://securityscorecards.dev/viewer/?uri=github.com/fkhadra/react-toastify) |
| [typescript-eslint](https://typescript-eslint.io/packages/typescript-eslint) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/typescript-eslint/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [vite-plugin-static-copy](https://github.com/sapphi-red/vite-plugin-static-copy) | devDependencies | minor | [`4.0.1` → `4.1.0`](https://renovatebot.com/diffs/npm/vite-plugin-static-copy/4.0.1/4.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sapphi-red/vite-plugin-static-copy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/sapphi-red/vite-plugin-static-copy) |
---
### Release Notes
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
##### 🚀 Features
- **eslint-plugin:** \[no-unnecessary-type-assertion] report more cases based on assignability ([#&#8203;11789](typescript-eslint/typescript-eslint#11789))
##### ❤️ Thank You
- Ulrich Stark
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for parser to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>ajv-validator/ajv (ajv)</summary>
### [`v8.20.0`](https://github.com/ajv-validator/ajv/releases/tag/v8.20.0)
[Compare Source](ajv-validator/ajv@v8.18.0...v8.20.0)
#### What's Changed
- fix: add support for node 22/24, drop node 16/21 by [@&#8203;jasoniangreen](https://github.com/jasoniangreen) in [#&#8203;2580](ajv-validator/ajv#2580)
- fix: add ES2022.RegExp for RegExpIndicesArray by [@&#8203;SignpostMarv](https://github.com/SignpostMarv) in [#&#8203;2604](ajv-validator/ajv#2604)
**Full Changelog**: <ajv-validator/ajv@v8.19.0...v8.20.0>
</details>
<details>
<summary>facebook/react (eslint-plugin-react-hooks)</summary>
### [`v7.1.1`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#711)
[Compare Source](https://github.com/facebook/react/compare/eslint-plugin-react-hooks@7.1.0...eslint-plugin-react-hooks@7.1.1)
**Note:** 7.1.0 accidentally removed the `component-hook-factories` rule, causing errors for users who referenced it in their ESLint config. This is now fixed.
- Add deprecated no-op `component-hook-factories` rule for backwards compatibility. ([@&#8203;mofeiZ](https://github.com/mofeiZ) in [#&#8203;36307](react/react#36307))
### [`v7.1.0`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#710)
[Compare Source](https://github.com/facebook/react/compare/408b38ef7304faf022d2a37110c57efce12c6bad...eslint-plugin-react-hooks@7.1.0)
This release adds ESLint v10 support, improves performance by skipping compilation for non-React files, and includes compiler lint improvements including better `set-state-in-effect` detection, improved ref validation, and more helpful error reporting.
- Add ESLint v10 support. ([@&#8203;azat-io](https://github.com/azat-io) in [#&#8203;35720](react/react#35720))
- Skip compilation for non-React files to improve performance. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35589](react/react#35589))
- Fix exhaustive deps bug with Flow type casting. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35691](react/react#35691))
- Fix `useEffectEvent` checks in component syntax. ([@&#8203;jbrown215](https://github.com/jbrown215) in [#&#8203;35041](react/react#35041))
- Improved `set-state-in-effect` validation with fewer false negatives. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35134](react/react#35134), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35147](react/react#35147), [@&#8203;jackpope](https://github.com/jackpope) in [#&#8203;35214](react/react#35214), [@&#8203;chesnokov-tony](https://github.com/chesnokov-tony) in [#&#8203;35419](react/react#35419), [@&#8203;jsleitor](https://github.com/jsleitor) in [#&#8203;36107](react/react#36107))
- Improved ref validation for non-mutating functions and event handler props. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35893](react/react#35893), [@&#8203;kolvian](https://github.com/kolvian) in [#&#8203;35062](react/react#35062))
- Compiler now reports all errors instead of stopping at the first. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35873](https://github.com/facebook/react/pull/35873)–[#&#8203;35884](https://github.com/facebook/react/pull/35884))
- Improved source locations and error display in compiler diagnostics. ([@&#8203;nathanmarks](https://github.com/nathanmarks) in [#&#8203;35348](react/react#35348), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;34963](react/react#34963))
</details>
<details>
<summary>fkhadra/react-toastify (react-toastify)</summary>
### [`v11.1.0`](https://github.com/fkhadra/react-toastify/releases/tag/v11.1.0)
[Compare Source](fkhadra/react-toastify@v11.0.5...v11.1.0)
### Release Notes
#### Features
- **CSP nonce support.** `<ToastContainer nonce={...}>` applies the nonce to the
injected `<style>` tag. Closes [#&#8203;1209](fkhadra/react-toastify#1209).
#### Fixes
- `onChange` fires `status: 'removed'` synchronously on `toast.dismiss()` instead
of after the exit animation — observers (incl. `useNotificationCenter`) now
see correctly ordered events. Also guards against double-`onClose`. Closes [#&#8203;1275](fkhadra/react-toastify#1275).
- Touch drag no longer re-pauses the toast on release — the old check compared a
PointerEvent against `'touchend'`, which never matched. Closes [#&#8203;1217](fkhadra/react-toastify#1217).
- Vertical drag now visually moves the toast (`--y` gets a unit). Thanks
[@&#8203;janpaepke](https://github.com/janpaepke), [#&#8203;1277](fkhadra/react-toastify#1277).
- Stacked scale is clamped at 0.5, preventing zero/negative scale in deep
stacks. Closes [#&#8203;1171](fkhadra/react-toastify#1171), [#&#8203;1174](fkhadra/react-toastify#1174).
- Stacked container respects mobile `100vw` again. Closes [#&#8203;1234](fkhadra/react-toastify#1234).
#### Accessibility
- `role="progressbar"` now includes `aria-valuenow`, `aria-valuemin`, `aria-valuemax`.
Thanks [@&#8203;singhankit001](https://github.com/singhankit001), [#&#8203;1283](fkhadra/react-toastify#1283). Closes [#&#8203;1259](fkhadra/react-toastify#1259).
#### Internal
- Migrated to a pnpm workspace (`pnpm link .` no longer required for contributors).
Publish layout unchanged — addon still ships inside the main package.
- CSS now injected at mount via `useStyleSheet` (prerequisite for `nonce`).
- Dep bumps: TypeScript 6, Vite 8, Cypress 15, React 19.2, plus the rest.
- CI: `upload-artifact` v3 → v4.
Thanks to [@&#8203;janpaepke](https://github.com/janpaepke), [@&#8203;singhankit001](https://github.com/singhankit001), and reporters of the fixed issues.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (typescript-eslint)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/typescript-eslint/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for typescript-eslint to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>sapphi-red/vite-plugin-static-copy (vite-plugin-static-copy)</summary>
### [`v4.1.0`](https://github.com/sapphi-red/vite-plugin-static-copy/blob/HEAD/CHANGELOG.md#410)
[Compare Source](https://github.com/sapphi-red/vite-plugin-static-copy/compare/vite-plugin-static-copy@4.0.1...vite-plugin-static-copy@4.1.0)
##### Minor Changes
- [#&#8203;251](sapphi-red/vite-plugin-static-copy#251) [`7672842`](sapphi-red/vite-plugin-static-copy@7672842) Thanks [@&#8203;sapphi-red](https://github.com/sapphi-red)! - Add `name` property to the `rename` object form and allow rename functions to return a `RenameObject`. The `name` property replaces the file's basename (filename + extension), and can be combined with `stripBase` to both flatten directory structure and rename the file in one step. Rename functions can now return `{ name, stripBase }` objects instead of only strings, making it easier to declaratively control output paths from dynamic rename logic.
```js
// node_modules/lib/dist/index.js → vendor/lib.js
{ src: 'node_modules/lib/dist/index.js', dest: 'vendor', rename: { name: 'lib.js', stripBase: true } }
// src/pages/events/test.html → dist/events/index.html
{ src: 'src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2, name: 'index.html' } }
```
</details>
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box
---
This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjkuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE0MS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->
See merge request swiss-armed-forces/cyber-command/cea/loom!480
Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedReact Core TeamOpened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@josephsavona@react-sizebot@poteto
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [eslint-plugin-react-hooks] Skip compilation for non-React files by josephsavona · Pull Request #35589 · react/react · GitHub
Skip to content

[eslint-plugin-react-hooks] Skip compilation for non-React files - #35589

Merged
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks
Jan 21, 2026
Merged

[eslint-plugin-react-hooks] Skip compilation for non-React files#35589
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks

Conversation

@josephsavona

Copy link
Copy Markdown
Contributor

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.

The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:

  • Capitalized functions: MyComponent, Button, App
  • Hook pattern functions: useEffect, useState, useMyCustomHook

Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.

Also adds test coverage for the heuristic edge cases.

@github-actionsgithub-actionsBot added the React Core Team Opened by a member of the React Core Team label Jan 21, 2026
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 4294b40 to 69acef3CompareJanuary 21, 2026 19:49
@react-sizebot

react-sizebot commented Jan 21, 2026

Copy link
Copy Markdown

Comparing: cdbd55f...16049c8

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-stable/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB=1.88 kB1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js+0.01%608.67 kB608.73 kB+0.02%107.63 kB107.65 kB
oss-experimental/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB+0.05%1.88 kB1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js=674.60 kB674.66 kB+0.02%118.57 kB118.59 kB
facebook-www/ReactDOM-prod.classic.js=694.04 kB694.11 kB+0.01%122.01 kB122.02 kB
facebook-www/ReactDOM-prod.modern.js=684.43 kB684.50 kB+0.02%120.40 kB120.42 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB

Generated by 🚫 dangerJS against 16049c8

@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 69acef3 to bcdfcecCompareJanuary 21, 2026 20:01
@josephsavona

Copy link
Copy Markdown
ContributorAuthor

Mitigates #35395 — internally at Meta we don't see a major issue with time from the React Compiler rules. That's almost certainly because we selectively apply rules based on files, and only apply the RC rules to likely React files.

This PR applies a similar heuristic to eprh itself. Before, we would eagerly reparse the source of every single file, only to have RC to bail out of analyzing it if there weren't any React functions. Now we do a quick scan of the ESTree (no conversion) to decide if there are candidate React functions.

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:
- Capitalized names: MyComponent, Button, App
- Hook-like names: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from bcdfcec to 16049c8CompareJanuary 21, 2026 20:17

@potetopoteto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice!

@josephsavona
josephsavona merged commit 03ee29d into react:mainJan 21, 2026
234 checks passed
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
736-c41-2c1-e464fc974 pushed a commit to Swiss-Armed-Forces/Loom that referenced this pull request Apr 27, 2026
This MR contains the following updates:
| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [ajv](https://ajv.js.org) ([source](https://github.com/ajv-validator/ajv)) | dependencies | minor | [`8.18.0` → `8.20.0`](https://renovatebot.com/diffs/npm/ajv/8.18.0/8.20.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ajv-validator/ajv/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ajv-validator/ajv) |
| [eslint-plugin-react-hooks](https://react.dev/) ([source](https://github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks)) | devDependencies | minor | [`7.0.1` → `7.1.1`](https://renovatebot.com/diffs/npm/eslint-plugin-react-hooks/7.0.1/7.1.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/facebook/react/badge)](https://securityscorecards.dev/viewer/?uri=github.com/facebook/react) |
| [react-toastify](https://github.com/fkhadra/react-toastify) | dependencies | minor | [`11.0.5` → `11.1.0`](https://renovatebot.com/diffs/npm/react-toastify/11.0.5/11.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/fkhadra/react-toastify/badge)](https://securityscorecards.dev/viewer/?uri=github.com/fkhadra/react-toastify) |
| [typescript-eslint](https://typescript-eslint.io/packages/typescript-eslint) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/typescript-eslint/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [vite-plugin-static-copy](https://github.com/sapphi-red/vite-plugin-static-copy) | devDependencies | minor | [`4.0.1` → `4.1.0`](https://renovatebot.com/diffs/npm/vite-plugin-static-copy/4.0.1/4.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sapphi-red/vite-plugin-static-copy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/sapphi-red/vite-plugin-static-copy) |
---
### Release Notes
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
##### 🚀 Features
- **eslint-plugin:** \[no-unnecessary-type-assertion] report more cases based on assignability ([#&#8203;11789](typescript-eslint/typescript-eslint#11789))
##### ❤️ Thank You
- Ulrich Stark
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for parser to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>ajv-validator/ajv (ajv)</summary>
### [`v8.20.0`](https://github.com/ajv-validator/ajv/releases/tag/v8.20.0)
[Compare Source](ajv-validator/ajv@v8.18.0...v8.20.0)
#### What's Changed
- fix: add support for node 22/24, drop node 16/21 by [@&#8203;jasoniangreen](https://github.com/jasoniangreen) in [#&#8203;2580](ajv-validator/ajv#2580)
- fix: add ES2022.RegExp for RegExpIndicesArray by [@&#8203;SignpostMarv](https://github.com/SignpostMarv) in [#&#8203;2604](ajv-validator/ajv#2604)
**Full Changelog**: <ajv-validator/ajv@v8.19.0...v8.20.0>
</details>
<details>
<summary>facebook/react (eslint-plugin-react-hooks)</summary>
### [`v7.1.1`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#711)
[Compare Source](https://github.com/facebook/react/compare/eslint-plugin-react-hooks@7.1.0...eslint-plugin-react-hooks@7.1.1)
**Note:** 7.1.0 accidentally removed the `component-hook-factories` rule, causing errors for users who referenced it in their ESLint config. This is now fixed.
- Add deprecated no-op `component-hook-factories` rule for backwards compatibility. ([@&#8203;mofeiZ](https://github.com/mofeiZ) in [#&#8203;36307](react/react#36307))
### [`v7.1.0`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#710)
[Compare Source](https://github.com/facebook/react/compare/408b38ef7304faf022d2a37110c57efce12c6bad...eslint-plugin-react-hooks@7.1.0)
This release adds ESLint v10 support, improves performance by skipping compilation for non-React files, and includes compiler lint improvements including better `set-state-in-effect` detection, improved ref validation, and more helpful error reporting.
- Add ESLint v10 support. ([@&#8203;azat-io](https://github.com/azat-io) in [#&#8203;35720](react/react#35720))
- Skip compilation for non-React files to improve performance. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35589](react/react#35589))
- Fix exhaustive deps bug with Flow type casting. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35691](react/react#35691))
- Fix `useEffectEvent` checks in component syntax. ([@&#8203;jbrown215](https://github.com/jbrown215) in [#&#8203;35041](react/react#35041))
- Improved `set-state-in-effect` validation with fewer false negatives. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35134](react/react#35134), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35147](react/react#35147), [@&#8203;jackpope](https://github.com/jackpope) in [#&#8203;35214](react/react#35214), [@&#8203;chesnokov-tony](https://github.com/chesnokov-tony) in [#&#8203;35419](react/react#35419), [@&#8203;jsleitor](https://github.com/jsleitor) in [#&#8203;36107](react/react#36107))
- Improved ref validation for non-mutating functions and event handler props. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35893](react/react#35893), [@&#8203;kolvian](https://github.com/kolvian) in [#&#8203;35062](react/react#35062))
- Compiler now reports all errors instead of stopping at the first. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35873](https://github.com/facebook/react/pull/35873)–[#&#8203;35884](https://github.com/facebook/react/pull/35884))
- Improved source locations and error display in compiler diagnostics. ([@&#8203;nathanmarks](https://github.com/nathanmarks) in [#&#8203;35348](react/react#35348), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;34963](react/react#34963))
</details>
<details>
<summary>fkhadra/react-toastify (react-toastify)</summary>
### [`v11.1.0`](https://github.com/fkhadra/react-toastify/releases/tag/v11.1.0)
[Compare Source](fkhadra/react-toastify@v11.0.5...v11.1.0)
### Release Notes
#### Features
- **CSP nonce support.** `<ToastContainer nonce={...}>` applies the nonce to the
injected `<style>` tag. Closes [#&#8203;1209](fkhadra/react-toastify#1209).
#### Fixes
- `onChange` fires `status: 'removed'` synchronously on `toast.dismiss()` instead
of after the exit animation — observers (incl. `useNotificationCenter`) now
see correctly ordered events. Also guards against double-`onClose`. Closes [#&#8203;1275](fkhadra/react-toastify#1275).
- Touch drag no longer re-pauses the toast on release — the old check compared a
PointerEvent against `'touchend'`, which never matched. Closes [#&#8203;1217](fkhadra/react-toastify#1217).
- Vertical drag now visually moves the toast (`--y` gets a unit). Thanks
[@&#8203;janpaepke](https://github.com/janpaepke), [#&#8203;1277](fkhadra/react-toastify#1277).
- Stacked scale is clamped at 0.5, preventing zero/negative scale in deep
stacks. Closes [#&#8203;1171](fkhadra/react-toastify#1171), [#&#8203;1174](fkhadra/react-toastify#1174).
- Stacked container respects mobile `100vw` again. Closes [#&#8203;1234](fkhadra/react-toastify#1234).
#### Accessibility
- `role="progressbar"` now includes `aria-valuenow`, `aria-valuemin`, `aria-valuemax`.
Thanks [@&#8203;singhankit001](https://github.com/singhankit001), [#&#8203;1283](fkhadra/react-toastify#1283). Closes [#&#8203;1259](fkhadra/react-toastify#1259).
#### Internal
- Migrated to a pnpm workspace (`pnpm link .` no longer required for contributors).
Publish layout unchanged — addon still ships inside the main package.
- CSS now injected at mount via `useStyleSheet` (prerequisite for `nonce`).
- Dep bumps: TypeScript 6, Vite 8, Cypress 15, React 19.2, plus the rest.
- CI: `upload-artifact` v3 → v4.
Thanks to [@&#8203;janpaepke](https://github.com/janpaepke), [@&#8203;singhankit001](https://github.com/singhankit001), and reporters of the fixed issues.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (typescript-eslint)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/typescript-eslint/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for typescript-eslint to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>sapphi-red/vite-plugin-static-copy (vite-plugin-static-copy)</summary>
### [`v4.1.0`](https://github.com/sapphi-red/vite-plugin-static-copy/blob/HEAD/CHANGELOG.md#410)
[Compare Source](https://github.com/sapphi-red/vite-plugin-static-copy/compare/vite-plugin-static-copy@4.0.1...vite-plugin-static-copy@4.1.0)
##### Minor Changes
- [#&#8203;251](sapphi-red/vite-plugin-static-copy#251) [`7672842`](sapphi-red/vite-plugin-static-copy@7672842) Thanks [@&#8203;sapphi-red](https://github.com/sapphi-red)! - Add `name` property to the `rename` object form and allow rename functions to return a `RenameObject`. The `name` property replaces the file's basename (filename + extension), and can be combined with `stripBase` to both flatten directory structure and rename the file in one step. Rename functions can now return `{ name, stripBase }` objects instead of only strings, making it easier to declaratively control output paths from dynamic rename logic.
```js
// node_modules/lib/dist/index.js → vendor/lib.js
{ src: 'node_modules/lib/dist/index.js', dest: 'vendor', rename: { name: 'lib.js', stripBase: true } }
// src/pages/events/test.html → dist/events/index.html
{ src: 'src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2, name: 'index.html' } }
```
</details>
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box
---
This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjkuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE0MS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->
See merge request swiss-armed-forces/cyber-command/cea/loom!480
Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedReact Core TeamOpened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@josephsavona@react-sizebot@poteto
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [eslint-plugin-react-hooks] Skip compilation for non-React files by josephsavona · Pull Request #35589 · react/react · GitHub
Skip to content

[eslint-plugin-react-hooks] Skip compilation for non-React files - #35589

Merged
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks
Jan 21, 2026
Merged

[eslint-plugin-react-hooks] Skip compilation for non-React files#35589
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks

Conversation

@josephsavona

Copy link
Copy Markdown
Contributor

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.

The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:

  • Capitalized functions: MyComponent, Button, App
  • Hook pattern functions: useEffect, useState, useMyCustomHook

Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.

Also adds test coverage for the heuristic edge cases.

@github-actionsgithub-actionsBot added the React Core Team Opened by a member of the React Core Team label Jan 21, 2026
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 4294b40 to 69acef3CompareJanuary 21, 2026 19:49
@react-sizebot

react-sizebot commented Jan 21, 2026

Copy link
Copy Markdown

Comparing: cdbd55f...16049c8

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-stable/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB=1.88 kB1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js+0.01%608.67 kB608.73 kB+0.02%107.63 kB107.65 kB
oss-experimental/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB+0.05%1.88 kB1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js=674.60 kB674.66 kB+0.02%118.57 kB118.59 kB
facebook-www/ReactDOM-prod.classic.js=694.04 kB694.11 kB+0.01%122.01 kB122.02 kB
facebook-www/ReactDOM-prod.modern.js=684.43 kB684.50 kB+0.02%120.40 kB120.42 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB

Generated by 🚫 dangerJS against 16049c8

@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 69acef3 to bcdfcecCompareJanuary 21, 2026 20:01
@josephsavona

Copy link
Copy Markdown
ContributorAuthor

Mitigates #35395 — internally at Meta we don't see a major issue with time from the React Compiler rules. That's almost certainly because we selectively apply rules based on files, and only apply the RC rules to likely React files.

This PR applies a similar heuristic to eprh itself. Before, we would eagerly reparse the source of every single file, only to have RC to bail out of analyzing it if there weren't any React functions. Now we do a quick scan of the ESTree (no conversion) to decide if there are candidate React functions.

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:
- Capitalized names: MyComponent, Button, App
- Hook-like names: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from bcdfcec to 16049c8CompareJanuary 21, 2026 20:17

@potetopoteto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice!

@josephsavona
josephsavona merged commit 03ee29d into react:mainJan 21, 2026
234 checks passed
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
736-c41-2c1-e464fc974 pushed a commit to Swiss-Armed-Forces/Loom that referenced this pull request Apr 27, 2026
This MR contains the following updates:
| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [ajv](https://ajv.js.org) ([source](https://github.com/ajv-validator/ajv)) | dependencies | minor | [`8.18.0` → `8.20.0`](https://renovatebot.com/diffs/npm/ajv/8.18.0/8.20.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ajv-validator/ajv/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ajv-validator/ajv) |
| [eslint-plugin-react-hooks](https://react.dev/) ([source](https://github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks)) | devDependencies | minor | [`7.0.1` → `7.1.1`](https://renovatebot.com/diffs/npm/eslint-plugin-react-hooks/7.0.1/7.1.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/facebook/react/badge)](https://securityscorecards.dev/viewer/?uri=github.com/facebook/react) |
| [react-toastify](https://github.com/fkhadra/react-toastify) | dependencies | minor | [`11.0.5` → `11.1.0`](https://renovatebot.com/diffs/npm/react-toastify/11.0.5/11.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/fkhadra/react-toastify/badge)](https://securityscorecards.dev/viewer/?uri=github.com/fkhadra/react-toastify) |
| [typescript-eslint](https://typescript-eslint.io/packages/typescript-eslint) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/typescript-eslint/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [vite-plugin-static-copy](https://github.com/sapphi-red/vite-plugin-static-copy) | devDependencies | minor | [`4.0.1` → `4.1.0`](https://renovatebot.com/diffs/npm/vite-plugin-static-copy/4.0.1/4.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sapphi-red/vite-plugin-static-copy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/sapphi-red/vite-plugin-static-copy) |
---
### Release Notes
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
##### 🚀 Features
- **eslint-plugin:** \[no-unnecessary-type-assertion] report more cases based on assignability ([#&#8203;11789](typescript-eslint/typescript-eslint#11789))
##### ❤️ Thank You
- Ulrich Stark
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for parser to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>ajv-validator/ajv (ajv)</summary>
### [`v8.20.0`](https://github.com/ajv-validator/ajv/releases/tag/v8.20.0)
[Compare Source](ajv-validator/ajv@v8.18.0...v8.20.0)
#### What's Changed
- fix: add support for node 22/24, drop node 16/21 by [@&#8203;jasoniangreen](https://github.com/jasoniangreen) in [#&#8203;2580](ajv-validator/ajv#2580)
- fix: add ES2022.RegExp for RegExpIndicesArray by [@&#8203;SignpostMarv](https://github.com/SignpostMarv) in [#&#8203;2604](ajv-validator/ajv#2604)
**Full Changelog**: <ajv-validator/ajv@v8.19.0...v8.20.0>
</details>
<details>
<summary>facebook/react (eslint-plugin-react-hooks)</summary>
### [`v7.1.1`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#711)
[Compare Source](https://github.com/facebook/react/compare/eslint-plugin-react-hooks@7.1.0...eslint-plugin-react-hooks@7.1.1)
**Note:** 7.1.0 accidentally removed the `component-hook-factories` rule, causing errors for users who referenced it in their ESLint config. This is now fixed.
- Add deprecated no-op `component-hook-factories` rule for backwards compatibility. ([@&#8203;mofeiZ](https://github.com/mofeiZ) in [#&#8203;36307](react/react#36307))
### [`v7.1.0`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#710)
[Compare Source](https://github.com/facebook/react/compare/408b38ef7304faf022d2a37110c57efce12c6bad...eslint-plugin-react-hooks@7.1.0)
This release adds ESLint v10 support, improves performance by skipping compilation for non-React files, and includes compiler lint improvements including better `set-state-in-effect` detection, improved ref validation, and more helpful error reporting.
- Add ESLint v10 support. ([@&#8203;azat-io](https://github.com/azat-io) in [#&#8203;35720](react/react#35720))
- Skip compilation for non-React files to improve performance. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35589](react/react#35589))
- Fix exhaustive deps bug with Flow type casting. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35691](react/react#35691))
- Fix `useEffectEvent` checks in component syntax. ([@&#8203;jbrown215](https://github.com/jbrown215) in [#&#8203;35041](react/react#35041))
- Improved `set-state-in-effect` validation with fewer false negatives. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35134](react/react#35134), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35147](react/react#35147), [@&#8203;jackpope](https://github.com/jackpope) in [#&#8203;35214](react/react#35214), [@&#8203;chesnokov-tony](https://github.com/chesnokov-tony) in [#&#8203;35419](react/react#35419), [@&#8203;jsleitor](https://github.com/jsleitor) in [#&#8203;36107](react/react#36107))
- Improved ref validation for non-mutating functions and event handler props. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35893](react/react#35893), [@&#8203;kolvian](https://github.com/kolvian) in [#&#8203;35062](react/react#35062))
- Compiler now reports all errors instead of stopping at the first. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35873](https://github.com/facebook/react/pull/35873)–[#&#8203;35884](https://github.com/facebook/react/pull/35884))
- Improved source locations and error display in compiler diagnostics. ([@&#8203;nathanmarks](https://github.com/nathanmarks) in [#&#8203;35348](react/react#35348), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;34963](react/react#34963))
</details>
<details>
<summary>fkhadra/react-toastify (react-toastify)</summary>
### [`v11.1.0`](https://github.com/fkhadra/react-toastify/releases/tag/v11.1.0)
[Compare Source](fkhadra/react-toastify@v11.0.5...v11.1.0)
### Release Notes
#### Features
- **CSP nonce support.** `<ToastContainer nonce={...}>` applies the nonce to the
injected `<style>` tag. Closes [#&#8203;1209](fkhadra/react-toastify#1209).
#### Fixes
- `onChange` fires `status: 'removed'` synchronously on `toast.dismiss()` instead
of after the exit animation — observers (incl. `useNotificationCenter`) now
see correctly ordered events. Also guards against double-`onClose`. Closes [#&#8203;1275](fkhadra/react-toastify#1275).
- Touch drag no longer re-pauses the toast on release — the old check compared a
PointerEvent against `'touchend'`, which never matched. Closes [#&#8203;1217](fkhadra/react-toastify#1217).
- Vertical drag now visually moves the toast (`--y` gets a unit). Thanks
[@&#8203;janpaepke](https://github.com/janpaepke), [#&#8203;1277](fkhadra/react-toastify#1277).
- Stacked scale is clamped at 0.5, preventing zero/negative scale in deep
stacks. Closes [#&#8203;1171](fkhadra/react-toastify#1171), [#&#8203;1174](fkhadra/react-toastify#1174).
- Stacked container respects mobile `100vw` again. Closes [#&#8203;1234](fkhadra/react-toastify#1234).
#### Accessibility
- `role="progressbar"` now includes `aria-valuenow`, `aria-valuemin`, `aria-valuemax`.
Thanks [@&#8203;singhankit001](https://github.com/singhankit001), [#&#8203;1283](fkhadra/react-toastify#1283). Closes [#&#8203;1259](fkhadra/react-toastify#1259).
#### Internal
- Migrated to a pnpm workspace (`pnpm link .` no longer required for contributors).
Publish layout unchanged — addon still ships inside the main package.
- CSS now injected at mount via `useStyleSheet` (prerequisite for `nonce`).
- Dep bumps: TypeScript 6, Vite 8, Cypress 15, React 19.2, plus the rest.
- CI: `upload-artifact` v3 → v4.
Thanks to [@&#8203;janpaepke](https://github.com/janpaepke), [@&#8203;singhankit001](https://github.com/singhankit001), and reporters of the fixed issues.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (typescript-eslint)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/typescript-eslint/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for typescript-eslint to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>sapphi-red/vite-plugin-static-copy (vite-plugin-static-copy)</summary>
### [`v4.1.0`](https://github.com/sapphi-red/vite-plugin-static-copy/blob/HEAD/CHANGELOG.md#410)
[Compare Source](https://github.com/sapphi-red/vite-plugin-static-copy/compare/vite-plugin-static-copy@4.0.1...vite-plugin-static-copy@4.1.0)
##### Minor Changes
- [#&#8203;251](sapphi-red/vite-plugin-static-copy#251) [`7672842`](sapphi-red/vite-plugin-static-copy@7672842) Thanks [@&#8203;sapphi-red](https://github.com/sapphi-red)! - Add `name` property to the `rename` object form and allow rename functions to return a `RenameObject`. The `name` property replaces the file's basename (filename + extension), and can be combined with `stripBase` to both flatten directory structure and rename the file in one step. Rename functions can now return `{ name, stripBase }` objects instead of only strings, making it easier to declaratively control output paths from dynamic rename logic.
```js
// node_modules/lib/dist/index.js → vendor/lib.js
{ src: 'node_modules/lib/dist/index.js', dest: 'vendor', rename: { name: 'lib.js', stripBase: true } }
// src/pages/events/test.html → dist/events/index.html
{ src: 'src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2, name: 'index.html' } }
```
</details>
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box
---
This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjkuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE0MS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->
See merge request swiss-armed-forces/cyber-command/cea/loom!480
Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedReact Core TeamOpened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@josephsavona@react-sizebot@poteto
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); [eslint-plugin-react-hooks] Skip compilation for non-React files by josephsavona · Pull Request #35589 · react/react · GitHub
Skip to content

[eslint-plugin-react-hooks] Skip compilation for non-React files - #35589

Merged
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks
Jan 21, 2026
Merged

[eslint-plugin-react-hooks] Skip compilation for non-React files#35589
josephsavona merged 1 commit into
react:mainfrom
josephsavona:worktree-react-optionals-value-blocks

Conversation

@josephsavona

Copy link
Copy Markdown
Contributor

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.

The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:

  • Capitalized functions: MyComponent, Button, App
  • Hook pattern functions: useEffect, useState, useMyCustomHook

Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.

Also adds test coverage for the heuristic edge cases.

@github-actionsgithub-actionsBot added the React Core Team Opened by a member of the React Core Team label Jan 21, 2026
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 4294b40 to 69acef3CompareJanuary 21, 2026 19:49
@react-sizebot

react-sizebot commented Jan 21, 2026

Copy link
Copy Markdown

Comparing: cdbd55f...16049c8

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-stable/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB=1.88 kB1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js+0.01%608.67 kB608.73 kB+0.02%107.63 kB107.65 kB
oss-experimental/react-dom/cjs/react-dom.production.js=6.84 kB6.84 kB+0.05%1.88 kB1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js=674.60 kB674.66 kB+0.02%118.57 kB118.59 kB
facebook-www/ReactDOM-prod.classic.js=694.04 kB694.11 kB+0.01%122.01 kB122.02 kB
facebook-www/ReactDOM-prod.modern.js=684.43 kB684.50 kB+0.02%120.40 kB120.42 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name+/-BaseCurrent+/- gzipBase gzipCurrent gzip
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js+0.71%12.75 kB12.84 kB+0.78%2.71 kB2.73 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.production.js+0.59%11.29 kB11.36 kB+0.65%2.63 kB2.65 kB

Generated by 🚫 dangerJS against 16049c8

@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from 69acef3 to bcdfcecCompareJanuary 21, 2026 20:01
@josephsavona

Copy link
Copy Markdown
ContributorAuthor

Mitigates #35395 — internally at Meta we don't see a major issue with time from the React Compiler rules. That's almost certainly because we selectively apply rules based on files, and only apply the RC rules to likely React files.

This PR applies a similar heuristic to eprh itself. Before, we would eagerly reparse the source of every single file, only to have RC to bail out of analyzing it if there weren't any React functions. Now we do a quick scan of the ESTree (no conversion) to decide if there are candidate React functions.

Add a fast heuristic to detect whether a file may contain React components or hooks before running the full compiler. This avoids the overhead of Babel AST parsing and compilation for utility files, config files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions with React-like names at module scope:
- Capitalized names: MyComponent, Button, App
- Hook-like names: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
@josephsavona
josephsavonaforce-pushed the worktree-react-optionals-value-blocks branch from bcdfcec to 16049c8CompareJanuary 21, 2026 20:17

@potetopoteto left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice!

@josephsavona
josephsavona merged commit 03ee29d into react:mainJan 21, 2026
234 checks passed
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit that referenced this pull request Jan 21, 2026
)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jan 25, 2026
…ct#35589)
Add a fast heuristic to detect whether a file may contain React
components or hooks before running the full compiler. This avoids the
overhead of Babel AST parsing and compilation for utility files, config
files, and other non-React code.
The heuristic uses ESLint's already-parsed AST to check for functions
with React-like names at module scope:
- Capitalized functions: MyComponent, Button, App
- Hook pattern functions: useEffect, useState, useMyCustomHook
Files without matching function names are skipped and return an empty
result, which is cached to avoid re-checking for subsequent rules.
Also adds test coverage for the heuristic edge cases.
DiffTrain build for [03ee29d](react@03ee29d)
736-c41-2c1-e464fc974 pushed a commit to Swiss-Armed-Forces/Loom that referenced this pull request Apr 27, 2026
This MR contains the following updates:
| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [ajv](https://ajv.js.org) ([source](https://github.com/ajv-validator/ajv)) | dependencies | minor | [`8.18.0` → `8.20.0`](https://renovatebot.com/diffs/npm/ajv/8.18.0/8.20.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ajv-validator/ajv/badge)](https://securityscorecards.dev/viewer/?uri=github.com/ajv-validator/ajv) |
| [eslint-plugin-react-hooks](https://react.dev/) ([source](https://github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks)) | devDependencies | minor | [`7.0.1` → `7.1.1`](https://renovatebot.com/diffs/npm/eslint-plugin-react-hooks/7.0.1/7.1.1) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/facebook/react/badge)](https://securityscorecards.dev/viewer/?uri=github.com/facebook/react) |
| [react-toastify](https://github.com/fkhadra/react-toastify) | dependencies | minor | [`11.0.5` → `11.1.0`](https://renovatebot.com/diffs/npm/react-toastify/11.0.5/11.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/fkhadra/react-toastify/badge)](https://securityscorecards.dev/viewer/?uri=github.com/fkhadra/react-toastify) |
| [typescript-eslint](https://typescript-eslint.io/packages/typescript-eslint) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint)) | devDependencies | minor | [`8.58.2` → `8.59.0`](https://renovatebot.com/diffs/npm/typescript-eslint/8.58.2/8.59.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/typescript-eslint/typescript-eslint/badge)](https://securityscorecards.dev/viewer/?uri=github.com/typescript-eslint/typescript-eslint) |
| [vite-plugin-static-copy](https://github.com/sapphi-red/vite-plugin-static-copy) | devDependencies | minor | [`4.0.1` → `4.1.0`](https://renovatebot.com/diffs/npm/vite-plugin-static-copy/4.0.1/4.1.0) | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sapphi-red/vite-plugin-static-copy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/sapphi-red/vite-plugin-static-copy) |
---
### Release Notes
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
##### 🚀 Features
- **eslint-plugin:** \[no-unnecessary-type-assertion] report more cases based on assignability ([#&#8203;11789](typescript-eslint/typescript-eslint#11789))
##### ❤️ Thank You
- Ulrich Stark
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for parser to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>ajv-validator/ajv (ajv)</summary>
### [`v8.20.0`](https://github.com/ajv-validator/ajv/releases/tag/v8.20.0)
[Compare Source](ajv-validator/ajv@v8.18.0...v8.20.0)
#### What's Changed
- fix: add support for node 22/24, drop node 16/21 by [@&#8203;jasoniangreen](https://github.com/jasoniangreen) in [#&#8203;2580](ajv-validator/ajv#2580)
- fix: add ES2022.RegExp for RegExpIndicesArray by [@&#8203;SignpostMarv](https://github.com/SignpostMarv) in [#&#8203;2604](ajv-validator/ajv#2604)
**Full Changelog**: <ajv-validator/ajv@v8.19.0...v8.20.0>
</details>
<details>
<summary>facebook/react (eslint-plugin-react-hooks)</summary>
### [`v7.1.1`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#711)
[Compare Source](https://github.com/facebook/react/compare/eslint-plugin-react-hooks@7.1.0...eslint-plugin-react-hooks@7.1.1)
**Note:** 7.1.0 accidentally removed the `component-hook-factories` rule, causing errors for users who referenced it in their ESLint config. This is now fixed.
- Add deprecated no-op `component-hook-factories` rule for backwards compatibility. ([@&#8203;mofeiZ](https://github.com/mofeiZ) in [#&#8203;36307](react/react#36307))
### [`v7.1.0`](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#710)
[Compare Source](https://github.com/facebook/react/compare/408b38ef7304faf022d2a37110c57efce12c6bad...eslint-plugin-react-hooks@7.1.0)
This release adds ESLint v10 support, improves performance by skipping compilation for non-React files, and includes compiler lint improvements including better `set-state-in-effect` detection, improved ref validation, and more helpful error reporting.
- Add ESLint v10 support. ([@&#8203;azat-io](https://github.com/azat-io) in [#&#8203;35720](react/react#35720))
- Skip compilation for non-React files to improve performance. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35589](react/react#35589))
- Fix exhaustive deps bug with Flow type casting. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35691](react/react#35691))
- Fix `useEffectEvent` checks in component syntax. ([@&#8203;jbrown215](https://github.com/jbrown215) in [#&#8203;35041](react/react#35041))
- Improved `set-state-in-effect` validation with fewer false negatives. ([@&#8203;jorge-cab](https://github.com/jorge-cab) in [#&#8203;35134](react/react#35134), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35147](react/react#35147), [@&#8203;jackpope](https://github.com/jackpope) in [#&#8203;35214](react/react#35214), [@&#8203;chesnokov-tony](https://github.com/chesnokov-tony) in [#&#8203;35419](react/react#35419), [@&#8203;jsleitor](https://github.com/jsleitor) in [#&#8203;36107](react/react#36107))
- Improved ref validation for non-mutating functions and event handler props. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35893](react/react#35893), [@&#8203;kolvian](https://github.com/kolvian) in [#&#8203;35062](react/react#35062))
- Compiler now reports all errors instead of stopping at the first. ([@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;35873](https://github.com/facebook/react/pull/35873)–[#&#8203;35884](https://github.com/facebook/react/pull/35884))
- Improved source locations and error display in compiler diagnostics. ([@&#8203;nathanmarks](https://github.com/nathanmarks) in [#&#8203;35348](react/react#35348), [@&#8203;josephsavona](https://github.com/josephsavona) in [#&#8203;34963](react/react#34963))
</details>
<details>
<summary>fkhadra/react-toastify (react-toastify)</summary>
### [`v11.1.0`](https://github.com/fkhadra/react-toastify/releases/tag/v11.1.0)
[Compare Source](fkhadra/react-toastify@v11.0.5...v11.1.0)
### Release Notes
#### Features
- **CSP nonce support.** `<ToastContainer nonce={...}>` applies the nonce to the
injected `<style>` tag. Closes [#&#8203;1209](fkhadra/react-toastify#1209).
#### Fixes
- `onChange` fires `status: 'removed'` synchronously on `toast.dismiss()` instead
of after the exit animation — observers (incl. `useNotificationCenter`) now
see correctly ordered events. Also guards against double-`onClose`. Closes [#&#8203;1275](fkhadra/react-toastify#1275).
- Touch drag no longer re-pauses the toast on release — the old check compared a
PointerEvent against `'touchend'`, which never matched. Closes [#&#8203;1217](fkhadra/react-toastify#1217).
- Vertical drag now visually moves the toast (`--y` gets a unit). Thanks
[@&#8203;janpaepke](https://github.com/janpaepke), [#&#8203;1277](fkhadra/react-toastify#1277).
- Stacked scale is clamped at 0.5, preventing zero/negative scale in deep
stacks. Closes [#&#8203;1171](fkhadra/react-toastify#1171), [#&#8203;1174](fkhadra/react-toastify#1174).
- Stacked container respects mobile `100vw` again. Closes [#&#8203;1234](fkhadra/react-toastify#1234).
#### Accessibility
- `role="progressbar"` now includes `aria-valuenow`, `aria-valuemin`, `aria-valuemax`.
Thanks [@&#8203;singhankit001](https://github.com/singhankit001), [#&#8203;1283](fkhadra/react-toastify#1283). Closes [#&#8203;1259](fkhadra/react-toastify#1259).
#### Internal
- Migrated to a pnpm workspace (`pnpm link .` no longer required for contributors).
Publish layout unchanged — addon still ships inside the main package.
- CSS now injected at mount via `useStyleSheet` (prerequisite for `nonce`).
- Dep bumps: TypeScript 6, Vite 8, Cypress 15, React 19.2, plus the rest.
- CI: `upload-artifact` v3 → v4.
Thanks to [@&#8203;janpaepke](https://github.com/janpaepke), [@&#8203;singhankit001](https://github.com/singhankit001), and reporters of the fixed issues.
</details>
<details>
<summary>typescript-eslint/typescript-eslint (typescript-eslint)</summary>
### [`v8.59.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/typescript-eslint/CHANGELOG.md#8590-2026-04-20)
[Compare Source](typescript-eslint/typescript-eslint@v8.58.2...v8.59.0)
This was a version bump only for typescript-eslint to align it with other projects, there were no code changes.
See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.59.0) for more information.
You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
</details>
<details>
<summary>sapphi-red/vite-plugin-static-copy (vite-plugin-static-copy)</summary>
### [`v4.1.0`](https://github.com/sapphi-red/vite-plugin-static-copy/blob/HEAD/CHANGELOG.md#410)
[Compare Source](https://github.com/sapphi-red/vite-plugin-static-copy/compare/vite-plugin-static-copy@4.0.1...vite-plugin-static-copy@4.1.0)
##### Minor Changes
- [#&#8203;251](sapphi-red/vite-plugin-static-copy#251) [`7672842`](sapphi-red/vite-plugin-static-copy@7672842) Thanks [@&#8203;sapphi-red](https://github.com/sapphi-red)! - Add `name` property to the `rename` object form and allow rename functions to return a `RenameObject`. The `name` property replaces the file's basename (filename + extension), and can be combined with `stripBase` to both flatten directory structure and rename the file in one step. Rename functions can now return `{ name, stripBase }` objects instead of only strings, making it easier to declaratively control output paths from dynamic rename logic.
```js
// node_modules/lib/dist/index.js → vendor/lib.js
{ src: 'node_modules/lib/dist/index.js', dest: 'vendor', rename: { name: 'lib.js', stripBase: true } }
// src/pages/events/test.html → dist/events/index.html
{ src: 'src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2, name: 'index.html' } }
```
</details>
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box
---
This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjkuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE0MS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->
See merge request swiss-armed-forces/cyber-command/cea/loom!480
Co-authored-by: Loom MR Pipeline Trigger <group_103951964_bot_9504bb8dead6d4e406ad817a607f24be@noreply.gitlab.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedReact Core TeamOpened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@josephsavona@react-sizebot@poteto