Coffeelint 说我有隐式 parens?

Coffeelint says I have implicit parens?

Coffeelint 告诉我我有隐式 parens。我正在尝试找出导致此错误的原因。

#309: Implicit parens are forbidden.

这是我的代码:

((factory) ->
  if typeof module == 'object' and module.exports
    module.exports = factory
  else
    factory(Highcharts)
  return
)(Highcharts) ->
...
  if seriesTypes.map
    seriesTypes.map::exportKey = 'name'
  if seriesTypes.mapbubble
    seriesTypes.mapbubble::exportKey = 'name'
  if seriesTypes.treemap
    seriesTypes.treemap::exportKey = 'name'
  return
###The entire block over code is one function.

有人试一试吗?

我认为您的代码存在问题。查看生成的JS:

(function(factory) {
  if (typeof module === 'object' && module.exports) {
    module.exports = factory;
  } else {
    factory(Highcharts);
  }
})(Highcharts)(function() {
  ...
});

作为第一个函数 returns undefined 尝试将 undefined 作为函数调用时出错。

实际上 no_implicit_parens 用于:

# This rule prohibits implicit parens on function calls.

# Some folks don't like this style of coding.
myFunction a, b, c

# And would rather it always be written like this:
myFunction(a, b, c)

启用此选项后,您必须将任何函数调用的任何参数列表括起来。
要使您的代码正常工作,您可以执行以下操作:

((factory) ->
  ...
)(Highcharts(->
  ...
))

回调函数周围的这些括号起到了作用。但正如我所说,我确定您的代码存在问题,而修复实际上对我来说没有多大意义:)