GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(eslint-plugin-react-hooks): accepting `as` expressions as deps array by StyleShit · Pull Request #28189 · react/react

Conversation

@StyleShit

@StyleShit StyleShit commented Feb 1, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

This PR closes #25844
The original issue talks about as const, but seems like it fails for any as X expressions since it adds another nesting level to the AST.

EDIT: Also closes #20162

How did you test this change?

Added unit tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@StyleShit
fix(eslint-plugin-react-hooks): accepting as expressions as deps array
6129f47
Closes react#25844
@facebook-github-bot

facebook-github-bot commented Feb 1, 2024

Copy link
Copy Markdown
Contributor

Hi @StyleShit!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@react-sizebot

react-sizebot commented Feb 1, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: 53b12e4...aa068d1

Critical size changes

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

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 176.57 kB 176.57 kB = 55.00 kB 55.00 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 178.69 kB 178.69 kB = 55.64 kB 55.64 kB
facebook-www/ReactDOM-prod.classic.js = 591.32 kB 591.32 kB = 104.34 kB 104.34 kB
facebook-www/ReactDOM-prod.modern.js = 575.08 kB 575.08 kB = 101.43 kB 101.43 kB
test_utils/ReactAllWarnings.js Deleted 67.56 kB 0.00 kB Deleted 16.59 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js +0.37% 92.14 kB 92.49 kB +0.35% 21.70 kB 21.77 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js +0.37% 92.14 kB 92.49 kB +0.35% 21.70 kB 21.77 kB
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js +0.37% 92.29 kB 92.63 kB +0.35% 21.72 kB 21.80 kB
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +0.36% 93.13 kB 93.46 kB +0.24% 21.92 kB 21.97 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +0.36% 93.13 kB 93.46 kB +0.24% 21.92 kB 21.97 kB
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +0.36% 93.27 kB 93.61 kB +0.24% 21.94 kB 21.99 kB
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.min.js +0.33% 27.00 kB 27.08 kB +0.21% 9.30 kB 9.32 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.min.js +0.33% 27.00 kB 27.08 kB +0.21% 9.30 kB 9.32 kB
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.min.js +0.32% 27.59 kB 27.68 kB +0.30% 9.47 kB 9.50 kB
test_utils/ReactAllWarnings.js Deleted 67.56 kB 0.00 kB Deleted 16.59 kB 0.00 kB

Generated by 🚫 dangerJS against aa068d1

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

eps1lon
eps1lon approved these changes Feb 1, 2024
View reviewed changes

@eps1lon eps1lon left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Makes sense, thank you. Can you sign the CLA so that we can merge this? It may take a while between signing and the status to become green.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

milichev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@StyleShit

StyleShit commented Feb 1, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Already signed when opening the PR, just waiting for it to update 😄

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StyleShit
Merge branch 'main' into fix/exhaustive-deps-ts-as
aa068d1
@facebook-github-bot

