将箭头语法与异步结合使用时,ESLint解析错误 [英] ESLint parsing error when using arrow syntax with async
本文介绍了将箭头语法与异步结合使用时,ESLint解析错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用ESLint分析我的代码。代码运行正常,但是我从 eslint
收到此错误:
I'm using ESLint to analyze my code. The code runs fine, but I get this error from eslint
:
[eslint] Parsing error: Unexpected token t
(parameter) t: any
test.serial('set: Handles save error', async t => {
// function definition
});
这是 .eslintrc.js
module.exports = {
extends: 'google',
parserOptions: {
ecmaVersion: 6
}
};
推荐答案
异步
/ 等待
是ECMAScript 2017功能,因此,如果更改 ecmaVersion:8
而不是6,则应该工作!
async
/await
is an ECMAScript 2017 feature, so if you change ecmaVersion: 8
instead of 6, this should work!
这篇关于将箭头语法与异步结合使用时,ESLint解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文