I just tried using eslint while writing front-end javascript. For some reason, I keep getting error flags on things that aren't really there. Eg, when I use
document.getElementById, I get a missing semi colon error, right in the middle of
document.getElementById. Is there something I'm missing as far as properly configuring eslint for client side code? I've even added "browser": true
to the env of the eslint config file.
I've generally found that even the recommendations made my linters are utter and complete NONSENSE. Out of box they universally check for so much crap that has NOTHING to do with whether the code is good or not, I cannot grasp why anyone would put up with it. Once configured to not report all the idiotic garbage and bad advice, they no longer actually DO anything.
It's like the inverse of turning off all the things the CSP blocks by default -- end result being at that point you're not even using it.
If we could see the code in question we could probably tell you exactly where it's going bits-up face-down, but on the whole my advice when it comes to linters is to forget it. They're full of s* and do nothing but fudge-pack the 'true believers' out there.
What specific part of the checks it does is it reporting that semi-colon under? It SHOULD be saying which of the flags in the configuration is detecting a problem. If you insist on trying to use eslint, that would be the place to start; though dimes to dollars it's something earlier in the code that's causing the linter to fail.
Ben Buchanan (200ok)
I make some bits of the web.
Some implementations get a bit weird about how they report the error - it is probably a missing semicolon from the preceding code block (ie. a few lines above the location it's reporting). Try running the same code through another instance of eslint, eg. eslint.org/demo to see if you get the same error. Plus do a manual check through the preceding code block to see if you can spot it yourself.