mozilla / eslint-plugin-no-unsanitized

Custom ESLint rule to disallows unsafe innerHTML, outerHTML, insertAdjacentHTML and alike
Mozilla Public License 2.0
222 stars 33 forks source link

Fix error when `node.init` is `null` #189

Closed willdurand closed 2 years ago

willdurand commented 2 years ago

Fixes #188


This PR fixes the issue reported in #188 by checking that node.init is valid before using it. From there, I added two test cases and the code basically told me where to put them (i.e. valid or invalid lists).

mozfreddyb commented 2 years ago

Asking @rpl for a second pair of eyes, as Luca is usually spotting the things that I miss :-)

willdurand commented 2 years ago

PR updated, sorry for the delay!