eslint-plugin-react-hooks 6.1.0-canary-96c61b7f-20250709 → 6.1.0-canary-2f0e7e57-20250715
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -55158,13 +55158,15 @@ const rule = {
|
|
|
55158
55158
|
}
|
|
55159
55159
|
},
|
|
55160
55160
|
Identifier(node) {
|
|
55161
|
-
if (lastEffect == null &&
|
|
55162
|
-
|
|
55163
|
-
|
|
55161
|
+
if (lastEffect == null && useEffectEventFunctions.has(node)) {
|
|
55162
|
+
const message = `\`${getSourceCode().getText(node)}\` is a function created with React Hook "useEffectEvent", and can only be called from ` +
|
|
55163
|
+
'the same component.' +
|
|
55164
|
+
(node.parent.type === 'CallExpression'
|
|
55165
|
+
? ''
|
|
55166
|
+
: ' They cannot be assigned to variables or passed down.');
|
|
55164
55167
|
context.report({
|
|
55165
55168
|
node,
|
|
55166
|
-
message
|
|
55167
|
-
'the same component. They cannot be assigned to variables or passed down.',
|
|
55169
|
+
message,
|
|
55168
55170
|
});
|
|
55169
55171
|
}
|
|
55170
55172
|
},
|
|
@@ -54985,13 +54985,15 @@ const rule = {
|
|
|
54985
54985
|
}
|
|
54986
54986
|
},
|
|
54987
54987
|
Identifier(node) {
|
|
54988
|
-
if (lastEffect == null &&
|
|
54989
|
-
|
|
54990
|
-
|
|
54988
|
+
if (lastEffect == null && useEffectEventFunctions.has(node)) {
|
|
54989
|
+
const message = `\`${getSourceCode().getText(node)}\` is a function created with React Hook "useEffectEvent", and can only be called from ` +
|
|
54990
|
+
'the same component.' +
|
|
54991
|
+
(node.parent.type === 'CallExpression'
|
|
54992
|
+
? ''
|
|
54993
|
+
: ' They cannot be assigned to variables or passed down.');
|
|
54991
54994
|
context.report({
|
|
54992
54995
|
node,
|
|
54993
|
-
message
|
|
54994
|
-
'the same component. They cannot be assigned to variables or passed down.',
|
|
54996
|
+
message,
|
|
54995
54997
|
});
|
|
54996
54998
|
}
|
|
54997
54999
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks",
|
|
3
3
|
"description": "ESLint rules for React Hooks",
|
|
4
|
-
"version": "6.1.0-canary-
|
|
4
|
+
"version": "6.1.0-canary-2f0e7e57-20250715",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/facebook/react.git",
|