0

Possible Duplicate:
What good is JSLint if jQuery fails the validation

Why am I getting JS Hint error "missing space after 'function'." for an empty mvc 3 project?

The error is in file "jquery-1.5.1-vsdoc.js" on line 28 "(function( window, undefined ) {".

Aren't the libraries coded to a standard?

JS Lint/Hint is reporting the maximum number of errors in this file, and also in "jquery-1.5.1.js".

I haven't modified the file - it was automatically included when I created an empty MVC3 project.

Why is this happening?

Community
  • 1
  • 1
Tim K
  • 1

1 Answers1

3

Linter like jsHint and jsLint are help tools. They help teams coding in standard way, but they aren't really checking your script for actual error. For this kind of feedback, you'd be looking more at esprima.js kind of tools.

This mean that you don't have to buy in any defaults linter come with. In fact, these tools are easily configurable to work best with you and your team workflow (jsHint option page).

For jQuery, you can find their jsHint settings right here on their github project: https://github.com/jquery/jquery/blob/master/.jshintrc

If you set your option as those, you shouldn't have any error showing up. That's why most editor let you setup a linter configuration for each project, so you can easily follow guidelines of each ones.

So remember, linter are only a tools to help you out, not any form of Truth with a big T.

Hope this help!

Simon Boudrias
  • 42,953
  • 16
  • 99
  • 134