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/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); } 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 ); }; 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'); /** 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]; 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"