or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-2/

JSX Attribute Name Extraction

Build a helper that returns the names of JSX attributes from a parsed AST node, preserving namespace prefixes when they exist.

Capabilities

Collects attribute names from JSX opening elements

  • Given a JSX opening element for <svg:path focusable="false" xlink:href="#icon" />, the helper returns ["focusable", "xlink:href"] in source order. @test
  • Namespaced attributes keep their original prefix and local name (for example xml:lang stays exactly that). @test

Skips spreads without failing

  • Spread attributes in the attributes array are ignored without throwing or adding placeholders to the result. @test

Rejects non-JSX inputs

  • Passing a node that is not a JSX opening element triggers a thrown error that explains the expectation. @test

Implementation

@generates

API

export function extractAttributeNames(
  node: JSXOpeningElement,
): string[];

Dependencies { .dependencies }

jsx-ast-utils { .dependency }

Utilities for inspecting JSX AST nodes and reading attribute names with namespace support.