Skip to content

[linter] Add verification for stable value hooks #33389

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

Closed
wants to merge 2 commits into from

Conversation

jbrown215
Copy link
Contributor

@jbrown215 jbrown215 commented May 31, 2025

jbrown215 added 2 commits May 31, 2025 09:27
… values

Summary:
This commit adds a way to configure the exhaustive deps linter to be aware of user-provided
hooks that return stable values. The configuration allows you to specify the hook name
and optionally a list of property names or indexes that are stable. If no properties
are provided then the outer return value is considered to be stable. If properties
are provided then we allow them to be destructured and determined to be stable.

Please let me know if you have any concerns about the configuration structure:
```typescript
type StableValueHookConfig = Array<{
  name: string,
  propertiesOrIndexes: null | Array<string> | Array<number>
}>;
```
@react-sizebot
Copy link

Comparing: ee76351...57bffec

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.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 529.84 kB 529.84 kB = 93.52 kB 93.52 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 650.94 kB 650.94 kB = 114.65 kB 114.65 kB
facebook-www/ReactDOM-prod.classic.js = 675.89 kB 675.89 kB = 118.93 kB 118.93 kB
facebook-www/ReactDOM-prod.modern.js = 666.17 kB 666.17 kB = 117.32 kB 117.32 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js +0.77% 2,141.02 kB 2,157.47 kB +0.64% 322.69 kB 324.75 kB
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +0.77% 2,145.47 kB 2,161.92 kB +0.64% 323.64 kB 325.72 kB
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js +0.77% 2,140.85 kB 2,157.25 kB +0.64% 322.66 kB 324.71 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js +0.77% 2,140.85 kB 2,157.25 kB +0.64% 322.66 kB 324.71 kB
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +0.76% 2,145.29 kB 2,161.70 kB +0.64% 323.61 kB 325.68 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +0.76% 2,145.29 kB 2,161.70 kB +0.64% 323.61 kB 325.68 kB

Generated by 🚫 dangerJS against 57bffec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants