microsoft / vscode-eslint

VSCode extension to integrate eslint into VSCode
MIT License
1.75k stars 336 forks source link

Unexpected token in Eslint Plugin, eslint command works fine #694

Closed jayshah123 closed 5 years ago

jayshah123 commented 5 years ago

Vscode version: 1.25.1 Eslint plugin version: 1.4.12 Node version: v8.11.3 Mac Os: High Sierra I tried to update Eslint plugin version to 1.9.0 but even after install it remains 1.4.12. I tried to update VSCode itself, but it says no updates available.

In package.json

    "eslint": "^5.16.0",
    "babel-eslint": "^10.0.1",

Eslint terminal output window:

[Error - 15:40:33] /Users/jay.shah/Documents/vortal-xdk/node_modules/eslint-plugin-node/lib/configs/recommended-module.js:7
        ...commonGlobals,
        ^^^
SyntaxError: Unexpected token ...
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/jay.shah/Documents/vortal-xdk/node_modules/eslint-plugin-node/lib/index.js:6:31)
[Trace - 15:40:33] Received notification 'eslint/status'.
Params: {
    "state": 3
}
dbaeumer commented 5 years ago

This is caused by the fact that the plugin uses a JS construct which is not supported yet by electron node. You can use the setting eslint.runtime to point to a never version of node that supports that feature.

jayshah123 commented 5 years ago

eslint.runtime is an Unknown configuration setting in VSCode settings. eslint.nodePath was a valid configuration setting but issue still persists after updating eslint.nodePath to point to node v10.6.0 @dbaeumer

jayshah123 commented 5 years ago

Finally, I just downloaded vscode 1.35.1 and it uses eslint extension version 1.9.0 where issue no longer occurs.