https://lists.mozilla.org/pipermail/dev-platform/2019-May/024045.html is relevant to this bug.
On the topic of HTML parsing, I don't know if we need to have the parser in JS. It could be in some other language (e.g. rust), as long as it can somehow pass the JS bits to the JS analyzer. Presumably it wouldn't be too hard to take html5ever and write a wrapper around it such that when fed a (X)HTML file, it just strips away all the non-JS stuff and leaves the JS stuff at the same line/column numbers as in the original file, which we can then feed to the js analyzer.
I suspect using a rust HTML parser will be faster than a JS parser, but I could be wrong. I don't know how the state of the art implementations compare in terms of speed. And performance will matter here, because we're talking about parsing thousands of files.