首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JS: Lint错误:意外的标记=

JS: Lint错误:意外的标记=
EN

Stack Overflow用户
提问于 2018-08-16 16:21:33
回答 1查看 176关注 0票数 0

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

代码语言:javascript
复制
/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

代码语言:javascript
复制
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

EN

回答 1

Stack Overflow用户

发布于 2018-08-16 16:26:00

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

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51872628

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档