My suggestion is to either expand the prefer-dom-node-text-content
rule (source) to also enforce .textContent
over .innerHTML
,
or implement a new no-inner-html
rule.
The motive for this is mainly because, in extension development such of Refined GitHub,
the use innerHTML
should always be avoided, otherwise it becomes flagged by the extension stores.
This came up in this PR comment refined-github/refined-github#4520 (comment)
As described in the comment above, such a rule, no-inner-html
, is already implemented in the eslint-plugin-lwc
plugin.
However, that rule disallows the use of 'innerHTML' in ALL its forms. This includes innerHTML
, outputHTML
and insertAdjacentHTML
Concluding, I was wondering whether it could be beneficial for XO,
to either expand the existing prefer-dom-node-text-content
rule against innerHTML
,
or incorporate that rule no-inner-html
as a whole.
foo.innerHTML = 'π¦';
// and maybe also
foo.outerHTML = 'π¦';
foo.insertAdjacentHTML = 'π¦';
foo.textContent = 'π¦';
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