diff --git a/.jscsrc b/.jscsrc index 99fb34d..5ce64e0 100644 --- a/.jscsrc +++ b/.jscsrc @@ -2,7 +2,12 @@ "preset": "node-style-guide", "requireCapitalizedComments": null, "requireSpacesInAnonymousFunctionExpression": { - "beforeOpeningCurlyBrace": true + "beforeOpeningCurlyBrace": true, + "beforeOpeningRoundBrace": true }, - "excludeFiles": ["node_modules/**"] + "disallowSpacesInNamedFunctionExpression": { + "beforeOpeningRoundBrace": true + }, + "excludeFiles": ["node_modules/**"], + "disallowSpacesInFunction": null } \ No newline at end of file diff --git a/cli/index.js b/cli/index.js index ec6037c..a58fc94 100755 --- a/cli/index.js +++ b/cli/index.js @@ -48,8 +48,10 @@ var argvKeys = Object.keys(argv).filter(function filter(item) { }); if (!url && argvKeys.length === 0 || argv.help) { - // show USAGE! - console.log(require('fs').readFileSync(__dirname + '/../docs/usage.txt', 'utf8')); + var usage = require('fs').readFileSync( + __dirname + '/../docs/usage.txt', 'utf8' + ); + console.log(usage); process.exit(0); } diff --git a/lib/errors.js b/lib/errors.js index 40b7af6..d5bb341 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -1,3 +1,4 @@ module.exports = { - ENOTFOUND: 'The URL could not be loaded, possibly a typo, or no internet connection', + ENOTFOUND: 'The URL could not be loaded, possibly a typo, ' + + 'or no internet connection', }; \ No newline at end of file diff --git a/lib/index.js b/lib/index.js index 72403ed..8dc3161 100644 --- a/lib/index.js +++ b/lib/index.js @@ -68,7 +68,7 @@ function Inliner(url, options, callback) { global.setImmediate = function setImmediatePolyfill(fn) { // :-/ setTimeout(fn, 0); - } + }; } global.setImmediate(this.main.bind(this)); } @@ -93,7 +93,7 @@ Inliner.prototype.main = main; // static properties and methods Inliner.version = version; Inliner.errors = require('./errors'); -Inliner.defaults = function() { +Inliner.defaults = function () { return { images: true, compressCSS: true, @@ -177,7 +177,8 @@ function main() { return inliner.get(url).then(function then(res) { var css = res.body; inliner.jobs.done.links(); - return inliner.cssImports(url, css).then(inliner.cssImages.bind(inliner, url)); + return inliner.cssImports(url, css) + .then(inliner.cssImages.bind(inliner, url)); }).then(function then(css) { $(link).replaceWith(''); }); @@ -238,7 +239,8 @@ function main() { }); } - return promise.then(inliner.uglify.bind(inliner)).then(function then(res) { + return promise.then(inliner.uglify.bind(inliner)) + .then(function then(res) { debug('uglify: %s', res); $script.html(res); }); diff --git a/package.json b/package.json index 4db71d2..0bcf2e2 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "homepage": "http://github.com/remy/inliner", "main": "lib/index.js", "scripts": { - "test": "node test/*.test.js --cov" + "test": "jscs -v cli/*.js lib/*.js && node test/*.test.js --cov" }, "keywords": [ "mobile", @@ -36,6 +36,7 @@ "inliner": "cli/index.js" }, "devDependencies": { + "jscs": "^2.0.0", "st": "^0.5.5", "tap-spec": "^4.0.2", "tape": "^4.0.1" diff --git a/test/index.test.js b/test/index.test.js index b946235..ae6ef1c 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -13,7 +13,8 @@ test('inliner core functions', function coreTests(t) { var Inliner = require('../'); t.equal(typeof Inliner, 'function', 'Inliner is a function'); - t.equal(Inliner.version, require('../package.json').version, 'should have version'); + t.equal(Inliner.version, + require('../package.json').version, 'should have version'); var inliner = new Inliner(); t.ok(inliner, 'inline is instantiated');