0

我确实收到了一个standardJs lint 错误

/lib/with-apollo-client.js:7:24: Parsing error: Unexpected token =

对于这个片段,它来自https://github.com/zeit/next.js/blob/canary/examples/with-apollo/lib/with-apollo-client.js

import initApollo from './init-apollo'
import Head from 'next/head'
import { getDataFromTree } from 'react-apollo'

export default (App) => {
  return class Apollo extends React.Component {
    static displayName = 'withApollo(App)' // <-
    static async getInitialProps (ctx) {
    // ...
    }
  }
}

那有什么问题?我正在使用standardJs 11.0.1

4

1 回答 1

0

我相信这是因为你不能在没有转换的情况下以这种方式定义类属性:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Instance_properties

于 2018-08-16T08:25:59.640 回答