Skip to content

Commit

Permalink
Enforce adherence to jshint via npm test
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanburgers committed Jan 14, 2014
1 parent 90280bd commit 80b8d74
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 17 deletions.
18 changes: 18 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"node": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"boss": true,
"eqnull": true,
"trailing": true,
"globals": {
"describe": false,
"it": false
}
}
14 changes: 2 additions & 12 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,9 @@ module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
jshint: {
all: ['index.js', 'findPartials.js'],
all: ['index.js', 'findPartials.js', 'test/*.js'],
options: {
node: true,
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true
jshintrc: ".jshintrc"
}
}
});
Expand Down
4 changes: 2 additions & 2 deletions find-partials.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ function iteratePartials(parsed) {
var partialSet = {};

parsed.filter(function (i) {
return i[0] == ">";
return i[0] === ">";
}).map(function (i) {
return i[1];
}).forEach(function (i) {
partialSet[i] = true;
});

parsed.filter(function (i) {
return i[0] == "#";
return i[0] === "#";
}).map(function(i) {
iteratePartials(i[4]).map(function(i) {
partialSet[i] = true;
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
},
"devDependencies": {
"grunt": "~0.4",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-jshint": "~0.8",
"jshint": "~2.4",
"mocha": "~1.7",
"should": "~1.2"
},
Expand All @@ -40,6 +41,6 @@
"node": ">= 0.8.0"
},
"scripts": {
"test": "node node_modules/mocha/bin/mocha"
"test": "node node_modules/mocha/bin/mocha && node node_modules/jshint/bin/jshint"
}
}
4 changes: 3 additions & 1 deletion test/find-partials.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

var findPartials = require('../find-partials');
var should = require('should');

Expand All @@ -17,7 +19,7 @@ describe('findPartials', function() {
var results = findPartials("{{> p1}} {{> p2}}");
sort(results).should.eql(["p1", "p2"]);
});

it('should find partials inside a section', function() {
var results = findPartials("{{#test}}{{> p1}}{{/test}}");
sort(results).should.eql(["p1"]);
Expand Down
2 changes: 2 additions & 0 deletions test/mustache-express.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

var fs = require('fs');
var mustacheExpress = require('../mustache-express.js');
var should = require('should');
Expand Down

0 comments on commit 80b8d74

Please sign in to comment.