JSX parsing plugin for the Acorn JavaScript parser that enables fast parsing of React JSX syntax
76
Build a tool that inspects the internal token contexts used by the JSX parser as it processes code.
Create a function that:
Token contexts represent the internal state of the parser as it processes different syntactic elements. Your implementation should:
Return an array of objects with:
name: The identifier of the token contextdescription: A brief description of what the context is used forWhen parsing JSX code "<Component />":
name property (string) and a description property (string)When parsing JSX code "<div>text</div>":
@generates
/**
* Inspects available token contexts from the JSX parser.
*
* @param {string} jsxCode - JSX code to trigger parser initialization
* @returns {Array<{name: string, description: string}>} Array of token context definitions
*/
function getTokenContexts(jsxCode) {
// IMPLEMENTATION HERE
}
module.exports = { getTokenContexts };Provides the core JavaScript parser.
Provides JSX parsing capabilities with token context management.
Install with Tessl CLI
npx tessl i tessl/npm-acorn-jsxdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10