Skip to content

Latest commit

 

History

History
22 lines (14 loc) · 785 Bytes

File metadata and controls

22 lines (14 loc) · 785 Bytes

@eslint-react/core / findParentJsxAttribute

Function: findParentJsxAttribute()

function findParentJsxAttribute(node: Node, test: (node: JSXAttribute) => boolean): JSXAttribute | undefined;

Traverses up the AST to find a parent JSX attribute node that matches a given test

Parameters

Parameter Type Default value Description
node Node undefined The starting AST node
test (node: JSXAttribute) => boolean constTrue Optional predicate function to test if the attribute meets criteria Defaults to always returning true (matches any attribute)

Returns

JSXAttribute | undefined

The first matching JSX attribute node found when traversing upwards, or undefined