[linter] Add configuration option to specify hooks that return stable 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:
type StableValueHookConfig = Array<{
name: string,
propertiesOrIndexes: null | Array<string> | Array<number>
}>;
Stack created with Sapling. Best reviewed with ReviewStack.
- #33389
- -> #33382
Comparing: ee76351917106c6146745432a52e9a54a41ee181...494e4707a993b47c21d00c32159f55f5df2a7557
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 | +0.05% | 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%:
(No significant changes)
Generated by :no_entry_sign: dangerJS against 494e4707a993b47c21d00c32159f55f5df2a7557
Discussed offline. While some people prefer toomit the deps they know are stable, we're going to instead push people to include those deps anyway. It does not change semantics. This lint ru.e opens more points of failure