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 for onerror treat source, lineno, colno, and error as defined) (but don't treat them as unused if they are not used).
- Allow
this
- Allow a return value
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
* See -https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Event_handlers#Event_handlers_parameters_this_binding_and_the_return_value
And thanks for the great plugin!
Description
Inline event handlers such as
onloadcan contain JavaScript. These may contain errors or one may not want these handlers at all.It would be great if
eslint-plugin-html:eventas defined (and foronerrortreatsource,lineno,colno, anderroras defined) (but don't treat them as unused if they are not used).thisAlternatives
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
innerHTMLusage.)There was at one point a Firefox add-on for detecting inline handlers, but this is not automated.
Additional context
* See -https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Event_handlers#Event_handlers_parameters_this_binding_and_the_return_value
And thanks for the great plugin!