Skip to content

Commit

Permalink
Sync from oss-experimental, not oss-stable (#26401)
Browse files Browse the repository at this point in the history
## Overview

To test useEffectEvent, we need the experimental build of the lint
plugin.

DiffTrain build for [21f6dba](21f6dba)
  • Loading branch information
rickhanlonii committed Mar 16, 2023
1 parent 923bb20 commit 976efdb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
99aa082be0a2a62fef8ed747348ddf85c5641902
21f6dba6a71f16b56a96182233c897468324cf99
24 changes: 14 additions & 10 deletions compiled/facebook-www/eslint-plugin-react-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
/* global BigInt */

function isHookName(s) {

return /^use[A-Z0-9]/.test(s);
{
return s === 'use' || /^use[A-Z0-9]/.test(s);
}
}
/**
* We consider hooks to be a hook name identifier or a member expression
Expand Down Expand Up @@ -164,13 +165,15 @@ function isInsideComponentOrHook(node) {
}

function isUseEffectEventIdentifier$1(node) {

return false;
{
return node.type === 'Identifier' && node.name === 'useEffectEvent';
}
}

function isUseIdentifier(node) {

return false;
{
return node.type === 'Identifier' && node.name === 'use';
}
}

var RulesOfHooks = {
Expand Down Expand Up @@ -707,7 +710,7 @@ var RulesOfHooks = {
// another useEffectEvent


if (node.callee.type === 'Identifier' && (node.callee.name === 'useEffect' || isUseEffectEventIdentifier$1()) && node.arguments.length > 0) {
if (node.callee.type === 'Identifier' && (node.callee.name === 'useEffect' || isUseEffectEventIdentifier$1(node.callee)) && node.arguments.length > 0) {
// Denote that we have traversed into a useEffect call, and stash the CallExpr for
// comparison later when we exit
lastEffect = node;
Expand Down Expand Up @@ -995,7 +998,7 @@ var ExhaustiveDeps = {
if (name === 'useRef' && id.type === 'Identifier') {
// useRef() return value is stable.
return true;
} else if (isUseEffectEventIdentifier() && id.type === 'Identifier') {
} else if (isUseEffectEventIdentifier(callee) && id.type === 'Identifier') {
var _iterator = _createForOfIteratorHelper(resolved.references),
_step;

Expand Down Expand Up @@ -2558,8 +2561,9 @@ function isAncestorNodeOf(a, b) {
}

function isUseEffectEventIdentifier(node) {

return false;
{
return node.type === 'Identifier' && node.name === 'useEffectEvent';
}
}

var configs = {
Expand Down

0 comments on commit 976efdb

Please sign in to comment.