{"record":{"id":"d671937824c64e01","repo":"pbakaus/impeccable","slug":"config-commentsyntax-must-be-html-or-jsx","errorCode":null,"errorMessage":"config.commentSyntax must be 'html' or 'jsx'","messagePattern":"config\\.commentSyntax must be 'html' or 'jsx'","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugin/skills/impeccable/scripts/live-inject.mjs","lineNumber":469,"sourceCode":"  if (!Array.isArray(cfg.files) || cfg.files.length === 0) {\n    throw new Error('config.files (non-empty string array) required');\n  }\n  if (!cfg.files.every((f) => typeof f === 'string' && f.length > 0)) {\n    throw new Error('config.files must contain only non-empty strings');\n  }\n  if (cfg.exclude !== undefined) {\n    if (!Array.isArray(cfg.exclude)) {\n      throw new Error('config.exclude, if present, must be a string array');\n    }\n    if (!cfg.exclude.every((f) => typeof f === 'string' && f.length > 0)) {\n      throw new Error('config.exclude must contain only non-empty strings');\n    }\n  }\n  if (typeof cfg.insertBefore !== 'string' && typeof cfg.insertAfter !== 'string') {\n    throw new Error('config.insertBefore or config.insertAfter (string) required');\n  }\n  if (cfg.commentSyntax !== 'html' && cfg.commentSyntax !== 'jsx') {\n    throw new Error(\"config.commentSyntax must be 'html' or 'jsx'\");\n  }\n  if (cfg.cspChecked !== undefined && typeof cfg.cspChecked !== 'boolean') {\n    throw new Error(\"config.cspChecked, if present, must be a boolean\");\n  }\n}\n\n// ---------------------------------------------------------------------------\n// Auto-execute\n// ---------------------------------------------------------------------------\n\nconst _running = process.argv[1];\nif (_running?.endsWith('live-inject.mjs') || _running?.endsWith('live-inject.mjs/')) {\n  enterLiveRoot();\n  injectCli();\n}\n\n// Re-exported so long-standing importers (live.mjs, the adapter modules, the\n// test suites) keep their entry points while the implementations live in","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/plugin/skills/impeccable/scripts/live-inject.mjs#L451-L487","documentation":"Seventh validateConfig() check: cfg.commentSyntax must be exactly 'html' or 'jsx'. This selects how insertTag/removeTag wrap the live script (<!-- ... --> vs {/* ... */}). No default is applied — the field is mandatory. Any other value (including 'HTML', 'js', '') throws.","triggerScenarios":"\"commentSyntax\": \"js\"; \"HTML\" (wrong case); \"ts\"; \"\"; missing key (undefined !== 'html' && !== 'jsx' -> throws). The match is strict equality, no normalisation.","commonSituations":"User typed uppercase or abbreviated; setup wizard wrote the wrong value; config ported from a project that used a different convention; key omitted entirely because docs didn't stress it's required.","solutions":["Set commentSyntax to 'html' for .html/.astro static files, or 'jsx' for JSX/TSX where {/* */} comments are valid.","Re-run setup to auto-detect the correct value for your entry points.","If your project mixes both, pick the syntax valid in the tagged files; the injector applies the same commentSyntax to all files in config.files.","Run `node live-inject.mjs --check` to confirm."],"exampleFix":"// before\n{ \"commentSyntax\": \"js\", ... }\n\n// after\n{ \"commentSyntax\": \"jsx\", ... }","handlingStrategy":"validation","validationCode":"function isValidCommentSyntax(cfg) {\n  return cfg?.commentSyntax === 'html' || cfg?.commentSyntax === 'jsx';\n}\nif (!isValidCommentSyntax(cfg)) {\n  cfg.commentSyntax = entryPointsLookLikeJsx ? 'jsx' : 'html';\n}","typeGuard":"/** Narrow to the two valid comment-syntax literals. */\nfunction isCommentSyntax(value) {\n  return value === 'html' || value === 'jsx';\n}","tryCatchPattern":"try {\n  validateConfig(cfg);\n} catch (err) {\n  if (/commentSyntax must be/.test(err.message)) {\n    cfg.commentSyntax = 'html';\n    validateConfig(cfg);\n  }\n  throw err;\n}","preventionTips":["Use 'html' for .html/.astro, 'jsx' for files where {/* */} is the only valid comment.","The field is case-sensitive lowercase — no 'HTML' or 'JSX'.","Pick the syntax that's valid across all files in config.files; the value is shared."],"tags":["live-inject","config","validation","json"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}