From 713394cb0799f7c0b8c1d85d41a2c3e6dcc8e880 Mon Sep 17 00:00:00 2001 From: Damian Krzeminski Date: Sun, 17 May 2015 19:10:10 -0400 Subject: [PATCH 1/5] add lint target --- .jshintrc | 23 +++++++++++++++++++++++ Makefile | 3 +++ package.json | 5 +++-- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..84e9e31 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,23 @@ +{ + "asi": true, + "curly": false, + "eqeqeq": false, + "eqnull": true, + "immed": true, + "latedef": "nofunc", + "laxbreak": true, + "mocha" : true, + "newcap": true, + "noarg": true, + "browser": true, + "shadow": true, + "sub": true, + "undef": true, + "unused": true, + "globals": { + "exports": false, + "require": false, + "module": false + } + +} diff --git a/Makefile b/Makefile index 9b1c0db..87c59be 100644 --- a/Makefile +++ b/Makefile @@ -11,4 +11,7 @@ clean: test: @./node_modules/.bin/component-test phantom +lint: + @./node_modules/.bin/jshint index.js lib test + .PHONY: clean test diff --git a/package.json b/package.json index c326036..c769502 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,10 @@ "component-each": "~0.2.2" }, "devDependencies": { + "component-test2": "*", "domify": "^1.2.2", - "load-styles": "^1.0.1", - "component-test2": "*" + "jshint": "^2.7.0", + "load-styles": "^1.0.1" }, "browser": { "each": "component-each" From 6a5d9f77454c515c3ba96bfae8defad3c5a7625c Mon Sep 17 00:00:00 2001 From: Damian Krzeminski Date: Sun, 17 May 2015 19:14:21 -0400 Subject: [PATCH 2/5] fix exception in swap() using undefined `old` variable to store values --- lib/swap.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/swap.js b/lib/swap.js index b9b9942..8547173 100644 --- a/lib/swap.js +++ b/lib/swap.js @@ -15,6 +15,8 @@ module.exports = swap; */ function swap(el, options, fn, args) { + var old = {}, ret; + // Remember the old values, and insert the new ones for (var key in options) { old[key] = el.style[key]; From b6163e9e4f480f91062b4e7909390a557185f9a1 Mon Sep 17 00:00:00 2001 From: Damian Krzeminski Date: Sun, 17 May 2015 19:16:21 -0400 Subject: [PATCH 3/5] fix isNumeric implementation typo isNan -> isNaN --- lib/css.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/css.js b/lib/css.js index 7137d8f..fd9b791 100644 --- a/lib/css.js +++ b/lib/css.js @@ -76,5 +76,5 @@ function css(el, prop, extra, styles) { */ function isNumeric(obj) { - return !isNan(parseFloat(obj)) && isFinite(obj); + return !isNaN(parseFloat(obj)) && isFinite(obj); } From fad694669f3c13b95d617c81f801389dc23a6475 Mon Sep 17 00:00:00 2001 From: Damian Krzeminski Date: Sun, 17 May 2015 19:37:37 -0400 Subject: [PATCH 4/5] fix issue with styles var shadowing var function --- lib/hooks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hooks.js b/lib/hooks.js index 7468ab2..c41d774 100644 --- a/lib/hooks.js +++ b/lib/hooks.js @@ -32,9 +32,9 @@ each(['width', 'height'], function(name) { } exports[name].set = function(el, val, extra) { - var styles = extra && styles(el); + var elStyles = extra && styles(el); return setPositiveNumber(el, val, extra - ? augmentWidthOrHeight(el, name, extra, 'border-box' == css(el, 'boxSizing', false, styles), styles) + ? augmentWidthOrHeight(el, name, extra, 'border-box' == css(el, 'boxSizing', false, elStyles), elStyles) : 0 ); }; From bb677119a0af1fea091023caf3dcaaee92150d01 Mon Sep 17 00:00:00 2001 From: Damian Krzeminski Date: Sun, 17 May 2015 19:23:06 -0400 Subject: [PATCH 5/5] remove unused camelcase from prop module --- lib/prop.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/prop.js b/lib/prop.js index 6abd9a0..4864525 100644 --- a/lib/prop.js +++ b/lib/prop.js @@ -3,7 +3,6 @@ */ var debug = require('debug')('css:prop'); -var camelcase = require('to-camel-case'); var vendor = require('./vendor'); /**