pbakaus/impeccable · error · Error
config.commentSyntax must be 'html' or 'jsx'
Error message
config.commentSyntax must be 'html' or 'jsx'
What it means
Thrown by validateConfig() in live-inject.mjs when cfg.commentSyntax is neither 'html' nor 'jsx'. The injector wraps the inserted snippet in a comment marker so it can find and remove it on cleanup; the two supported comment styles map to <!-- --> for HTML and {/* */} for JSX/TSX/Svelte. Any other value (including undefined, since the check has no default) is rejected.
Source
Thrown at skill/scripts/live-inject.mjs:469
if (!Array.isArray(cfg.files) || cfg.files.length === 0) {
throw new Error('config.files (non-empty string array) required');
}
if (!cfg.files.every((f) => typeof f === 'string' && f.length > 0)) {
throw new Error('config.files must contain only non-empty strings');
}
if (cfg.exclude !== undefined) {
if (!Array.isArray(cfg.exclude)) {
throw new Error('config.exclude, if present, must be a string array');
}
if (!cfg.exclude.every((f) => typeof f === 'string' && f.length > 0)) {
throw new Error('config.exclude must contain only non-empty strings');
}
}
if (typeof cfg.insertBefore !== 'string' && typeof cfg.insertAfter !== 'string') {
throw new Error('config.insertBefore or config.insertAfter (string) required');
}
if (cfg.commentSyntax !== 'html' && cfg.commentSyntax !== 'jsx') {
throw new Error("config.commentSyntax must be 'html' or 'jsx'");
}
if (cfg.cspChecked !== undefined && typeof cfg.cspChecked !== 'boolean') {
throw new Error("config.cspChecked, if present, must be a boolean");
}
}
// ---------------------------------------------------------------------------
// Auto-execute
// ---------------------------------------------------------------------------
const _running = process.argv[1];
if (_running?.endsWith('live-inject.mjs') || _running?.endsWith('live-inject.mjs/')) {
enterLiveRoot();
injectCli();
}
// Re-exported so long-standing importers (live.mjs, the adapter modules, the
// test suites) keep their entry points while the implementations live inView on GitHub (pinned to d14711ae3d)
Solutions
- Set 'commentSyntax' to 'html' for .html/.astro templates or 'jsx' for .jsx/.tsx/.svelte files.
- If targeting mixed file types, split into two configs (one per commentSyntax) since a single config supports only one style.
- Double-check spelling and casing — only the exact lowercase tokens 'html' and 'jsx' pass.
Example fix
// before "commentSyntax": "HTML" // after "commentSyntax": "html"
Defensive patterns
Strategy: validation
Validate before calling
if (!['html', 'jsx'].includes(cfg.commentSyntax)) {
throw new Error(`commentSyntax must be 'html' or 'jsx', got ${JSON.stringify(cfg.commentSyntax)}`);
} Type guard
function isCommentSyntax(v: unknown): v is 'html' | 'jsx' {
return v === 'html' || v === 'jsx';
} Prevention
- Pin commentSyntax explicitly in every config — never rely on a default.
- Split mixed file-type targets into one config per commentSyntax.
- Use lowercase literal tokens only; treat any tool that uppercases them as buggy.
When it happens
Trigger: validateConfig runs on a config whose 'commentSyntax' is missing, misspelled ('JSX', 'HTML', 'tsx', 'svelte'), or set to an unsupported value like 'css'.
Common situations: User omits commentSyntax assuming a default; uses uppercase variant; targets .svelte/.astro files and guesses 'svelte'; upgrades the tool and a previously-lenient value is now strict.
Related errors
- config.json must be an object
- config.files (non-empty string array) required
- config.files must contain only non-empty strings
- config.exclude, if present, must be a string array
- config.exclude must contain only non-empty strings
AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13).
Data as JSON: /api/errors/4c05b321b9154e69.
Report an issue: GitHub.