{"id":25816,"library":"jsx-to-js","title":"jsx-to-js","description":"Transpile JSX to JS with non-standard syntax: ignores tag name capitalization (uses variable tracking), provides ES6-style parameter shorthand (defaults to variable with same name instead of true). Unmaintained since 2015; version 1.0.1 is the latest. Different from standard JSX transpilers (e.g., Babel) in semantics; useful for custom JSX runtimes that want shorthand syntax. No TypeScript definitions, no updates, likely abandonware.","status":"abandoned","version":"1.0.1","language":"javascript","source_language":"en","source_url":"git://github.com/jkroso/JSX-to-JS","tags":["javascript","JSX"],"install":[{"cmd":"npm install jsx-to-js","lang":"bash","label":"npm"},{"cmd":"yarn add jsx-to-js","lang":"bash","label":"yarn"},{"cmd":"pnpm add jsx-to-js","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package uses CommonJS; no default export for ESM. Only compatible with Node.js require.","wrong":"import JSX from 'jsx-to-js'","symbol":"JSX","correct":"const JSX = require('jsx-to-js')"},{"note":"No standard named export; the module exports a single function that expects a JSX AST node.","wrong":"","symbol":"transform (no default export)","correct":"const { transform } = require('jsx-to-js')"},{"note":"The exported function is used to transform a parsed JSX AST to a JavaScript AST.","wrong":"","symbol":"JSX (as a function)","correct":"const JSX = require('jsx-to-js'); const ast = JSX(parse('<div/>'))"}],"quickstart":{"code":"const parse = require('jsx-parser') // hypothetical parser\nconst JSX = require('jsx-to-js')\n\n// Parse JSX string to AST (you need a JSX parser yourself)\nconst jsxAst = parse('<div className=\"foo\" onClick={handleClick}/>')\n\n// Transform to JS AST\nconst jsAst = JSX(jsxAst)\n\nconsole.log(JSON.stringify(jsAst, null, 2))\n// Output: JSX(\"div\", {className: \"foo\", onClick: handleClick})","lang":"javascript","description":"Shows how to transform a JSX AST (parsed externally) into a JavaScript AST using jsx-to-js."},"warnings":[{"fix":"Ensure all components are in scope as variables; do not rely on capitalization to distinguish HTML tags from components.","message":"Non-standard JSX syntax: tag name case is ignored. Variables used for component detection instead of capitalization.","severity":"breaking","affected_versions":"*"},{"fix":"Use explicit attribute values (e.g., onMousedown={true}) if you need standard behavior, or rename variables to match attribute names.","message":"ES6-style parameter shorthand: attribute without value defaults to variable with same name, not true.","severity":"breaking","affected_versions":"*"},{"fix":"Consider using Babel's @babel/plugin-transform-react-jsx or similar for standard behavior.","message":"Package has no updates since 2015, no TypeScript types, no ESM support.","severity":"deprecated","affected_versions":"1.x"},{"fix":"Pass a valid JSX AST object, not a string.","message":"The package does not parse JSX; it requires a pre-parsed JSX AST. You need a separate parser (like jsx-parser or acorn-jsx).","severity":"gotcha","affected_versions":"*"},{"fix":"Use const JSX = require('jsx-to-js') instead of import.","message":"The exported function is named 'JSX' but is not the default export; only works with CommonJS require.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use const JSX = require('jsx-to-js') instead.","cause":"Using ES module import syntax (import JSX from 'jsx-to-js') with a CommonJS-only package.","error":"TypeError: JSX is not a function"},{"fix":"Preparse your JSX string with a parser like jsx-parser or acorn-jsx before passing to JSX().","cause":"Passing a JSX string to the function instead of a parsed AST object.","error":"Cannot read property 'type' of undefined"},{"fix":"Ensure all component names are defined as variables in scope; use lowercase for HTML elements if needed.","cause":"Using standard JSX syntax (e.g., uppercase components) expecting default behavior; jsx-to-js uses variable tracking and ignores case.","error":"Unexpected token"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}