Skip to content

noAstroSetHtmlDirective (JavaScript)

biome.json
{
"linter": {
"rules": {
"nursery": {
"noAstroSetHtmlDirective": "error"
}
}
}
}

Disallow the use of Astro’s set:html directive.

set:html renders HTML without escaping it. Using set:html can introduce cross-site scripting vulnerabilities. When raw HTML is required, sanitize the value before passing it to set:html, then suppress the diagnostic with an explanation.

{show && <span set:html={content} />}
{show && <span>{content}</span>}