analyze_code_snippet silently returns 0 issues on .tsx/.jsx (no tsx/jsx in language enum)
Tool: analyze_code_snippet · Image: mcp/sonarqube:latest · CLI: v0.12.0
Bug
The language enum exposes ts and js but no tsx/jsx. Passing language: ["ts"] on JSX-containing content makes the TS analyzer bail without error and return {"issues":[],"issueCount":0}. CI (sonar-scanner) on the same project + same quality profile catches the issues correctly — so this is specific to the MCP snippet path.
Reproducer
Pure TS — works:
// language: ["ts"]
export const f = (a?: string, b?: boolean) => a ? (b ? 'x' : 'y') : 'z';
// → typescript:S3358 ✅
Same logic in TSX — silent zero:
// language: ["ts"]
import React from 'react';
const C = (p: { a?: string; b: boolean }) =>
<div>{p.a ? (p.b ? 'x' : 'y') : 'z'}</div>;
export default C;
// → {"issues":[],"issueCount":0} ❌ (expected: typescript:S3358)
Workaround is unreliable
language: ["js"] parses JSX and surfaces javascript:S3358 correctly, but the JS parser misreads TS generics — e.g. React.useRef<HTMLDivElement | null>(null) triggers a false javascript:S1764 ("identical sub-expressions on both sides of >"). Also: language: ["ts","js"] returns 0 issues (possible separate bug).
Requested fix (any of)
- Add
tsx/jsx to the language enum and route to the TS/JS analyzers with JSX parsing on.
- Have
["ts"] accept TSX (TypeScript parses TSX natively given the right flag).
- At minimum: return an error/diagnostic when the analyzer can't parse the snippet. The silent
{"issues":[],"issueCount":0} is the dangerous part — agents trust it and report the file as clean.
Impact
Every .tsx/.jsx file in React/Next/etc. codebases gets a false-clean result. High blast radius for agentic use.
analyze_code_snippetsilently returns 0 issues on.tsx/.jsx(notsx/jsxinlanguageenum)Tool:
analyze_code_snippet· Image:mcp/sonarqube:latest· CLI:v0.12.0Bug
The
languageenum exposestsandjsbut notsx/jsx. Passinglanguage: ["ts"]on JSX-containing content makes the TS analyzer bail without error and return{"issues":[],"issueCount":0}. CI (sonar-scanner) on the same project + same quality profile catches the issues correctly — so this is specific to the MCP snippet path.Reproducer
Pure TS — works:
Same logic in TSX — silent zero:
Workaround is unreliable
language: ["js"]parses JSX and surfacesjavascript:S3358correctly, but the JS parser misreads TS generics — e.g.React.useRef<HTMLDivElement | null>(null)triggers a falsejavascript:S1764("identical sub-expressions on both sides of>"). Also:language: ["ts","js"]returns 0 issues (possible separate bug).Requested fix (any of)
tsx/jsxto thelanguageenum and route to the TS/JS analyzers with JSX parsing on.["ts"]accept TSX (TypeScript parses TSX natively given the right flag).{"issues":[],"issueCount":0}is the dangerous part — agents trust it and report the file as clean.Impact
Every
.tsx/.jsxfile in React/Next/etc. codebases gets a false-clean result. High blast radius for agentic use.