facebook-github-bot commented Feb 1, 2024

Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@facebook-github-bot facebook-github-bot added the CLA Signed label Feb 1, 2024
@eps1lon
eps1lon merged commit a1433ca into react:main Feb 1, 2024
github-actions Bot pushed a commit that referenced this pull request Feb 1, 2024
@eps1lon
fix(eslint-plugin-react-hooks): accepting as expressions as deps ar…
9628430
…ray (#28189)

## Summary

This PR closes #25844
The original issue talks about `as const`, but seems like it fails for
any `as X` expressions since it adds another nesting level to the AST.

EDIT: Also closes #20162

## How did you test this change?

Added unit tests

DiffTrain build for [a1433ca](a1433ca)
gaearon pushed a commit that referenced this pull request Feb 3, 2024
@StyleShit @gaearon
fix(eslint-plugin-react-hooks): accepting as expressions as deps ar…
b3f8de8
…ray (#28189)

## Summary

This PR closes #25844
The original issue talks about `as const`, but seems like it fails for
any `as X` expressions since it adds another nesting level to the AST.

EDIT: Also closes #20162

## How did you test this change?

Added unit tests
@gnoff gnoff mentioned this pull request Feb 5, 2024
Update React from 60a927d04 to 2bc7d336a vercel/next.js#61522
Merged
gnoff added a commit to gnoff/next.js that referenced this pull request Feb 6, 2024
@gnoff
updated React from 60a927d04 to 2bc7d336a.
6290768
- react/react#28250
- react/react#28225
- react/react#28123
- react/react#28240
- react/react#28239
- react/react#28245
- react/react#28244
- react/react#28238
- react/react#28235
- react/react#28221
- react/react#28215
- react/react#28214
- react/react#28213
- react/react#28212
- react/react#28211
- react/react#28247
- react/react#28210
- react/react#28186
- react/react#28232
- react/react#28169
- react/react#28177
- react/react#28170
- react/react#28168
- react/react#28122
- react/react#27982
- react/react#28217
- react/react#28223
- react/react#28208
- react/react#28209
- react/react#28200
- react/react#28199
- react/react#28198
- react/react#28197
- react/react#28196
- react/react#28194
- react/react#28192
- react/react#28191
- react/react#28182
- react/react#28181
- react/react#28180
- react/react#28178
- react/react#28201
- react/react#28176
- react/react#28162
- react/react#28131
- react/react#28190
- react/react#28172
- react/react#28171
- react/react#28173
- react/react#28174
- react/react#28175
- react/react#28136
- react/react#28135
- react/react#28134
- react/react#28133
- react/react#28132
- react/react#28130
- react/react#28202
- react/react#28102
- react/react#28161
- react/react#28193
- react/react#28195
- react/react#28189
- react/react#28160
- react/react#28096
- react/react#28183
- react/react#28125
- react/react#28157
- react/react#28115
- react/react#28124
- react/react#28163
- react/react#28164
- react/react#28150
- react/react#28159
- react/react#28069
- react/react#28110
- react/react#28148
- react/react#28116
- react/react#28099
- react/react#28100
- react/react#28147
- react/react#28128
- react/react#28126
- react/react#28139
- react/react#28140
- react/react#28141
- react/react#28142
- react/react#28113
- react/react#28129
- react/react#28114
- react/react#28053
- react/react#28091
- react/react#28087
- react/react#28112
- react/react#28086
- react/react#28101
- react/react#28106
- react/react#28117
- react/react#28118
- react/react#28105
- react/react#27883
- react/react#28111
- react/react#28095
- react/react#28108
- react/react#28090
- react/react#28089
- react/react#28076
- react/react#28074
- react/react#28103
- react/react#28098
- react/react#28097
- react/react#28068
- react/react#28093
- react/react#28094
- react/react#28073
- react/react#28084
- react/react#28063
- react/react#28085
- react/react#28083
- react/react#28065
- react/react#28061
- react/react#28077
- react/react#28075
- react/react#28078
- react/react#28050
- react/react#28011
- react/react#28055
- react/react#28066
- react/react#28067
- react/react#28010
- react/react#27993
- react/react#28052
- react/react#28060
- react/react#28059
- react/react#28034
- react/react#28033
- react/react#28004
- react/react#28051
- react/react#28012
- react/react#28001
- react/react#28002
- react/react#27995
- react/react#28006
- react/react#28005
- react/react#28007
- react/react#28008
- react/react#28009
- react/react#28000
- react/react#28003
- react/react#27997
- react/react#27240
- react/react#27977
- react/react#27940
- react/react#27939
- react/react#28090
- react/react#28089
- react/react#28076
- react/react#28074
- react/react#28103
- react/react#28098
- react/react#28097
- react/react#28068
- react/react#28093
- react/react#28094
- react/react#28073
- react/react#28084
- react/react#28063
- react/react#28085
- react/react#28083
- react/react#28065
- react/react#28061
- react/react#28077
- react/react#28075
- react/react#28078
- react/react#28050
- react/react#28011
- react/react#28055
- react/react#28066
- react/react#28067
- react/react#28010
- react/react#27993
- react/react#28052
- react/react#28060
- react/react#28059
- react/react#28034
- react/react#28033
- react/react#28004
- react/react#28051
- react/react#28012
- react/react#28001
- react/react#28002
- react/react#27995
- react/react#28006
- react/react#28005
- react/react#28007
- react/react#28008
- react/react#28009
- react/react#28000
- react/react#28003
- react/react#27997
- react/react#27240
- react/react#27977
- react/react#27940
- react/react#27939
gnoff added a commit to vercel/next.js that referenced this pull request Feb 6, 2024
@gnoff
Update React from 60a927d04 to 2bc7d336a (#61522)
2395557
Updates React from 60a927d04 to 2bc7d336a

Also updates aliases for `react.shared-subset` to `react.react-server`

### React upstream changes

- react/react#28250
- react/react#28225
- react/react#28123
- react/react#28240
- react/react#28239
- react/react#28245
- react/react#28244
- react/react#28238
- react/react#28235
- react/react#28221
- react/react#28215
- react/react#28214
- react/react#28213
- react/react#28212
- react/react#28211
- react/react#28247
- react/react#28210
- react/react#28186
- react/react#28232
- react/react#28169
- react/react#28177
- react/react#28170
- react/react#28168
- react/react#28122
- react/react#27982
- react/react#28217
- react/react#28223
- react/react#28208
- react/react#28209
- react/react#28200
- react/react#28199
- react/react#28198
- react/react#28197
- react/react#28196
- react/react#28194
- react/react#28192
- react/react#28191
- react/react#28182
- react/react#28181
- react/react#28180
- react/react#28178
- react/react#28201
- react/react#28176
- react/react#28162
- react/react#28131
- react/react#28190
- react/react#28172
- react/react#28171
- react/react#28173
- react/react#28174
- react/react#28175
- react/react#28136
- react/react#28135
- react/react#28134
- react/react#28133
- react/react#28132
- react/react#28130
- react/react#28202
- react/react#28102
- react/react#28161
- react/react#28193
- react/react#28195
- react/react#28189
- react/react#28160
- react/react#28096
- react/react#28183
- react/react#28125
- react/react#28157
- react/react#28115
- react/react#28124
- react/react#28163
- react/react#28164
- react/react#28150
- react/react#28159
- react/react#28069
- react/react#28110
- react/react#28148
- react/react#28116
- react/react#28099
- react/react#28100
- react/react#28147
- react/react#28128
- react/react#28126
- react/react#28139
- react/react#28140
- react/react#28141
- react/react#28142
- react/react#28113
- react/react#28129
- react/react#28114
- react/react#28053
- react/react#28091
- react/react#28087
- react/react#28112
- react/react#28086
- react/react#28101
- react/react#28106
- react/react#28117
- react/react#28118
- react/react#28105
- react/react#27883
- react/react#28111
- react/react#28095
- react/react#28108
- react/react#28090
- react/react#28089
- react/react#28076
- react/react#28074
- react/react#28103
- react/react#28098
- react/react#28097
- react/react#28068
- react/react#28093
- react/react#28094
- react/react#28073
- react/react#28084
- react/react#28063
- react/react#28085
- react/react#28083
- react/react#28065
- react/react#28061
- react/react#28077
- react/react#28075
- react/react#28078
- react/react#28050
- react/react#28011
- react/react#28055
- react/react#28066
- react/react#28067
- react/react#28010
- react/react#27993
- react/react#28052
- react/react#28060
- react/react#28059
- react/react#28034
- react/react#28033
- react/react#28004
- react/react#28051
- react/react#28012
- react/react#28001
- react/react#28002
- react/react#27995
- react/react#28006
- react/react#28005
- react/react#28007
- react/react#28008
- react/react#28009
- react/react#28000
- react/react#28003
- react/react#27997
- react/react#27240
- react/react#27977
- react/react#27940
- react/react#27939
- react/react#28090
- react/react#28089
- react/react#28076
- react/react#28074
- react/react#28103
- react/react#28098
- react/react#28097
- react/react#28068
- react/react#28093
- react/react#28094
- react/react#28073
- react/react#28084
- react/react#28063
- react/react#28085
- react/react#28083
- react/react#28065
- react/react#28061
- react/react#28077
- react/react#28075
- react/react#28078
- react/react#28050
- react/react#28011
- react/react#28055
- react/react#28066
- react/react#28067
- react/react#28010
- react/react#27993
- react/react#28052
- react/react#28060
- react/react#28059
- react/react#28034
- react/react#28033
- react/react#28004
- react/react#28051
- react/react#28012
- react/react#28001
- react/react#28002
- react/react#27995
- react/react#28006
- react/react#28005
- react/react#28007
- react/react#28008
- react/react#28009
- react/react#28000
- react/react#28003
- react/react#27997
- react/react#27240
- react/react#27977
- react/react#27940
- react/react#27939

Closes NEXT-2331
@ztanner ztanner mentioned this pull request Mar 19, 2024
(backport) Update React from 60a927d04 to 14898b6a9 vercel/next.js#63442
Closed
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@StyleShit @AndyPengc12
fix(eslint-plugin-react-hooks): accepting as expressions as deps ar…
a1c219d
…ray (react#28189)

## Summary

This PR closes react#25844
The original issue talks about `as const`, but seems like it fails for
any `as X` expressions since it adds another nesting level to the AST.

EDIT: Also closes react#20162

## How did you test this change?

Added unit tests
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
@eps1lon
fix(eslint-plugin-react-hooks): accepting as expressions as deps ar…
86906e8
…ray (#28189)

## Summary

This PR closes #25844
The original issue talks about `as const`, but seems like it fails for
any `as X` expressions since it adds another nesting level to the AST.

EDIT: Also closes #20162

## How did you test this change?

Added unit tests

DiffTrain build for commit a1433ca.
renovate Bot added a commit to mmkal/eslint-plugin-mmkal that referenced this pull request Oct 11, 2024
@renovate
fix(deps): update dependency eslint-plugin-react-hooks to v5
192585b
##### [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](react/react#25162)

<!---->

-   Consider dispatch from `useActionState` stable. ([@eps1lon](https://github.com/eps1lon) in [#29665](react/react#29665))
-   Add support for ESLint v9. ([@eps1lon](https://github.com/eps1lon) in [#28773](react/react#28773))
-   Accept `as` expression in callback. ([@StyleShit](https://github.com/StyleShit) in [#28202](react/react#28202))
-   Accept `as` expressions in deps array. ([@StyleShit](https://github.com/StyleShit) in [#28189](react/react#28189))
-   Treat `React.use()` the same as `use()`. ([@kassens](https://github.com/kassens) in [#27769](react/react#27769))
-   Move `use()` lint to non-experimental. ([@kassens](https://github.com/kassens) in [#27768](react/react#27768))
-   Support Flow `as` expressions. ([@cpojer](https://github.com/cpojer) in [#27590](react/react#27590))
-   Allow `useEffect(fn, undefined)`. ([@kassens](https://github.com/kassens) in [#27525](react/react#27525))
-   Disallow hooks in async functions. ([@acdlite](https://github.com/acdlite) in [#27045](react/react#27045))
-   Rename experimental `useEvent` to `useEffectEvent`. ([@sebmarkbage](https://github.com/sebmarkbage) in [#25881](react/react#25881))
-   Lint for presence of `useEvent` functions in dependency lists. ([@poteto](https://github.com/poteto) in [#25512](react/react#25512))
-   Check `useEvent` references instead. ([@poteto](https://github.com/poteto) in [#25319](react/react#25319))
-   Update `RulesOfHooks` with `useEvent` rules. ([@poteto](https://github.com/poteto) in [#25285](react/react#25285))
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@StyleShit
fix(eslint-plugin-react-hooks): accepting as expressions as deps ar…
3255d58
…ray (react#28189)

## Summary

This PR closes react#25844
The original issue talks about `as const`, but seems like it fails for
any `as X` expressions since it adds another nesting level to the AST.

EDIT: Also closes react#20162

## How did you test this change?

Added unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@eps1lon eps1lon eps1lon approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bug: react-hooks/exhaustive-deps does not accept readonly arrays as deps Bug: react-hooks/exhaustive-deps false positive when deps is defined with typescript const typing

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@StyleShit @facebook-github-bot @react-sizebot @eps1lon
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.