箭头函数语法(=>)'仅在ES6中可用(使用'esversion:6') [英] arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6')
本文介绍了箭头函数语法(=>)'仅在ES6中可用(使用'esversion:6')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
'arrow当前我正在使用量角器/ grunt运行我的测试,但是我收到以下错误消息:函数语法(=>)'仅在ES6中可用(使用'esversion:6')。
我认为我的 .jshintrc 文件没有被读取,
$ b .jshintrc
esversion:6
}
Gruntfile.js
jshint:{
all:[tests / API / ** / * .js],
选项:{
undef:true,
mocha:true,
node:true,
jshintrc:true,
esversion: 6,
globals:{
要求:true,
模块:true,
console:true,
esversion:6,
}
},
ui:[tests / UI / ** / *。js],
options:{
undef:true,$ b $ m mocha:true,
node:true,
jshintrc:true,
esversion:6,
globals:{
require:true,
module:true,
console:true ,
esversion:6,
jshintrc:true,
}
}
}
$ c
$ b 任何想法都可以解决这个问题吗?
解决方案
<$ c $ 我可以通过在每个file.js顶部添加代码块来解决此问题。 c> / * jshint esversion:6 * /
示例: p>
Currently I'm running my tests with protractor/grunt but I'm getting the follow error message:
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
I think my .jshintrc file is not being read, because I've added this condition.
.jshintrc
{
"esversion": 6
}
Gruntfile.js
jshint : {
all: ["tests/API/**/*.js"],
options: {
undef: true,
mocha: true,
node: true,
jshintrc: true,
esversion: 6,
globals: {
require: true,
module: true,
console: true,
esversion: 6,
}
},
ui: ["tests/UI/**/*.js"],
options: {
undef: true,
mocha: true,
node: true,
jshintrc: true,
esversion: 6,
globals: {
require: true,
module: true,
console: true,
esversion: 6,
jshintrc: true,
}
}
}
Any idea to solve this problem?
解决方案
I was able to resolve this issue by adding this block of code at the top of each file.js that accused the error
/*jshint esversion: 6 */
Example:
这篇关于箭头函数语法(=>)'仅在ES6中可用(使用'esversion:6')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文