no-use-event-handler-attr
Warn when specifying the event handler attribute.
❌ Examples of incorrect code for this rule
<div onclick="() => doSomething()">Click</div>
✅ Examples of correct code for this rule
<div id="foo">Click</div>
<script>
document.getElementById('foo').addEventListener('click', () => doSomething());
</script>
Interface
{
"no-use-event-handler-attr": boolean
}
Options
{
"no-use-event-handler-attr": {
"options": {
"ignore"?: string | string[]
}
}
}
Property | Type | Default Value | Description |
---|---|---|---|
ignore | string | | undefined | Specify the event handler to ignore as string or string array. It accepts even in a regex format. |
Default Severity
warning