[lint] treat React.use() the same as use()#27769
Merged
kassens merged 2 commits intofacebook:mainfrom Dec 1, 2023
Merged
Conversation
0fca22a to
790aab0
Compare
noahlemen
approved these changes
Nov 30, 2023
Contributor
noahlemen
left a comment
There was a problem hiding this comment.
lgtm overall, but it looks like we also could be reusing this fn:
react/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js
Lines 52 to 59 in 790aab0
should that one be updated to include the lowercase 'react'?
acdlite
reviewed
Dec 1, 2023
|
|
||
| function isUseIdentifier(node) { | ||
| return node.type === 'Identifier' && node.name === 'use'; | ||
| switch (node.type) { |
Collaborator
There was a problem hiding this comment.
Nit: elsewhere in the implementation, isReactFunction is used to detect React.useX. Might as well use it here too to ensure the behavior is consistent.
react/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js
Lines 52 to 60 in 790aab0
acdlite
approved these changes
Dec 1, 2023
ztanner
added a commit
to vercel/next.js
that referenced
this pull request
Dec 15, 2023
Updates React from 2c338b16f to 0cdfef19b. ### React upstream changes - facebook/react#27821 - facebook/react#27820 - facebook/react#27818 - facebook/react#27819 - facebook/react#27817 - facebook/react#27703 - facebook/react#27796 - facebook/react#27811 - facebook/react#27804 - facebook/react#27807 - facebook/react#27805 - facebook/react#27792 - facebook/react#27788 - facebook/react#26852 - facebook/react#27790 - facebook/react#27786 - facebook/react#27785 - facebook/react#27783 - facebook/react#27784 - facebook/react#27769 - facebook/react#27766 - facebook/react#27701 - facebook/react#27732 - facebook/react#27740 - facebook/react#27767 - facebook/react#27768 - facebook/react#27765 - facebook/react#27759 - facebook/react#27579 - facebook/react#27709 - facebook/react#27734 - facebook/react#27739 - facebook/react#27717 - facebook/react#27583 - facebook/react#27713 Closes NEXT-1887
agustints
pushed a commit
to agustints/next.js
that referenced
this pull request
Jan 6, 2024
Updates React from 2c338b16f to 0cdfef19b. ### React upstream changes - facebook/react#27821 - facebook/react#27820 - facebook/react#27818 - facebook/react#27819 - facebook/react#27817 - facebook/react#27703 - facebook/react#27796 - facebook/react#27811 - facebook/react#27804 - facebook/react#27807 - facebook/react#27805 - facebook/react#27792 - facebook/react#27788 - facebook/react#26852 - facebook/react#27790 - facebook/react#27786 - facebook/react#27785 - facebook/react#27783 - facebook/react#27784 - facebook/react#27769 - facebook/react#27766 - facebook/react#27701 - facebook/react#27732 - facebook/react#27740 - facebook/react#27767 - facebook/react#27768 - facebook/react#27765 - facebook/react#27759 - facebook/react#27579 - facebook/react#27709 - facebook/react#27734 - facebook/react#27739 - facebook/react#27717 - facebook/react#27583 - facebook/react#27713 Closes NEXT-1887
EdisonVan
pushed a commit
to EdisonVan/react
that referenced
this pull request
Apr 15, 2024
We should probably treat `React.use()` the same as `use()` to allow it within loops and conditionals. Ideally this would implement a test that `React` is imported or required from `'react'`, but we don't otherwise implement such a test.
bigfootjon
pushed a commit
that referenced
this pull request
Apr 18, 2024
We should probably treat `React.use()` the same as `use()` to allow it within loops and conditionals. Ideally this would implement a test that `React` is imported or required from `'react'`, but we don't otherwise implement such a test. DiffTrain build for commit 640cceb.
renovate bot
added a commit
to mmkal/eslint-plugin-mmkal
that referenced
this pull request
Oct 11, 2024
##### [v5.0.0](https://github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#500) - **New Violations:** Component names now need to start with an uppercase letter instead of a non-lowercase letter. This means `_Button` or `_component` are no longer valid. ([@kassens](https://github.com/kassens)) in [#25162](facebook/react#25162) <!----> - Consider dispatch from `useActionState` stable. ([@eps1lon](https://github.com/eps1lon) in [#29665](facebook/react#29665)) - Add support for ESLint v9. ([@eps1lon](https://github.com/eps1lon) in [#28773](facebook/react#28773)) - Accept `as` expression in callback. ([@StyleShit](https://github.com/StyleShit) in [#28202](facebook/react#28202)) - Accept `as` expressions in deps array. ([@StyleShit](https://github.com/StyleShit) in [#28189](facebook/react#28189)) - Treat `React.use()` the same as `use()`. ([@kassens](https://github.com/kassens) in [#27769](facebook/react#27769)) - Move `use()` lint to non-experimental. ([@kassens](https://github.com/kassens) in [#27768](facebook/react#27768)) - Support Flow `as` expressions. ([@cpojer](https://github.com/cpojer) in [#27590](facebook/react#27590)) - Allow `useEffect(fn, undefined)`. ([@kassens](https://github.com/kassens) in [#27525](facebook/react#27525)) - Disallow hooks in async functions. ([@acdlite](https://github.com/acdlite) in [#27045](facebook/react#27045)) - Rename experimental `useEvent` to `useEffectEvent`. ([@sebmarkbage](https://github.com/sebmarkbage) in [#25881](facebook/react#25881)) - Lint for presence of `useEvent` functions in dependency lists. ([@poteto](https://github.com/poteto) in [#25512](facebook/react#25512)) - Check `useEvent` references instead. ([@poteto](https://github.com/poteto) in [#25319](facebook/react#25319)) - Update `RulesOfHooks` with `useEvent` rules. ([@poteto](https://github.com/poteto) in [#25285](facebook/react#25285))
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
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.
We should probably treat
React.use()the same asuse()to allow it within loops and conditionals.Ideally this would implement a test that
Reactis imported or required from'react', but we don't otherwise implement such a test.