简体   繁体   English

jshint javascript错误-预期')'与第n行的'{'相匹配,而出现了'response'。 (E020)

[英]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.

相关问题 期望')'与第0行的'('相匹配,而改为看到'text' - Expected ')' to match '(' from line 0 and instead saw 'text' Javascript:JSHint:需要一个赋值或函数调用,而是看到一个表达式 - Javascript: JSHint: Expected an assignment or function call and instead saw an expression JS:如何修复“ Expected')'以匹配第4行中的'(',而是看到'='。” JSLint错误 - JS: How to fix “Expected ')' to match '(' from line 4 and instead saw '='.” JSLint error JSHint错误:预期分配或函数调用,而是看到一个表达式 - JSHint error: Expected an assignment or function call and instead saw an expression JSHint 错误 - 需要赋值或函数调用,而看到的是表达式 - JSHint error - Expected an assignment or function call and instead saw an expression JSHint - 期望一个条件表达式,而不是看到一个赋值 - JSHint -Expected a conditional expression and instead saw an assignment javascript错误:预期为“ html”,而是显示为“ script” - javascript error: Expected 'html' and instead saw 'script' JavaScript错误:需要标识符,而看到了'}' - Javascript Error: Expected an identifier and instead saw '}' 三元运算符在JSHint中显示错误-预期分配或函数调用,而是看到一个表达式 - Ternary operator displays error in JSHint - Expected an assignment or function call and instead saw an expression JsHint:“期望分配或函数调用,而是看到一个表达式”,Switch语句 - JsHint: “Expected an assignment or function call and instead saw an expression”, Switch statement
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM