From e701e45f8e09950139b67e8d30aff0285d5565ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20B=C3=A4ume?= Date: Wed, 7 May 2014 00:05:09 +0200 Subject: [PATCH] separate jshint config for specs specs need a separate jshintrc, since chai needs '"expr": true' option because of https://github.com/chaijs/chai/issues/41 --- Gruntfile.js | 13 ++++++++++--- spec/.jshintrc | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 spec/.jshintrc diff --git a/Gruntfile.js b/Gruntfile.js index 0a267d7..3aff584 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -18,9 +18,16 @@ module.exports = function (grunt) { }, all: [ 'Gruntfile.js', - 'lib/**/*.js', - 'spec/**/*.js' - ] + 'lib/**/*.js' + ], + specs: { + options: { + jshintrc: 'spec/.jshintrc' + }, + files: [{ + src: ['spec/**/*.js'] + }] + } }, mochaTest: { tests: { diff --git a/spec/.jshintrc b/spec/.jshintrc new file mode 100644 index 0000000..d249bb4 --- /dev/null +++ b/spec/.jshintrc @@ -0,0 +1,39 @@ +{ + // JSHint Configuration File + // See http://jshint.com/docs/ for more details + + "maxerr" : 5, // {int} Maximum error before stopping + + // Enforcing + "bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.) + "forin" : false, // true: Require filtering for..in loops with obj.hasOwnProperty() + "immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`, + "quotmark" : "single", + "undef" : true, + "unused" : true, + + // Relaxing + "debug" : true, // true: Allow debugger statements e.g. browser breakpoints. + "browser" : true, // true: defines globals exposed by modern browsers + "devel" : true, // true: define globals for some development functions (alert, console) + "shadow" : true, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` + "validthis" : true, // true: Tolerate using this in a non-constructor function + "boss" : true, // true: Tolerate assignments where comparisons would be expected + "evil" : true, // true: Tolerate use of `eval` and `new Function()` + "expr" : true, + + // Environments + + "trailing" : true, // true: Prohibit trailing whitespaces + "node" : true, // Node.js + "nonstandard" : true, // Widely adopted globals (escape, unescape, etc) + + // Legacy + "white" : true, // true: Check against strict whitespace and indentation rules + + // Custom Globals + "globals": { + "describe": true, + "it": true + } +}