Coffeescript 咖啡脚本+;jshint=未使用的变量:\u此

Coffeescript 咖啡脚本+;jshint=未使用的变量:\u此,coffeescript,jshint,Coffeescript,Jshint,使用bare=false编译任何代码,并使用JShint 导致未使用变量:\u此 解决方案? bare=true应保留, 此外,我很高兴有jshint检查未使用的变量。我只是想要一个例外 顺便说一下,我也得到了 Move the invocation into the parens that contain the function. }).call(this); 为什么要通过jshint运行用Coffeescript编写的东西?jshint不应该与手写javascript一起使用吗 如果你

使用
bare=false编译任何代码,并使用
JShint

导致
未使用变量:\u此

解决方案?
bare=true
应保留,
此外,我很高兴有
jshint
检查未使用的变量。我只是想要一个例外


顺便说一下,我也得到了

Move the invocation into the parens that contain the function.
}).call(this);

为什么要通过jshint运行用Coffeescript编写的东西?jshint不应该与手写javascript一起使用吗

如果你真的想用皮棉工具,为什么不使用呢

最后,这与此处非常相似,此处被关闭,因为它不是一个真正的问题。

如果您真的想通过JSHint运行生成的JS,您可以传递忽略此警告,如下所示:

###jshint node: true, unused: false ###
编译成

/*jshint node: true, unused: false */
我在面向浏览器的Coffeescript项目中使用以下内容

// be sure to turn off 'devel' before shipping.
{
  "devel": true,
  "bitwise": true,
  "boss": true,
  "browser": true,
  "camelcase": true,
  "curly": true,
  "eqeqeq": true,
  "eqnull": true,
  "es3": false,
  "esnext": true,
  "forin": false,
  "freeze": true,
  "immed": true,
  "indent": 2,
  "jquery": true,
  "latedef": true,
  "newcap": true,
  "noarg": true,
  "noempty": true,
  "nonbsp": true,
  "nonew": true,
  "plusplus": false,
  "quotmark": "double",
  "strict": false,
  "trailing": true,
  "undef": true,
  "unused": false,
  "predef": ["jQuery", "console"]
}

为什么你在问题中同时提到了bare和bare?打字错误<代码>--bare
您的代码是如何生成的,这有关系吗?错误也可能出现在原始文件中。Coffeescript在编译过程中不知道未使用的变量、未定义的变量、camel_大小写样式强制以及代码应该遵循的大量其他选项。Coffeelint特别不知道已使用/未使用的变量,并且提供了大约1/3的jshint选项。包括使用未定义的变量和模块。