Reputation: 4862
I'm using Brackets 1.2 and the extension brackets-jshint. Here is my .jshintrc
in my project root:
{
'bitwise': true,
'boss': true,
'camelcase': true,
'curly': true,
'devel': true,
'eqeqeq': true,
'eqnull': true,
'expr': true,
'forin': true,
'iterator': false,
'latedef': true,
'multistr': false,
'nocomma': true,
'noarg': true,
'noempty': true,
'nonbsp': true,
'nonew': true,
'quotmark': 'single',
'undef': true,
'unused': true,
'globals': {
'$': true,
'document': true,
'jQuery': true,
'window': true
}
}
The globals
option is not working and the white list of global variables are still being warned by JSHint.
I also tried these:
globals: true
jquery: true
devel: true
But no success, $
, jquery
, window
, document
and alert
are still warned.
Upvotes: 1
Views: 1907
Reputation: 7438
You must replace single quotes with double in .jshintrc
: ) This answer is to short, so I’m going to add a little explanations …
Just open Debug » Developers tools try to validate some JavaScript file – you can see in debug console
JSHint: error parsing /project/path/.jshintrc. Details: SyntaxError: Unexpected token '
As method responsible for reading .jshintrc looks like:
try {
config = JSON.parse(removeComments(content));
} catch (e) {
console.error("JSHint: error parsing " + file.fullPath + ". Details: " + e);
result.reject(e);
return;
}
JSON.parse implements http://www.ietf.org/rfc/rfc4627.txt - according to ECMAScript Specification and there is no place for '
.
From rfc 4627 only valid structure to describe JSON is
string = quotation-mark *char quotation-mark char = unescaped / escape ( %x22 / ; " quotation mark U+0022 %x5C / ; \ reverse solidus U+005C %x2F / ; / solidus U+002F %x62 / ; b backspace U+0008 %x66 / ; f form feed U+000C %x6E / ; n line feed U+000A %x72 / ; r carriage return U+000D %x74 / ; t tab U+0009 %x75 4HEXDIG ) ; uXXXX U+XXXX escape = %x5C ; \ quotation-mark = %x22 ; "
Upvotes: 3
Reputation: 375
Please make sure you have disabled JSLint, the linter that comes with Brackets by default.
You can do so by adding this snippet to your brackets.json (open via Debug > Show Preferences File
):
"language": {
"javascript": {
"linting.prefer": "JSHint",
"linting.usePreferredOnly": true
}
}
Upvotes: 0