If ESLint reports Uncaught SyntaxError: Unexpected token
for an empty line or for a character which does not violate any linting rule, there may be a conflict between multiple ESLint instances.
For example, I received the Unexpected token
error for an RxJS Observable which had nothing wrong with it. The reason turned out to be that I had the eslint
and babel-eslint
libraries running on it, whereas my IDE (VSCode) already used the eslint
extension as well.
I opted to disable the native extension in VSCode. The error vanished and linting ran as expected.