CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-acorn-jsx

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

76

1.68x
Overview
Eval results
Files

task.mdevals/scenario-8/

JSX Boolean Attribute Parser

A utility that parses JSX code containing boolean attributes and extracts information about those attributes.

Capabilities

Parse JSX with boolean attributes

  • Parse JSX code <input disabled /> and identify that the disabled attribute has a null value @test
  • Parse JSX code <button selected /> and identify that the selected attribute has a null value @test
  • Parse JSX code <input disabled checked /> and identify multiple boolean attributes with null values @test
  • Parse JSX code <input type="text" disabled /> with mixed boolean and string attributes and correctly distinguish between them @test

Implementation

@generates

API

/**
 * Parses JSX code and returns an array of boolean attributes found in the code.
 * Each boolean attribute object contains the attribute name and its value (should be null).
 *
 * @param {string} jsxCode - The JSX code to parse
 * @returns {Array<{name: string, value: null}>} Array of boolean attributes with their values
 * @throws {Error} If the JSX code is invalid
 */
function parseBooleanAttributes(jsxCode) {
  // Implementation here
}

module.exports = { parseBooleanAttributes };

Dependencies { .dependencies }

acorn { .dependency }

Provides JavaScript parsing capabilities.

acorn-jsx { .dependency }

Provides JSX parsing support for Acorn parser.

Install with Tessl CLI

npx tessl i tessl/npm-acorn-jsx

tile.json