Home / Function/ getDependency() — react Function Reference

getDependency() — react Function Reference

Architecture documentation for the getDependency() function in ExhaustiveDeps.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  d25d44a2_a814_6c2f_1f81_168e5b1e6d98["getDependency()"]
  ea02b01a_dd46_4b35_fe00_775aec496668["ExhaustiveDeps.ts"]
  d25d44a2_a814_6c2f_1f81_168e5b1e6d98 -->|defined in| ea02b01a_dd46_4b35_fe00_775aec496668
  c0937ffe_5980_6959_3af6_e18a4a23114f["rule.create()"]
  c0937ffe_5980_6959_3af6_e18a4a23114f -->|calls| d25d44a2_a814_6c2f_1f81_168e5b1e6d98
  style d25d44a2_a814_6c2f_1f81_168e5b1e6d98 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/src/rules/ExhaustiveDeps.ts lines 1865–1893

function getDependency(node: Node): Node {
  if (
    node.parent &&
    (node.parent.type === 'MemberExpression' ||
      node.parent.type === 'OptionalMemberExpression') &&
    node.parent.object === node &&
    'name' in node.parent.property &&
    node.parent.property.name !== 'current' &&
    !node.parent.computed &&
    !(
      node.parent.parent != null &&
      (node.parent.parent.type === 'CallExpression' ||
        node.parent.parent.type === 'OptionalCallExpression') &&
      node.parent.parent.callee === node.parent
    )
  ) {
    return getDependency(node.parent);
  } else if (
    // Note: we don't check OptionalMemberExpression because it can't be LHS.
    node.type === 'MemberExpression' &&
    node.parent &&
    node.parent.type === 'AssignmentExpression' &&
    node.parent.left === node
  ) {
    return node.object;
  } else {
    return node;
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getDependency() do?
getDependency() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/rules/ExhaustiveDeps.ts.
Where is getDependency() defined?
getDependency() is defined in packages/eslint-plugin-react-hooks/src/rules/ExhaustiveDeps.ts at line 1865.
What calls getDependency()?
getDependency() is called by 1 function(s): rule.create.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free