CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-acorn-jsx

tessl install tessl/npm-acorn-jsx@5.3.0

JSX parsing plugin for the Acorn JavaScript parser that enables fast parsing of React JSX syntax

Agent Success

Agent success rate when using this tile

76%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.69x

Baseline

Agent success rate without this tile

45%

task.mdevals/scenario-3/

JSX Fragment AST Analyzer

A command-line tool that parses JavaScript files containing JSX fragments and extracts information about their structure.

Capabilities

Parse JSX fragments in code

  • Given a JavaScript file containing <>content</>, the tool successfully parses it and identifies the JSX fragment @test
  • Given a JavaScript file with nested JSX fragments like <><div><>nested</></div></>, the tool correctly parses all fragment levels @test

Extract fragment children information

  • Given a fragment containing multiple child elements <><div /><span /></>, the tool reports the count and types of children @test
  • Given an empty fragment <></>, the tool correctly identifies it has zero children @test

Handle mixed content

  • Given a fragment with text, elements, and expressions <>text {expr} <div /></>, the tool correctly identifies all three types of children @test

Implementation

@generates

API

/**
 * Parses a JavaScript file and returns information about JSX fragments.
 *
 * @param {string} code - The JavaScript source code to analyze
 * @returns {object} Analysis results with fragment information
 * @returns {number} returns.fragmentCount - Total number of JSX fragments found
 * @returns {Array<object>} returns.fragments - Array of fragment details
 * @returns {number} returns.fragments[].childrenCount - Number of direct children in the fragment
 * @returns {Array<string>} returns.fragments[].childrenTypes - Types of children (e.g., 'JSXElement', 'JSXText', 'JSXExpressionContainer')
 */
function analyzeFragments(code) {
  // Implementation here
}

module.exports = { analyzeFragments };

Dependencies { .dependencies }

acorn-jsx { .dependency }

Provides JSX parsing support with fragment detection.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/acorn-jsx@5.3.x
tile.json