Home  >  Q&A  >  body text

javascript - eslint configures WeChat applet using co function*

co(function* () {
      let wxUser = yield STORAGE.get(STORAGE.wxUserInfo);
})

The above code reports an error

[eslint] Unexpected unnamed generator function. (func-names)


How to configure the .eslintrc.js file

曾经蜡笔没有小新曾经蜡笔没有小新2684 days ago984

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-19 10:13:21

    func-names Requires functions to have names, anonymous functions are not allowed. So just give the function a name. Such as:

    co(function * test() {
      // func body
    })

    Attached document address: http://eslint.org/docs/rules/...

    reply
    0
  • Cancelreply