Skip to content

Commit f8650bd

Browse files
author
dceejay
committed
Add opinionated jshintrc - and point Grunt at it.
1 parent 73f59c6 commit f8650bd

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.npm
22
.jshintignore
3-
.jshintrc
43
.project
54
.settings
65
.tern-project

.jshintrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"asi": true, // allow missing semicolons
3+
"curly": true, // require braces
4+
"eqnull": true, // ignore ==null
5+
"forin": true, // require property filtering in "for in" loops
6+
"immed": true, // require immediate functions to be wrapped in ( )
7+
"nonbsp": true, // warn on unexpected whitespace breaking chars
8+
//"strict": true, // commented out for now as it causes 100s of warnings, but want to get there eventually
9+
//"unused": true, // Check for unused functions and variables
10+
"loopfunc": true, // allow functions to be defined in loops
11+
//"expr": true, // allow ternery operator syntax...
12+
"sub": true // don't warn that foo['bar'] should be written as foo.bar
13+
}

Gruntfile.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
**/
1616

1717
module.exports = function(grunt) {
18-
18+
1919
// Project configuration.
2020
grunt.initConfig({
2121
pkg: grunt.file.readJSON('package.json'),
@@ -31,22 +31,23 @@ module.exports = function(grunt) {
3131
},
3232
jshint: {
3333
options: {
34+
jshintrc:true // Use external jshinrc file configured as below
3435
// http://www.jshint.com/docs/options/
35-
"asi": true, // allow missing semicolons
36-
"curly": true, // require braces
37-
"eqnull": true, // ignore ==null
38-
"forin": true, // require property filtering in "for in" loops
39-
"immed": true, // require immediate functions to be wrapped in ( )
40-
"nonbsp": true, // warn on unexpected whitespace breaking chars
41-
//"strict": true, // commented out for now as it causes 100s of warnings, but want to get there eventually
42-
"loopfunc": true, // allow functions to be defined in loops
43-
"sub": true // don't warn that foo['bar'] should be written as foo.bar
36+
//"asi": true, // allow missing semicolons
37+
//"curly": true, // require braces
38+
//"eqnull": true, // ignore ==null
39+
//"forin": true, // require property filtering in "for in" loops
40+
//"immed": true, // require immediate functions to be wrapped in ( )
41+
//"nonbsp": true, // warn on unexpected whitespace breaking chars
42+
////"strict": true, // commented out for now as it causes 100s of warnings, but want to get there eventually
43+
//"loopfunc": true, // allow functions to be defined in loops
44+
//"sub": true // don't warn that foo['bar'] should be written as foo.bar
4445
},
4546
all: {
4647
src: ['*/*.js'],
4748
filter: function(filepath) { // on some developer machines the test coverage HTML report utilities cause further failures
4849
if(filepath.indexOf("coverage/prettify.js") === -1) {
49-
return true;
50+
return true;
5051
} else {
5152
console.log("Filtered out " + filepath + " from the jshint checks");
5253
return false;

0 commit comments

Comments
 (0)