finn-js-code-style
Advanced tools
Comparing version 4.1.0 to 4.1.1
var path = require('path'); | ||
var fs = require('fs'); | ||
var exec = require('sync-exec'); | ||
var exec = require('shelljs').exec; | ||
var jshintStylish = require(require('jshint-stylish')); | ||
@@ -13,15 +13,11 @@ var JSHINTRC = '.jshintrc'; | ||
function osSep (pathStr) { | ||
return pathStr.replace(/\//g, path.sep); | ||
} | ||
function isProjectRoot () { | ||
return fs.existsSync(osSep(process.cwd() + '/package.json')); | ||
return fs.existsSync( path.join(process.cwd(), 'package.json') ); | ||
} | ||
module.exports = function (args) { | ||
var cmd, result, failed; | ||
var cmd, result, report; | ||
var currentDir = process.cwd(); | ||
var jshintRc = osSep(currentDir + '/' + JSHINTRC); | ||
var jsonReporter = '--reporter ' + osSep(NODE_MODULES + '/jshint-json/json.js'); | ||
var jshintRc = path.join(currentDir, JSHINTRC); | ||
var jsonReporter = '--reporter ' + path.join(NODE_MODULES, 'jshint-json', 'json.js'); | ||
@@ -38,13 +34,12 @@ if (!fs.existsSync(jshintRc) && isProjectRoot()) { | ||
cmd = osSep(NODE_MODULES + '/.bin/jshint ') + jsonReporter + ' ' + args.join(' '); | ||
result = exec(cmd); | ||
failed = !!result.status; | ||
if (failed && result.stderr) { | ||
console.log('jshint error!'); | ||
cmd = path.join(NODE_MODULES, '.bin', 'jshint') + ' ' + jsonReporter + ' ' + args.join(' '); | ||
result = exec(cmd, {silent: true}); | ||
if (result.code === 1 && result.output) { | ||
console.log('jshint command used: ' + cmd); | ||
if (result.stderr) { console.log(result.stderr); } | ||
} else if (failed !== 0 && result.stdout) { | ||
var report = JSON.parse(result.stdout); | ||
console.log(result.output); | ||
} else if (result.code === 2 && result.output) { | ||
report = JSON.parse(result.output); | ||
jshintStylish.reporter(report.result, report.data); | ||
} | ||
}; |
{ | ||
"name": "finn-js-code-style", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"dependencies": { | ||
@@ -13,3 +13,3 @@ "jshint": { | ||
"from": "cli@0.6.x", | ||
"resolved": "http://npm.finntech.no/internal/cli/-/cli-0.6.5.tgz", | ||
"resolved": "http://registry.npmjs.org/cli/-/cli-0.6.5.tgz", | ||
"dependencies": { | ||
@@ -19,3 +19,3 @@ "glob": { | ||
"from": "glob@~ 3.2.1", | ||
"resolved": "http://npm.finntech.no/internal/glob/-/glob-3.2.11.tgz", | ||
"resolved": "http://registry.npmjs.org/glob/-/glob-3.2.11.tgz", | ||
"dependencies": { | ||
@@ -25,3 +25,3 @@ "inherits": { | ||
"from": "inherits@2", | ||
"resolved": "http://npm.finntech.no/internal/inherits/-/inherits-2.0.1.tgz" | ||
"resolved": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" | ||
}, | ||
@@ -31,3 +31,3 @@ "minimatch": { | ||
"from": "minimatch@0.3", | ||
"resolved": "http://npm.finntech.no/internal/minimatch/-/minimatch-0.3.0.tgz", | ||
"resolved": "http://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", | ||
"dependencies": { | ||
@@ -37,3 +37,3 @@ "lru-cache": { | ||
"from": "lru-cache@2", | ||
"resolved": "http://npm.finntech.no/internal/lru-cache/-/lru-cache-2.5.0.tgz" | ||
"resolved": "http://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz" | ||
}, | ||
@@ -43,3 +43,3 @@ "sigmund": { | ||
"from": "sigmund@~1.0.0", | ||
"resolved": "http://npm.finntech.no/internal/sigmund/-/sigmund-1.0.0.tgz" | ||
"resolved": "http://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" | ||
} | ||
@@ -55,3 +55,3 @@ } | ||
"from": "console-browserify@1.1.x", | ||
"resolved": "http://npm.finntech.no/internal/console-browserify/-/console-browserify-1.1.0.tgz", | ||
"resolved": "http://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", | ||
"dependencies": { | ||
@@ -61,3 +61,3 @@ "date-now": { | ||
"from": "date-now@^0.1.4", | ||
"resolved": "http://npm.finntech.no/internal/date-now/-/date-now-0.1.4.tgz" | ||
"resolved": "http://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz" | ||
} | ||
@@ -69,3 +69,3 @@ } | ||
"from": "exit@0.1.x", | ||
"resolved": "http://npm.finntech.no/internal/exit/-/exit-0.1.2.tgz" | ||
"resolved": "http://registry.npmjs.org/exit/-/exit-0.1.2.tgz" | ||
}, | ||
@@ -75,3 +75,3 @@ "htmlparser2": { | ||
"from": "htmlparser2@3.8.x", | ||
"resolved": "http://npm.finntech.no/internal/htmlparser2/-/htmlparser2-3.8.2.tgz", | ||
"resolved": "http://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.2.tgz", | ||
"dependencies": { | ||
@@ -81,3 +81,3 @@ "domhandler": { | ||
"from": "domhandler@2.3", | ||
"resolved": "http://npm.finntech.no/internal/domhandler/-/domhandler-2.3.0.tgz" | ||
"resolved": "http://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz" | ||
}, | ||
@@ -87,3 +87,3 @@ "domutils": { | ||
"from": "domutils@1.5", | ||
"resolved": "http://npm.finntech.no/internal/domutils/-/domutils-1.5.0.tgz" | ||
"resolved": "http://registry.npmjs.org/domutils/-/domutils-1.5.0.tgz" | ||
}, | ||
@@ -93,3 +93,3 @@ "domelementtype": { | ||
"from": "domelementtype@1", | ||
"resolved": "http://npm.finntech.no/internal/domelementtype/-/domelementtype-1.1.3.tgz" | ||
"resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz" | ||
}, | ||
@@ -99,3 +99,3 @@ "readable-stream": { | ||
"from": "readable-stream@1.1", | ||
"resolved": "http://npm.finntech.no/internal/readable-stream/-/readable-stream-1.1.13.tgz", | ||
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz", | ||
"dependencies": { | ||
@@ -105,3 +105,3 @@ "core-util-is": { | ||
"from": "core-util-is@~1.0.0", | ||
"resolved": "http://npm.finntech.no/internal/core-util-is/-/core-util-is-1.0.1.tgz" | ||
"resolved": "http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" | ||
}, | ||
@@ -116,3 +116,3 @@ "isarray": { | ||
"from": "string_decoder@~0.10.x", | ||
"resolved": "http://npm.finntech.no/internal/string_decoder/-/string_decoder-0.10.31.tgz" | ||
"resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" | ||
}, | ||
@@ -122,3 +122,3 @@ "inherits": { | ||
"from": "inherits@2", | ||
"resolved": "http://npm.finntech.no/internal/inherits/-/inherits-2.0.1.tgz" | ||
"resolved": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" | ||
} | ||
@@ -130,3 +130,3 @@ } | ||
"from": "entities@1.0", | ||
"resolved": "http://npm.finntech.no/internal/entities/-/entities-1.0.0.tgz" | ||
"resolved": "http://registry.npmjs.org/entities/-/entities-1.0.0.tgz" | ||
} | ||
@@ -138,3 +138,3 @@ } | ||
"from": "minimatch@1.0.x", | ||
"resolved": "http://npm.finntech.no/internal/minimatch/-/minimatch-1.0.0.tgz", | ||
"resolved": "http://registry.npmjs.org/minimatch/-/minimatch-1.0.0.tgz", | ||
"dependencies": { | ||
@@ -144,3 +144,3 @@ "lru-cache": { | ||
"from": "lru-cache@2", | ||
"resolved": "http://npm.finntech.no/internal/lru-cache/-/lru-cache-2.5.0.tgz" | ||
"resolved": "http://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz" | ||
}, | ||
@@ -150,15 +150,10 @@ "sigmund": { | ||
"from": "sigmund@~1.0.0", | ||
"resolved": "http://npm.finntech.no/internal/sigmund/-/sigmund-1.0.0.tgz" | ||
"resolved": "http://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" | ||
} | ||
} | ||
}, | ||
"shelljs": { | ||
"version": "0.3.0", | ||
"from": "shelljs@0.3.x", | ||
"resolved": "http://npm.finntech.no/internal/shelljs/-/shelljs-0.3.0.tgz" | ||
}, | ||
"strip-json-comments": { | ||
"version": "1.0.2", | ||
"from": "strip-json-comments@1.0.x", | ||
"resolved": "http://npm.finntech.no/internal/strip-json-comments/-/strip-json-comments-1.0.2.tgz" | ||
"resolved": "http://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.2.tgz" | ||
}, | ||
@@ -168,3 +163,3 @@ "underscore": { | ||
"from": "underscore@1.6.x", | ||
"resolved": "http://npm.finntech.no/internal/underscore/-/underscore-1.6.0.tgz" | ||
"resolved": "http://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz" | ||
} | ||
@@ -186,3 +181,3 @@ } | ||
"from": "chalk@^0.5.1", | ||
"resolved": "http://npm.finntech.no/internal/chalk/-/chalk-0.5.1.tgz", | ||
"resolved": "http://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz", | ||
"dependencies": { | ||
@@ -192,3 +187,3 @@ "ansi-styles": { | ||
"from": "ansi-styles@^1.1.0", | ||
"resolved": "http://npm.finntech.no/internal/ansi-styles/-/ansi-styles-1.1.0.tgz" | ||
"resolved": "http://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz" | ||
}, | ||
@@ -198,3 +193,3 @@ "escape-string-regexp": { | ||
"from": "escape-string-regexp@^1.0.0", | ||
"resolved": "http://npm.finntech.no/internal/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz" | ||
"resolved": "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz" | ||
}, | ||
@@ -204,3 +199,3 @@ "has-ansi": { | ||
"from": "has-ansi@^0.1.0", | ||
"resolved": "http://npm.finntech.no/internal/has-ansi/-/has-ansi-0.1.0.tgz", | ||
"resolved": "http://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz", | ||
"dependencies": { | ||
@@ -210,3 +205,3 @@ "ansi-regex": { | ||
"from": "ansi-regex@^0.2.0", | ||
"resolved": "http://npm.finntech.no/internal/ansi-regex/-/ansi-regex-0.2.1.tgz" | ||
"resolved": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz" | ||
} | ||
@@ -218,3 +213,3 @@ } | ||
"from": "strip-ansi@^0.3.0", | ||
"resolved": "http://npm.finntech.no/internal/strip-ansi/-/strip-ansi-0.3.0.tgz", | ||
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz", | ||
"dependencies": { | ||
@@ -224,3 +219,3 @@ "ansi-regex": { | ||
"from": "ansi-regex@^0.2.0", | ||
"resolved": "http://npm.finntech.no/internal/ansi-regex/-/ansi-regex-0.2.1.tgz" | ||
"resolved": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz" | ||
} | ||
@@ -232,3 +227,3 @@ } | ||
"from": "supports-color@^0.2.0", | ||
"resolved": "http://npm.finntech.no/internal/supports-color/-/supports-color-0.2.0.tgz" | ||
"resolved": "http://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz" | ||
} | ||
@@ -264,12 +259,12 @@ } | ||
"from": "text-table@^0.2.0", | ||
"resolved": "http://npm.finntech.no/internal/text-table/-/text-table-0.2.0.tgz" | ||
"resolved": "http://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" | ||
} | ||
} | ||
}, | ||
"sync-exec": { | ||
"version": "0.4.0", | ||
"from": "sync-exec@0.4.0", | ||
"resolved": "http://registry.npmjs.org/sync-exec/-/sync-exec-0.4.0.tgz" | ||
"shelljs": { | ||
"version": "0.3.0", | ||
"from": "shelljs@0.3.0", | ||
"resolved": "http://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz" | ||
} | ||
} | ||
} |
{ | ||
"name": "finn-js-code-style", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "Config files for FINN JavaScript style", | ||
@@ -10,3 +10,3 @@ "main": "lib/cli.js", | ||
"scripts": { | ||
"test": "./node_modules/.bin/lab test/*.test.js" | ||
"test": "./node_modules/.bin/lab test/*.test.js && ./bin/finn-js-code-style bin lib" | ||
}, | ||
@@ -30,4 +30,4 @@ "author": "FINN.no AS", | ||
"jshint-stylish": "1.0.0", | ||
"sync-exec": "0.4.0" | ||
"shelljs": "0.3.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20687
333
+ Addedshelljs@0.3.0
- Removedsync-exec@0.4.0
- Removedsync-exec@0.4.0(transitive)