-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable
react-hooks
lint rules (#11511)
* enable `react-hooks` lint rules * Clean up Prettier, Size-limit, and Api-Extractor * update eslint rule * different type casting to not break lint rule parsing * fix up useMutation + lifecycle test * Clean up Prettier, Size-limit, and Api-Extractor * avoid reading/writing ref in render * fix up useLazyQuery * Clean up Prettier, Size-limit, and Api-Extractor * fix up another test doing a mutation in render * more useQuery cleanup * Clean up Prettier, Size-limit, and Api-Extractor * ignore rule of hook for context access * undo changes that were moved into separate PRs * Clean up Prettier, Size-limit, and Api-Extractor * almost full rewrite of the `useSubscription` hook * Clean up Prettier, Size-limit, and Api-Extractor * ignore any rule violation lint warnings in useSubscription and useQuery * changeset * rename patch * also add "eslint-plugin-react-compiler" rules --------- Co-authored-by: phryneas <phryneas@users.noreply.github.com>
- Loading branch information
Showing
13 changed files
with
738 additions
and
225 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@apollo/client": patch | ||
--- | ||
|
||
`useLoadableQuery`: ensure that `loadQuery` is updated if the ApolloClient instance changes |
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
diff --git a/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js b/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js | ||
index 441442f..d1ec5dc 100644 | ||
--- a/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js | ||
+++ b/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js | ||
@@ -905,7 +905,7 @@ var ExhaustiveDeps = { | ||
var _callee = callee, | ||
name = _callee.name; | ||
|
||
- if (name === 'useRef' && id.type === 'Identifier') { | ||
+ if ((name === 'useRef' || name === "useLazyRef") && id.type === 'Identifier') { | ||
// useRef() return value is stable. | ||
return true; | ||
} else if (name === 'useState' || name === 'useReducer') { | ||
diff --git a/node_modules/eslint-plugin-react-hooks/index.js b/node_modules/eslint-plugin-react-hooks/index.js | ||
index 0e91baf..7e86d46 100644 | ||
--- a/node_modules/eslint-plugin-react-hooks/index.js | ||
+++ b/node_modules/eslint-plugin-react-hooks/index.js | ||
@@ -1,9 +1,3 @@ | ||
'use strict'; | ||
|
||
-// TODO: this doesn't make sense for an ESLint rule. | ||
-// We need to fix our build process to not create bundles for "raw" packages like this. | ||
-if (process.env.NODE_ENV === 'production') { | ||
- module.exports = require('./cjs/eslint-plugin-react-hooks.production.min.js'); | ||
-} else { | ||
- module.exports = require('./cjs/eslint-plugin-react-hooks.development.js'); | ||
-} | ||
+module.exports = require('./cjs/eslint-plugin-react-hooks.development.js'); |
This file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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