13

I've been struggling with VSCode and JSHint to find out a way to get rid of this syntax highlighting. It seems like JSHint is not able to recognise Async/Await syntax.

Here you can find a screenshot of what I'm talking about.

enter image description here

My JSHint version: jshint-esnext v2.7.0-3

Pedram marandi
  • 1,474
  • 1
  • 19
  • 35
  • 3
    try to use `eslint` – chenkehxx Oct 17 '17 at 06:31
  • @DavidR tsconfig.json is irrelevant here. –  Oct 17 '17 at 06:32
  • I don't have any `tsconfig.json` – Pedram marandi Oct 17 '17 at 06:32
  • @chenkehxx What is the point with `eslint` in comparison with `JSHint`? – Pedram marandi Oct 17 '17 at 06:34
  • 2
    ESLint specifically supports most of the new ES features. It can be a bit slower, but it provides (imo) better feedback. It also supports JSX if you're into that. –  Oct 17 '17 at 06:36
  • 3
    Possible duplicate of [Does JSHint support the node 7 (async/await)?](https://stackoverflow.com/questions/42637630/does-jshint-support-the-node-7-async-await) -- I believe that thread answers the question, which, incidentally, has not much to do with visual studio editor, afaics – DPM Dec 04 '17 at 19:24
  • I'm also trying to get jshint-esnext to work with visual studio code. When I install jshint-esnext, visual studio does not find or use it. It is apparently only looking for the regular jshint. – jfriend00 Jan 09 '18 at 21:15

2 Answers2

26

In visual studio code, JSHint and ESLint cancels each other out. so if you want to use async functions in vscode then you have to disable Jshint and enable eslint instead.

Zinara Ozojie
  • 331
  • 4
  • 9
5

I had the same issue and this worked for me. Try using npm uninstall -g jshint to completely unistall jshint, then npm install -g jshint to re-install the latest version. Make sure your package.json has the following information in it:

"jshintConfig": { "esversion": 8, "strict": "implied", "devel": true, "node": true, "globals": {} }

cfrederi
  • 66
  • 1
  • 1