神秘的ESLint解析错误 [英] Mysterious ESLint Parsing Error
本文介绍了神秘的ESLint解析错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在下面的代码的第4行,ESLint给我一个解析错误:
On line 4 of the following code, ESLint is giving me a parsing error saying:
意外的令牌=
Unexpected token =
我想知道为什么会这样吗?该代码可以正常运行。我在做什么错了?
I'm wondering why this is the case? The code runs properly. What am I doing wrong?
import { Component, PropTypes } from 'react';
export default class MainApp extends Component {
static propTypes = {
children: PropTypes.any.isRequired
}
componentWillMount() {
require('./styles/main.styl');
}
render() {
return (
<div>
{this.props.children}
</div>
);
}
}
推荐答案
您
参考: http://www.2ality.com/2015/02/es6-classes-final.html#inside_the_body_of_a_class_definition
这篇关于神秘的ESLint解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文