如何使用Visual Studio代码根据babel/ES7 stage-0规则lint JavaScript文件?
我只需要lint代码.我已经有webpack转换Js文件了.
当我尝试在打字稿中使用传播时,例如:
.reduce((unique, x) => {
unique.some(element => element.machineName === x.machineName) ? unique : [...unique, x];
}
Run Code Online (Sandbox Code Playgroud)
我收到红色标记的警告Visual Studio Code:
the syntax requires an imported helper named __spreadArrays
typescript version: "2.3.4"
target: "es5"
Run Code Online (Sandbox Code Playgroud)
我认为在以后的版本中这个问题是固定的,但现在我无法迁移。我该如何解决?
注意:项目编译得很好并且工作正常。但红色的底层VS Code在烦人。
I opened a js file with ES7 property initializers and am getting squiggly lines:
class AppContainer extends Component {
static propTypes = {
history: PropTypes.object.isRequired,
routes: PropTypes.object.isRequired,
store: PropTypes.object.isRequired
}
Run Code Online (Sandbox Code Playgroud)
The error says:
[js] 'property declarations' can only be used in a .ts file.
Run Code Online (Sandbox Code Playgroud)
I am curious how to fix this, of course. But I am more curious how to debug what is giving this error? This is one of the more frustrating parts of some editors, understanding what is …