CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-jsx-ast-utils

AST utility module for statically analyzing JSX

50

1.42x
Quality

Pending

Does it follow best practices?

Impact

50%

1.42x

Average score across 10 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

task.mdevals/scenario-7/

JSX Event Handler Catalog

Build utilities that read JSX attribute nodes and report event handler usage using the canonical JSX event prop lists supplied by the dependency.

Capabilities

Extracts recognized handlers

  • Given JSX attributes containing canonical event props plus non-event props and duplicates, returns a deduped array of only canonical event handler prop names sorted alphabetically. @test

Groups handlers by domain

  • Builds an object keyed by event domains using the dependency's canonical category mapping; includes only categories with matches and preserves canonical ordering within each category. @test

Answers category presence queries

  • Returns true when any JSX attribute belongs to the requested canonical category name (e.g., "keyboard", "mouse") and false when none match or when the category name is not recognized. @test

Ignores non-canonical props

  • Excludes props that resemble events but are not part of the canonical list (e.g., onClicker, casing typos) from all results. @test

Implementation

@generates

API

export type EventCategory =
  | "clipboard"
  | "composition"
  | "keyboard"
  | "focus"
  | "form"
  | "mouse"
  | "selection"
  | "touch"
  | "ui"
  | "wheel"
  | "media"
  | "image"
  | "animation"
  | "transition";

export interface JSXAttribute {
  type: "JSXAttribute";
  name: { type: "JSXIdentifier" | "JSXNamespacedName"; name: string };
  value?: unknown;
}

export function listEventHandlers(attrs: JSXAttribute[]): string[];

export function groupEventHandlers(attrs: JSXAttribute[]): Partial<Record<EventCategory, string[]>>;

export function hasEventCategory(attrs: JSXAttribute[], category: EventCategory): boolean;

Dependencies { .dependencies }

jsx-ast-utils { .dependency }

Provides canonical JSX event handler prop lists and category mappings.

tile.json