GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(eslint-plugin-react-hooks): accepting `as` expressions as deps ar… · react/react@9628430

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • compiled/facebook-www
    • REVISION
    • eslint-plugin-react-hooks.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎compiled/facebook-www/REVISION‎

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
53b12e46a17549ec7644e13c126440ed2f3629fd
1+
a1433ca0bacff76f720ffec9a0020f56e8c9ffed
Collapse file

‎compiled/facebook-www/eslint-plugin-react-hooks.js‎

Copy file name to clipboardExpand all lines: compiled/facebook-www/eslint-plugin-react-hooks.js
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,8 +1390,10 @@ var ExhaustiveDeps = {
13901390

13911391
var declaredDependencies = [];
13921392
var externalDependencies = new Set();
1393+
var isArrayExpression = declaredDependenciesNode.type === 'ArrayExpression';
1394+
var isTSAsArrayExpression = declaredDependenciesNode.type === 'TSAsExpression' && declaredDependenciesNode.expression.type === 'ArrayExpression';
13931395

1394-
if (declaredDependenciesNode.type !== 'ArrayExpression') {
1396+
if (!isArrayExpression && !isTSAsArrayExpression) {
13951397
// If the declared dependencies are not an array expression then we
13961398
// can't verify that the user provided the correct dependencies. Tell
13971399
// the user this in an error.
@@ -1400,7 +1402,8 @@ var ExhaustiveDeps = {
14001402
message: "React Hook " + context.getSource(reactiveHook) + " was passed a " + 'dependency list that is not an array literal. This means we ' + "can't statically verify whether you've passed the correct " + 'dependencies.'
14011403
});
14021404
} else {
1403-
declaredDependenciesNode.elements.forEach(function (declaredDependencyNode) {
1405+
var arrayExpression = isTSAsArrayExpression ? declaredDependenciesNode.expression : declaredDependenciesNode;
1406+
arrayExpression.elements.forEach(function (declaredDependencyNode) {
14041407
// Skip elided elements.
14051408
if (declaredDependencyNode === null) {
14061409
return;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.