2013-02-11 63 views
0

编译任何代码bare = falseUnused variable: _thisJShint
结果掉毛它。的CoffeeScript + jshint =未使用的变量:_this

解决方法?
bare = true应该保留,
除了我很高兴有jshint检查未使用的变量。我只想在这里有个例外。


顺便说一句,我也让你走过jshint写成的CoffeeScript的

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

你为什么指裸露和裸露? – placeybordeaux 2013-02-11 16:23:12

+0

错字在问题中。 '--bare' – Alex 2013-02-11 16:26:35

回答

1

你为什么运行的东西? jshint是不是应该和手写的javascript一起使用?

如果你真的想使用皮棉工具你为什么不使用http://www.coffeelint.org/

最后,这是非常相似的question这里,这是封闭的作为是一个真正的问题。

+0

你的代码是如何产生的?原始文件中也可能出现错误。编译期间的Coffeescript不知道未使用的变量,未定义的变量,camel_case样式强制以及您的代码应符合的大量其他选项。 – Alex 2013-02-11 16:28:34

+0

Coffeelint特别不知道已使用/未使用的变量,并拥有1/3提供的jshint选项。包括使用未定义的变量和模块。 – Alex 2013-02-11 16:57:08

0

如果你真的要贯穿JSHint生成的JS,你可以通过options忽略这个警告,就像这样:

###jshint node: true, unused: false ### 

其编译成

/*jshint node: true, unused: false */ 
0

我用下面的.jshintrc settings在我面向浏览器的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"] 
}