Skip to content

Commit

Permalink
Build: Add JSHint for additional linting
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgonzalez committed May 8, 2015
1 parent 7f0050e commit 3dd58d7
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 20 deletions.
20 changes: 17 additions & 3 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
{
"browser": true,
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"expr": true,
"predef": [ "define" ],
"immed": true,
"noarg": true,
"smarttabs": true,
"trailing": true,
"undef": true,
"unused": true
"unused": true,

"node": true,
"esnext": true,

"globals": {
"define": false,
"PointerEvent": true
}
}
9 changes: 8 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-git-authors');
grunt.loadNpmTasks('grunt-jscs');
Expand Down Expand Up @@ -62,6 +63,12 @@ module.exports = function(grunt) {
src: allFiles
}
}
},
jshint: {
options: {
jshintrc: true
},
main: allFiles
}
});

Expand Down Expand Up @@ -96,7 +103,7 @@ module.exports = function(grunt) {
});

grunt.registerTask('default', [ 'lint', 'build', 'uglify' ]);
grunt.registerTask('lint', [ 'jscs:lint' ]);
grunt.registerTask('lint', [ 'jscs:lint', 'jshint' ]);
grunt.registerTask('test', [ 'intern:pointerevents' ]);
grunt.registerTask('ci', [ 'lint', 'build', 'intern:ci' ]);
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"chai-spies": "^0.5.1",
"esperanto": "^0.6.6",
"grunt": "~0.4.1",
"grunt-contrib-jshint": "0.11.2",
"grunt-contrib-uglify": "^0.4.0",
"grunt-git-authors": "^3.0.0",
"grunt-jscs": "1.8.0",
Expand Down
21 changes: 21 additions & 0 deletions src/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"expr": true,
"immed": true,
"noarg": true,
"smarttabs": true,
"trailing": true,
"undef": true,
"unused": true,

"browser": true,
"esnext": true,

"globals": {
"define": false,
"PointerEvent": true
}
}
7 changes: 0 additions & 7 deletions src/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,4 @@ Installer.prototype = {
}
};

if (!MO) {
Installer.prototype.watchSubtree = function() {
console.warn('PointerEventsPolyfill: MutationObservers not found, ' +
'touch-action will not be dynamically detected');
};
}

export default Installer;
4 changes: 2 additions & 2 deletions src/targeting.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
searchRoot: function(inRoot, x, y) {
if (inRoot) {
var t = inRoot.elementFromPoint(x, y);
var st, sr, os;
var st, sr;

// is element a shadow host?
sr = this.targetingShadow(t);
Expand Down Expand Up @@ -68,7 +68,7 @@ export default {
}

// the owner element is expected to be a Document or ShadowRoot
if (s.nodeType != Node.DOCUMENT_NODE && s.nodeType != Node.DOCUMENT_FRAGMENT_NODE) {
if (s.nodeType !== Node.DOCUMENT_NODE && s.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {
s = document;
}
return s;
Expand Down
1 change: 0 additions & 1 deletion src/touch-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var attrib2css = [
var styles = '';

// only install stylesheet if the browser has touch action support
var head = document.head;
var hasNativePE = window.PointerEvent || window.MSPointerEvent;

// only add shadow selectors if shadowdom is supported
Expand Down
3 changes: 1 addition & 2 deletions src/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var captureInfo = dispatcher.captureInfo;
var findTarget = targeting.findTarget.bind(targeting);
var allShadows = targeting.allShadows.bind(targeting);
var pointermap = dispatcher.pointermap;
var touchMap = Array.prototype.map.call.bind(Array.prototype.map);

// This should be long enough to ignore compat mouse events made by touch
var DEDUP_TIMEOUT = 2500;
Expand Down Expand Up @@ -261,7 +260,7 @@ var touchEvents = {
}
},
overDown: function(inPointer) {
var p = pointermap.set(inPointer.pointerId, {
pointermap.set(inPointer.pointerId, {
target: inPointer.target,
out: inPointer,
outTarget: inPointer.target
Expand Down
21 changes: 21 additions & 0 deletions tests/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"expr": true,
"immed": true,
"noarg": true,
"smarttabs": true,
"trailing": true,
"undef": true,
"unused": true,

"browser": true,
"esnext": true,

"globals": {
"define": false,
"PointerEvent": true
}
}
2 changes: 1 addition & 1 deletion tests/unit/capture.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ define([
var ids = 0;
function wait(e) {
ids += e.pointerId;
if (ids == 3) {
if (ids === 3) {
pm.clear();
dfd.resolve();
}
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/pointermap.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ define([
}
expect(p.pointers()).to.equal(1);
});
test('PointerMap .get', function() {
var p = new PointerMap();
});
test('PointerMap .pointers', function() {
var p = new PointerMap();
expect(p.pointers).to.be.a('function');
Expand Down

0 comments on commit 3dd58d7

Please sign in to comment.