Code using appendChild
on a Node should not be autofixed to use append
. I think this can be improved by using type information and only raising an issue when (or at the very least not autofixing unless) it is known to be an Element.
This relates to #347
These are currently working fine and should still work
const foo = (element: Element, htmlElement: HTMLElement) => {
element.appendChild(node)
htmlElement.appendChild(node)
}
document.getElementsByName("name")[0]?.appendChild(document.createTextNode("foo"))
const foo = (node: Node, childNode: ChildNode, untyped, element: Element) => {
node.appendChild(node) // Current false positive
childNode.appendChild(node) // Current false positive
childNode.appendChild(node) // Current false positive
element.append(node)
}
document.body.childNodes[0]?.appendChild(document.createTextNode("foo")) // Current false positive
These examples are oversimplified just to get the right type.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too