feat(eslint-plugin-react-hooks): merge rule from eslint-plugin-react-compiler into react-hooks plugin (#32416)

This change merges the `react-compiler` rule from
`eslint-plugin-react-compiler` into the `eslint-plugin-react-hooks`
plugin. In order to do the move in a way that keeps commit history with
the moved files, but also no remove them from their origin until a
future cleanup change can be done, I did the `git mv` first, and then
recreated the files that were moved in their original places, as a
separate commit. Unfortunately GH shows the moved files as new instead
of the ones that are truly new. But in the IDE and `git blame`, commit
history is intact with the moved files.

Since this change adds new dependencies, and one of those dependencies
has a higher `engines` declaration for `node` than what the plugin
currently has, this is technically a breaking change and will have to go
out as part of a major release.

### Related Changes
- https://github.com/facebook/react/pull/32458

---------

Co-authored-by: Lauren Tan <poteto@users.noreply.github.com>
This commit is contained in:
michael faith
2025-03-12 20:43:06 -05:00
committed by GitHub
parent a8ab2bcb62
commit 5ccfcd17ff
26 changed files with 3607 additions and 582 deletions

View File

@@ -1,12 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`error transform handles deeply nested expressions 1`] = `
"var val = (a, (b, // eslint-disable-next-line react-internal/prod-error-codes
"var val = (a, (b,
// eslint-disable-next-line react-internal/prod-error-codes
new Error('foo')));"
`;
exports[`error transform handles deeply nested expressions 2`] = `
"var val = (a, ( // eslint-disable-next-line react-internal/prod-error-codes
"var val = (a, (
// eslint-disable-next-line react-internal/prod-error-codes
b, new Error('foo')));"
`;
@@ -17,10 +19,11 @@ Error(_formatProdErrorMessage(231, listener, type));"
exports[`error transform handles ignoring errors that are comment-excluded inside ternary expressions 1`] = `
"/*! FIXME (minify-errors-in-prod): Unminified error message in production build!*/
/*! <expected-error-format>"bar"</expected-error-format>*/
var val = someBool ? //eslint-disable-next-line react-internal/prod-error-codes
new Error('foo') : someOtherBool ? new Error('bar') : //eslint-disable-next-line react-internal/prod-error-codes
var val = someBool ?
//eslint-disable-next-line react-internal/prod-error-codes
new Error('foo') : someOtherBool ? new Error('bar') :
//eslint-disable-next-line react-internal/prod-error-codes
new Error('baz');"
`;
@@ -36,7 +39,6 @@ NotAnError();"
exports[`error transform should output FIXME for errors that don't have a matching error code 1`] = `
"/*! FIXME (minify-errors-in-prod): Unminified error message in production build!*/
/*! <expected-error-format>"This is not a real error message."</expected-error-format>*/
Error('This is not a real error message.');"
`;