[英]jshint javascript error - Expected ')' to match '{' from line n and instead saw 'response'. (E020)
I am following the SPA tutorial at Build a JavaScript Single Page App Without a Framework 我正在遵循在没有框架的情况下构建JavaScript单页应用程序中的SPA教程
I have the below code in my server.js file, and it is giving an error: 我的server.js文件中包含以下代码,并且出现错误:
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)
[jshint]“期望')'与第15行的'{'相匹配,而看到了'response'(E020)
another error I am getting (on the same line) is: 我得到的另一个错误(在同一行上)是:
[jshint] "Expected an identifier and instead saw '='. (E030)
[jshint]“期望标识符,而看到了'='。(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
我已经搜索了错误,然后找到了:JS:如何修复“ Expected')'以匹配第4行的'(',而是看到'='。” JSLint错误
which didn't really help... 并没有真正的帮助...
so what can I do in my project, or in that code to resolve this? 那么我可以在我的项目中或该代码中解决该问题吗?
尝试将以下内容添加到工作场所设置
{ "jshint.options": { "esversion": 6 } }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.