0

Compiling any code with bare = false and linting it with JShint
results in Unused variable: _this.

Solutions to this?
bare = true should remain,
besides I'm pretty happy to have jshint checking for unused variables. I just want an exception here.


By the way, I also get the

Move the invocation into the parens that contain the function.
}).call(this);
Alex
  • 11,479
  • 6
  • 28
  • 50

3 Answers3

1

Why are you running stuff you have written in Coffeescript through jshint? Isn't jshint supposed to be used with handwritten javascript?

If you really want to use a lint tool why don't you use http://www.coffeelint.org/

Lastly this is very similar to the question here, which was closed as not being a real question.

Community
  • 1
  • 1
placeybordeaux
  • 2,138
  • 1
  • 20
  • 42
  • Does it matter how was your code produced? Errors could had been presented in the original file as well. Coffeescript during compilation doesn't know about unused variables, undefined variables, camel_case style enforcement and tons of other options your code should conform to. – Alex Feb 11 '13 at 16:28
  • Coffeelint specifically ain't aware of used / unused variables and has like 1/3 of the jshint options provided. Including use of undefined variables and modules. – Alex Feb 11 '13 at 16:57
0

If you really want to run the generated JS through JSHint, you can pass options to ignore this warnings like so:

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

which compiles to

/*jshint node: true, unused: false */
mar10
  • 14,320
  • 5
  • 39
  • 64
0

I use the following .jshintrc settings in my browser-facing Coffeescript projects

// 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"]
}
Dave Sag
  • 13,266
  • 14
  • 86
  • 134