这是我的 .eslintrc
{
"plugins": ["react"],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"es6": true,
"browser": true,
"node": true,
"mocha": true
},
"extends": ["eslint:recommended", "plugin:react/recommended", "standard"],
"rules": {}
}
这是我的组件:
class Index extends React.Component {
static async getInitialProps({ req }) {
....
}
}
Eslint 抱怨 getInitialProps:
Parsing error: Unexpected token getInitialProps
除了添加抑制注释之外,还有什么方法可以让 eslint 接受 getInitialProps 声明?