Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSHint does not recognise Async/Await syntax in Visual Studio Code (VSCode)

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

like image 418
Pedram marandi Avatar asked Oct 17 '17 06:10

Pedram marandi


People also ask

How do I enable Jshint in Vscode?

In order to disable jshint for a workspace specify "jshint. enable" : false in the workspace settings. jshint is enabled by default.

What is Jshint library?

JSHint is a program that flags suspicious usage in programs written in JavaScript. The core project consists of a library itself as well as a CLI program distributed as a Node module.

Can I use async await instead of promises?

Async/Await is used to work with promises in asynchronous functions. It is basically syntactic sugar for promises. It is just a wrapper to restyle code and make promises easier to read and use. It makes asynchronous code look more like synchronous/procedural code, which is easier to understand.

Does await work with promise?

The await operator is used to wait for a Promise and get its fulfillment value. It can only be used inside an async function or a JavaScript module.


1 Answers

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.

like image 198
Zinara Ozojie Avatar answered Sep 23 '22 23:09

Zinara Ozojie