murashit_codex-panel/scripts/lint/no-implicit-dom-bridges.grit
2026-06-27 12:44:16 +09:00

57 lines
2.2 KiB
Text

language js
or {
`$target.createElement($...)` as $stmt,
`$target.createTextNode($...)` as $stmt,
`$target.createEl($...)` as $stmt,
`$target.createDiv($...)` as $stmt,
`$target.createSpan($...)` as $stmt,
`$target.empty()` as $stmt,
`$target.append($...)` as $stmt,
`$target.prepend($...)` as $stmt,
`$target.before($...)` as $stmt,
`$target.after($...)` as $stmt,
`$target.appendChild($...)` as $stmt,
`$target.insertBefore($...)` as $stmt,
`$target.replaceChildren($...)` as $stmt,
`$target.remove()` as $stmt,
`$target.insertAdjacentHTML($...)` as $stmt,
`$target.setAttribute($...)` as $stmt,
`$target.setAttr($...)` as $stmt,
`$target.addClass($...)` as $stmt,
`$target.removeClass($...)` as $stmt,
`$target.toggleClass($...)` as $stmt,
`$target.setText($...)` as $stmt,
`$target.classList.add($...)` as $stmt,
`$target.classList.remove($...)` as $stmt,
`$target.classList.toggle($...)` as $stmt,
`$target.addEventListener($...)` as $stmt,
`$target.removeEventListener($...)` as $stmt,
`$target.querySelector($...)` as $stmt,
`$target.querySelectorAll($...)` as $stmt,
`$target.closest($...)` as $stmt,
`$target.contains($...)` as $stmt,
`$target.getBoundingClientRect()` as $stmt,
`$target.focus($...)` as $stmt,
`$target.select()` as $stmt,
`$target.setSelectionRange($...)` as $stmt,
`$target.setCssProps($...)` as $stmt,
`$target.scrollHeight` as $stmt,
`$target.scrollWidth` as $stmt,
`$target.clientHeight` as $stmt,
`$target.clientWidth` as $stmt,
`$target.offsetTop` as $stmt,
`$target.offsetHeight` as $stmt,
`$target.selectionStart` as $stmt,
`$target.selectionEnd` as $stmt,
`$target.selectionDirection` as $stmt,
`$target.activeElement` as $stmt,
`$target.ownerDocument` as $stmt,
`$target.defaultView` as $stmt,
`$target.style.$property` as $stmt
} where {
not { $filename <: r".*\.(?:dom|obsidian|measure)\.tsx?$" },
not { $stmt <: `$target.addEventListener("abort", $...)` },
not { $stmt <: `$target.removeEventListener("abort", $...)` },
register_diagnostic(span=$stmt, message="Keep DOM reads, writes, measurements, hit-tests, focus, and event wiring in files named with a .dom, .obsidian, or .measure suffix.", severity="error")
}