-
Notifications
You must be signed in to change notification settings - Fork 7.8k
fix compiler errors #7989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fix compiler errors #7989
+2,651
−106
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Sep 17, 2025
505af62
to
ef88295
Compare
Size changes📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
This was referenced Sep 18, 2025
Merged
josephsavona
approved these changes
Sep 18, 2025
…iler In facebook/react#34462 for example, we found an issue where the compiler was incorrectly validating an example straight from the docs. In order to find more issues like this + also provide more feedback to doc authors on valid/invalid patterns, this PR adds a new local eslint rule which validates all markdown codeblocks containing components/hooks with React Compiler. An autofixer is also provided. To express that a codeblock has an expected error, we can use the following metadata: ```ts // pseudo type def type MarkdownCodeBlockMetadata = { expectedErrors?: { 'react-compiler'?: number[]; }; }; ``` and can be used like so: ```` ```js {expectedErrors: {'react-compiler': [4]}} // ❌ setState directly in render function Component({value}) { const [count, setCount] = useState(0); setCount(value); // error on L4 return <div>{count}</div>; } ``` ```` Because this is defined as a local rule, we don't have the same granular reporting that `eslint-plugin-react-hooks` yet. I can look into that later but for now this first PR just sets us up with something basic.
I went through the list of existing errors and tried to separate the expected errors from those that seem to be flagging unexpected issues. In particular, our effects validations are flagging patterns that our own docs examples use. I added todos for these and will follow up later.
Hey folks, I think something in this PR stack is causing issue 7994. |
poteto
added a commit
that referenced
this pull request
Sep 18, 2025
poteto
added a commit
that referenced
this pull request
Sep 18, 2025
Reverts the revert now that we've fixed the bug. These pages should no longer crash: /learn/referencing-values-with-refs /learn/synchronizing-with-effects /learn/separating-events-from-effects /learn/removing-effect-dependencies
poteto
added a commit
that referenced
this pull request
Sep 18, 2025
Reverts the revert now that we've fixed the bug. These pages should no longer crash: /learn/referencing-values-with-refs /learn/synchronizing-with-effects /learn/separating-events-from-effects /learn/removing-effect-dependencies
poteto
added a commit
that referenced
this pull request
Sep 18, 2025
Reverts the revert now that we've fixed the bug. These pages should no longer crash: /learn/referencing-values-with-refs /learn/synchronizing-with-effects /learn/separating-events-from-effects /learn/removing-effect-dependencies
poteto
added a commit
that referenced
this pull request
Sep 18, 2025
Reverts the revert now that we've fixed the bug. These pages should no longer crash: https://react-dev-git-pr7997-fbopensource.vercel.app/learn/referencing-values-with-refs https://react-dev-git-pr7997-fbopensource.vercel.app/learn/synchronizing-with-effects https://react-dev-git-pr7997-fbopensource.vercel.app/learn/separating-events-from-effects https://react-dev-git-pr7997-fbopensource.vercel.app/learn/removing-effect-dependencies https://react-dev-git-pr7997-fbopensource.vercel.app/learn/you-might-not-need-an-effect
poteto
added a commit
that referenced
this pull request
Sep 18, 2025
Reverts the revert now that we've fixed the bug. These pages should no longer crash: https://react-dev-git-pr7997-fbopensource.vercel.app/learn/referencing-values-with-refs https://react-dev-git-pr7997-fbopensource.vercel.app/learn/synchronizing-with-effects https://react-dev-git-pr7997-fbopensource.vercel.app/learn/separating-events-from-effects https://react-dev-git-pr7997-fbopensource.vercel.app/learn/removing-effect-dependencies https://react-dev-git-pr7997-fbopensource.vercel.app/learn/you-might-not-need-an-effect
poteto
added a commit
that referenced
this pull request
Sep 18, 2025
* Ignore braces when building Sandpack file map Previously, `createFileMap` split the MDX meta string on spaces and assumed the first token was the filename. Once we prefixed code fences with `{expectedErrors: ...}`, it would incorrectly parse the meta and crash. This PR updates createFileMap to skip tokens in the meta containing a start and end brace pair (using a stack to ensure we close on the correct brace) while tokenizing the meta string as expected. Test plan: pages reported in #7994 no longer crash on the next PR Closes #7994 * Restore lint corrections from #7989 Reverts the revert now that we've fixed the bug. These pages should no longer crash: https://react-dev-git-pr7997-fbopensource.vercel.app/learn/referencing-values-with-refs https://react-dev-git-pr7997-fbopensource.vercel.app/learn/synchronizing-with-effects https://react-dev-git-pr7997-fbopensource.vercel.app/learn/separating-events-from-effects https://react-dev-git-pr7997-fbopensource.vercel.app/learn/removing-effect-dependencies https://react-dev-git-pr7997-fbopensource.vercel.app/learn/you-might-not-need-an-effect
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I went through the list of existing errors and tried to separate the expected errors from those that seem to be flagging unexpected issues. In particular, our effects validations are flagging patterns that our own docs examples use. I added todos for these and will follow up later.
Stack created with Sapling. Best reviewed with ReviewStack.