jshint javascript error - Expected ')' to match '{' from line n and instead saw 'response'. (E020)

2.2k Views Asked by At

I am following the SPA tutorial at Build a JavaScript Single Page App Without a Framework

I have the below code in my server.js file, and it is giving an error:

const get = async (url) => {
  const response = await api.get(url);
  const { data } = response;
  if (data.success) {
    return data;
  }
  throw new Error(data.error.type);
};

the error I am getting is:

[jshint] "Expected ')' to match '{' from line 15 and instead saw 'response'. (E020)

another error I am getting (on the same line) is:

[jshint] "Expected an identifier and instead saw '='. (E030)

at the top of the file I have tried:

/*jshint esversion: 6 */

and

"ecmaVersion: 8";

so what is wrong here? I have searched for the error and found SO: JS: How to fix “Expected ')' to match '(' from line 4 and instead saw '='.” JSLint error

which didn't really help...

so what can I do in my project, or in that code to resolve this?

1

There are 1 best solutions below

0
On

Try adding the below to workplace SETTINGsettings

{
  "jshint.options": {
    "esversion": 6
  }
}