2013-02-20 13:15:50 -05:00
|
|
|
# ------------ rake task options ------------
|
|
|
|
|
|
|
|
# JS files to check by default, if no parameters are passed to rake jshint
|
|
|
|
# (you may want to limit this only to your own scripts and exclude any external scripts and frameworks)
|
|
|
|
|
|
|
|
# this can be overridden by adding 'paths' and 'exclude_paths' parameter to rake command:
|
|
|
|
# rake jshint paths=path1,path2,... exclude_paths=library1,library2,...
|
|
|
|
|
|
|
|
paths:
|
|
|
|
- app/assets/javascripts/**/*.js
|
|
|
|
- spec/javascripts/**/*.js
|
2013-02-21 16:25:40 -05:00
|
|
|
- spec/phantom_js/**/*.js
|
2013-06-13 15:08:42 -04:00
|
|
|
- test/javascripts/**/*.js
|
2013-02-20 13:15:50 -05:00
|
|
|
|
|
|
|
exclude_paths:
|
|
|
|
- app/assets/javascripts/external/*
|
|
|
|
- app/assets/javascripts/external_production/*
|
2013-04-15 01:21:00 -04:00
|
|
|
- app/assets/javascripts/external_development/*
|
2013-02-20 13:15:50 -05:00
|
|
|
- app/assets/javascripts/defer/*
|
2013-02-28 14:31:39 -05:00
|
|
|
- app/assets/javascripts/locales/i18n.js
|
2013-02-20 13:15:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
# ------------ jshint options ------------
|
|
|
|
# visit http://jshint.com/ for complete documentation
|
|
|
|
|
|
|
|
# "enforce" type options (true means potentially more warnings)
|
|
|
|
|
|
|
|
adsafe: false # true if ADsafe rules should be enforced. See http://www.ADsafe.org/
|
2013-02-21 16:25:40 -05:00
|
|
|
bitwise: true # true if bitwise operators should not be allowed
|
2013-02-20 13:15:50 -05:00
|
|
|
newcap: true # true if Initial Caps must be used with constructor functions
|
|
|
|
eqeqeq: true # true if === should be required (for ALL equality comparisons)
|
|
|
|
immed: false # true if immediate function invocations must be wrapped in parens
|
|
|
|
nomen: false # true if initial or trailing underscore in identifiers should be forbidden
|
|
|
|
onevar: false # true if only one var statement per function should be allowed
|
|
|
|
plusplus: false # true if ++ and -- should not be allowed
|
|
|
|
regexp: false # true if . and [^...] should not be allowed in RegExp literals
|
|
|
|
safe: false # true if the safe subset rules are enforced (used by ADsafe)
|
|
|
|
strict: false # true if the ES5 "use strict"; pragma is required
|
|
|
|
undef: true # true if variables must be declared before used
|
|
|
|
white: false # true if strict whitespace rules apply (see also 'indent' option)
|
|
|
|
eqnull: false
|
2013-06-04 20:16:05 -04:00
|
|
|
onecase: true # allow for one case switches, can be more elegant sometimes
|
2013-02-20 13:15:50 -05:00
|
|
|
|
|
|
|
# "allow" type options (false means potentially more warnings)
|
|
|
|
|
|
|
|
cap: false # true if upper case HTML should be allowed
|
|
|
|
css: false # true if CSS workarounds should be tolerated
|
|
|
|
debug: false # true if debugger statements should be allowed (set to false before going into production)
|
|
|
|
es5: false # true if ECMAScript 5 syntax should be allowed
|
|
|
|
evil: false # true if eval should be allowed
|
|
|
|
forin: false # true if unfiltered 'for in' statements should be allowed
|
|
|
|
fragment: false # true if HTML fragments should be allowed
|
|
|
|
laxbreak: false # true if statement breaks should not be checked
|
|
|
|
on: false # true if HTML event handlers (e.g. onclick="...") should be allowed
|
|
|
|
sub: false # true if subscript notation may be used for expressions better expressed in dot notation
|
|
|
|
|
|
|
|
# other options
|
|
|
|
|
|
|
|
maxlen: 200 # Maximum line length
|
|
|
|
indent: 2 # Number of spaces that should be used for indentation - used only if 'white' option is set
|
|
|
|
maxerr: 50 # The maximum number of warnings reported (per file)
|
|
|
|
passfail: false # true if the scan should stop on first error (per file)
|
|
|
|
# following are relevant only if undef = true
|
|
|
|
|
|
|
|
# Some of these can be declared in other ways I think
|
|
|
|
predef:
|
|
|
|
- Ember
|
|
|
|
- jQuery
|
2013-02-22 15:41:12 -05:00
|
|
|
- $
|
2013-02-20 13:15:50 -05:00
|
|
|
- RSVP
|
|
|
|
- Discourse
|
|
|
|
- $LAB
|
|
|
|
- Em
|
|
|
|
- PreloadStore
|
|
|
|
- Handlebars
|
|
|
|
- I18n
|
|
|
|
- bootbox
|
2013-06-06 18:49:09 -04:00
|
|
|
- moment
|
2013-06-10 16:48:50 -04:00
|
|
|
- _
|
2013-06-20 13:58:54 -04:00
|
|
|
- module
|
|
|
|
- integration
|
|
|
|
- test
|
|
|
|
- ok
|
|
|
|
- expect
|
|
|
|
- equal
|
|
|
|
- blank
|
|
|
|
- present
|
|
|
|
- visit
|
|
|
|
- count
|
|
|
|
- exists
|
2013-07-15 19:47:13 -04:00
|
|
|
- asyncTestDiscourse
|
2013-06-20 13:58:54 -04:00
|
|
|
- find
|
|
|
|
- sinon
|
2013-06-20 17:20:08 -04:00
|
|
|
- controllerFor
|
2013-02-20 13:15:50 -05:00
|
|
|
|
|
|
|
browser: true # true if the standard browser globals should be predefined
|
|
|
|
rhino: false # true if the Rhino environment globals should be predefined
|
|
|
|
windows: false # true if Windows-specific globals should be predefined
|
|
|
|
widget: false # true if the Yahoo Widgets globals should be predefined
|
|
|
|
devel: true # true if functions like alert, confirm, console, prompt etc. are predefined
|
|
|
|
|
|
|
|
# jshint options
|
|
|
|
loopfunc: true # true if functions should be allowed to be defined within loops
|
|
|
|
asi: true # true if automatic semicolon insertion should be tolerated
|
|
|
|
boss: true # true if advanced usage of assignments and == should be allowed
|
|
|
|
couch: true # true if CouchDB globals should be predefined
|
|
|
|
curly: false # true if curly braces around blocks should be required (even in if/for/while)
|
|
|
|
noarg: true # true if arguments.caller and arguments.callee should be disallowed
|
|
|
|
node: false # true if the Node.js environment globals should be predefined
|
|
|
|
noempty: false # true if empty blocks should be disallowed
|
|
|
|
nonew: true # true if using `new` for side-effects should be disallowed
|
|
|
|
|
|
|
|
|
|
|
|
# ------------ jshint_on_rails custom lint options (switch to true to disable some annoying warnings) ------------
|
|
|
|
|
|
|
|
# ignores "missing semicolon" warning at the end of a function; this lets you write one-liners
|
|
|
|
# like: x.map(function(i) { return i + 1 }); without having to put a second semicolon inside the function
|
|
|
|
lastsemic: false
|
|
|
|
|
|
|
|
# allows you to use the 'new' expression as a statement (without assignment)
|
|
|
|
# so you can call e.g. new Ajax.Request(...), new Effect.Highlight(...) without assigning to a dummy variable
|
|
|
|
newstat: false
|
|
|
|
|
|
|
|
# ignores the "Expected an assignment or function call and instead saw an expression" warning,
|
|
|
|
# if the expression contains a proper statement and makes sense; this lets you write things like:
|
|
|
|
# element && element.show();
|
|
|
|
# valid || other || lastChance || alert('OMG!');
|
|
|
|
# selected ? show() : hide();
|
|
|
|
# although these will still cause a warning:
|
|
|
|
# element && link;
|
|
|
|
# selected ? 5 : 10;
|
|
|
|
statinexp: false
|