mozilla / eslint-plugin-no-unsanitized

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

Fixing Issue #122: unexpected callee AwaitExpression #123

Closed mozfreddyb closed 4 years ago

mozfreddyb commented 4 years ago

WIP as mentioned in #122

mozfreddyb commented 4 years ago

Note:

This should be disallowed:

await foo.insertAdjacentHTML("afterend", blah)

and it would also be disallowed if the AwaitExpression is being called:

await foo.insertAdjacentHTML("afterend", blah)

but this should be allowed:

function TheRuleDoesntKnowWhatIsBeingReturnedHere() { 
  return new Promise(function() { resolve(foo.insertAdjacentHTML) } 
});
(await TheRuleDoesntKnowWhatIsBeingReturnedHere())('afterend', blah)
mozfreddyb commented 4 years ago

@rpl do you think you could review?

rpl commented 4 years ago

@rpl do you think you could review?

@mozfreddyb sorry for the lagtime, I've been on PTO last week and got back today. I'll take a look to this pull request asap