react-no-danger-with-children
NOTE: this rule is included the following rule sets:
reactfreshEnable full set in
deno.json:{
"lint": {
"rules": {
"tags": ["react"] // ...or "fresh"
}
}
}Enable full set using the Deno CLI:
deno lint --rules-tags=react # or ... deno lint --rules-tags=fresh
This rule can be explictly included to or excluded from the rules present in the current tag by adding it to the
include or exclude array in deno.json:{
"lint": {
"rules": {
"include": ["react-no-danger-with-children"],
"exclude": ["react-no-danger-with-children"]
}
}
}Using JSX children together with dangerouslySetInnerHTML is invalid as they
will be ignored.
Invalid:
<div dangerouslySetInnerHTML={{ __html: "<h1>hello</h1>" }}>
<h1>this will never be rendered</h1>
</div>;
Valid:
<div dangerouslySetInnerHTML={{ __html: "<h1>hello</h1>" }} />;