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: normalizeMethodCall should expect a CallExpression node #177

Closed rpl closed 2 years ago

rpl commented 2 years ago

We do already expect "ArrowFunctionExpression" in normalizeMethodCall, and so it seems reasonable to also expect "CallExpression" (and return an empty method name as we are doing for the "ArrowFunctionExpression").

At the moment code like the one in the test case is triggering the additonal linting issue that we log for unexpected cases we would like to be reported as new issue in this repo.

rpl commented 2 years ago

@mozfreddyb I did notice this while I was giving one last review pass to #169 (it was triggered by the Grammarly extension attached to mozilla/addons/issues#1263). Given that it isn't a new issue introduced by the changes from #169, I opted to create a separate pull request with a new test case and a proposed one line fix.