node.js - jshint error when using template strings in VSCode -
i'm using visual studio code (1.6.1) jshint extension (0.10.15).
when type template string, such as:
console.log(`my name is: ${name}`);
vscode highlights in red , says:
[jshint] unexpected '`'. (e024)
and rest of code starts showing dozens of false errors like:
[jshint] expected identifier , instead saw 'if'. (e030) [jshint] expected operator , instead saw '('. (e030) [jshint] expected assignment or function call , instead saw expression. (w030)
i've looked in docs, nothing references issue.
anyone come workaround this?
it seems jshint not recognicing es6.
can try set esversion
6
in jshint options?
i using visual studio code 1.7.1, jshint extension 0.10.15. without .jshintrc
got message:
[jshint] 'template literal syntax' available in es6 (use 'esversion: 6'). (w119)
i created .jshintrc
file content:
{ "esversion": 6 }
and worked.
note jshint module might required (globally or locally), can automatically added package.json
doing:
npm install --save-dev jshint
this installs jshint locally (in node_modules
folder) , adds dev dependency entry:
"devdependencies": { "jshint": "^2.9.4" }
note restart of vs code may required, after installing module or extension.
Comments
Post a Comment