Open
Description
Description
Inline event handlers such as onload
can contain JavaScript. These may contain errors or one may not want these handlers at all.
It would be great if eslint-plugin-html
:
- Could expose their content to linting
- Could provide its own rule to optionally flag against any use of inline event handlers
- Could tweak rules such that it is recognized these handlers (effectively?) run within a function:*
- For all inline event handlers treat
event
as defined (and foronerror
treatsource
,lineno
,colno
, anderror
as defined) (but don't treat them as unused if they are not used). - Allow
this
- Allow a return value
- For all inline event handlers treat
Alternatives
Allow bad code within HTML. (A particular concern is the likes of https://github.com/mozilla/eslint-plugin-no-unsanitized not being able to find innerHTML
usage.)
There was at one point a Firefox add-on for detecting inline handlers, but this is not automated.
Additional context
And thanks for the great plugin!