Comparing version 1.5.0 to 2.0.0
@@ -20,5 +20,6 @@ #!/usr/bin/env node | ||
var URLS = [ | ||
'git@github.com:feross/webtorrent.git', | ||
'git@github.com:feross/bittorrent-tracker.git', | ||
'git@github.com:feross/bittorrent-dht.git' | ||
'https://github.com/feross/webtorrent.git', | ||
'https://github.com/feross/bittorrent-tracker.git', | ||
'https://github.com/feross/bittorrent-dht.git', | ||
'https://github.com/mafintosh/level-temp.git' | ||
] | ||
@@ -31,3 +32,3 @@ | ||
return function (cb) { | ||
var name = /\/([^.]+)\.git$/.exec(url)[1] | ||
var name = /\/([^.\/]+)\.git$/.exec(url)[1] | ||
var args = [ 'clone', url, path.join(TMP, name) ] | ||
@@ -39,3 +40,3 @@ // TODO: Start `git` in a way that works on Windows – PR welcome! | ||
if (err) return error(err) | ||
spawn(STANDARD, [], function (err) { | ||
spawn(STANDARD, ['--verbose'], function (err) { | ||
if (err) return error(err) | ||
@@ -42,0 +43,0 @@ console.log('ok') |
126
index.js
@@ -9,9 +9,15 @@ var cp = require('child_process') | ||
var JSHINT = path.join(__dirname, 'node_modules', '.bin', 'jshint') | ||
var JSHINTRC = path.join(__dirname, 'rc', '.jshintrc') | ||
var JSHINT_RC = path.join(__dirname, 'rc', '.jshintrc') | ||
var JSHINT_REPORTER = path.join(__dirname, 'lib', 'jshint-reporter.js') | ||
var JSCS = path.join(__dirname, 'node_modules', '.bin', 'jscs') | ||
var JSCSRC = path.join(__dirname, 'rc', '.jscsrc') | ||
var JSCS_RC = path.join(__dirname, 'rc', '.jscsrc') | ||
var JSCS_REPORTER = path.join(__dirname, 'lib', 'jscs-reporter.js') | ||
var JSCS_REPORTER_VERBOSE = path.join(__dirname, 'lib', 'jscs-reporter-verbose.js') | ||
var ESLINT = path.join(__dirname, 'node_modules', '.bin', 'eslint') | ||
var ESLINT_RC = path.join(__dirname, 'rc', '.eslintrc') | ||
var ESLINT_REPORTER = path.join(__dirname, 'lib', 'eslint-reporter.js') | ||
var ESLINT_REPORTER_VERBOSE = path.join(__dirname, 'lib', 'eslint-reporter-verbose.js') | ||
if (/^win/.test(process.platform)) { | ||
@@ -65,6 +71,7 @@ JSHINT += '.cmd' | ||
var jshintArgs = ['--config', JSHINTRC, '--reporter', 'unix'] | ||
var jshintArgs = ['--config', JSHINT_RC, '--reporter', JSHINT_REPORTER] | ||
var jscsReporter = opts.verbose ? JSCS_REPORTER_VERBOSE : JSCS_REPORTER | ||
var jscsArgs = ['--config', JSCSRC, '--reporter', jscsReporter, '--esnext'] | ||
var jscsArgs = ['--config', JSCS_RC, '--reporter', jscsReporter] | ||
var eslintReporter = opts.verbose ? ESLINT_REPORTER_VERBOSE : ESLINT_REPORTER | ||
var eslintArgs = ['--config', ESLINT_RC, '--format', eslintReporter] | ||
@@ -78,51 +85,25 @@ if (opts.verbose) { | ||
jscsArgs = jscsArgs.concat(files) | ||
eslintArgs = eslintArgs.concat(files) | ||
var jshint = spawn(JSHINT, jshintArgs, function (jshintErr) { | ||
var jscs = spawn(JSCS, jscsArgs, function (jscsErr) { | ||
if (jshintErr || jscsErr) { | ||
if (opts.bare) { | ||
errors.forEach(function (str) { | ||
console.error(str) | ||
}) | ||
return | ||
} | ||
console.error('Error: Code style check failed:') | ||
var errMap = {} | ||
errors | ||
.filter(function (str) { // de-duplicate errors | ||
if (errMap[str]) return false | ||
errMap[str] = true | ||
return true | ||
}) | ||
.sort(function (a, b) { | ||
// sort by line number (merges jshint and jscs output) | ||
var fileA = FILE_RE.exec(a)[1] | ||
var fileB = FILE_RE.exec(b)[1] | ||
var lineA = Number(LINE_RE.exec(a)[1]) | ||
var lineB = Number(LINE_RE.exec(b)[1]) | ||
var colA = Number(COL_RE.exec(a)[1]) | ||
var colB = Number(COL_RE.exec(b)[1]) | ||
if (fileA !== fileB) return fileA < fileB ? -1 : 1 | ||
if (lineA !== lineB) return lineA - lineB | ||
return colA - colB | ||
}) | ||
.forEach(function (str) { | ||
console.error(' ' + str) // indent | ||
}) | ||
process.exit(1) | ||
} | ||
spawn(JSHINT, jshintArgs, function (err1) { | ||
spawn(JSCS, jscsArgs, function (err2) { | ||
spawn(ESLINT, eslintArgs, function (err3) { | ||
done(err1 || err2 || err3) | ||
}) | ||
}) | ||
}) | ||
}) | ||
stderrPipe(jscs.stdout) | ||
stderrPipe(jscs.stderr) | ||
function spawn (command, args, cb) { | ||
var child = cp.spawn(command, args) | ||
child.on('error', error) | ||
child.on('close', function (code) { | ||
if (code !== 0) cb(new Error('non-zero exit code: ' + code)) | ||
else cb(null) | ||
}) | ||
stderrPipe(child.stdout) | ||
stderrPipe(child.stderr) | ||
return child | ||
} | ||
stderrPipe(jshint.stdout) | ||
stderrPipe(jshint.stderr) | ||
}) | ||
function stderrPipe (readable) { | ||
@@ -133,16 +114,43 @@ readable | ||
if (line === '') return | ||
if (/^\d+ errors?/.test(line)) return | ||
errors.push(line) | ||
}) | ||
} | ||
} | ||
function spawn (command, args, cb) { | ||
var child = cp.spawn(command, args) | ||
child.on('error', error) | ||
child.on('close', function (code) { | ||
if (code !== 0) cb(new Error('non-zero exit code: ' + code)) | ||
else cb(null) | ||
}) | ||
return child | ||
function done (err) { | ||
if (!err) return | ||
if (opts.bare) { | ||
errors.forEach(function (str) { | ||
console.error(str) | ||
}) | ||
return | ||
} | ||
console.error('Error: Code style check failed:') | ||
var errMap = {} | ||
errors | ||
.filter(function (str) { // de-duplicate errors | ||
if (errMap[str]) return false | ||
errMap[str] = true | ||
return true | ||
}) | ||
.sort(function (a, b) { | ||
// sort by line number (merges jshint and jscs output) | ||
var fileA = FILE_RE.exec(a)[1] | ||
var fileB = FILE_RE.exec(b)[1] | ||
var lineA = Number(LINE_RE.exec(a)[1]) | ||
var lineB = Number(LINE_RE.exec(b)[1]) | ||
var colA = Number(COL_RE.exec(a)[1]) | ||
var colB = Number(COL_RE.exec(b)[1]) | ||
if (fileA !== fileB) return fileA < fileB ? -1 : 1 | ||
if (lineA !== lineB) return lineA - lineB | ||
return colA - colB | ||
}) | ||
.forEach(function (str) { | ||
console.error(' ' + str) // indent | ||
}) | ||
process.exit(1) | ||
} | ||
} | ||
@@ -149,0 +157,0 @@ |
var util = require('util') | ||
module.exports = function (errorsCollection) { | ||
var errorCount = 0 | ||
errorsCollection.forEach(function (errors) { | ||
var file = errors.getFilename() | ||
if (!errors.isEmpty()) { | ||
errors.getErrorList().forEach(function (error) { | ||
errorCount++ | ||
var message = error.message.substring(error.rule.length + 2) | ||
console.log(util.format( | ||
'%s:%d:%d: %s (%s)', file, error.line, error.column, message, error.rule | ||
)) | ||
}) | ||
} | ||
if (errors.isEmpty()) return | ||
errors.getErrorList().forEach(function (error) { | ||
var message = error.message.substring(error.rule.length + 2) | ||
console.log(util.format( | ||
'%s:%d:%d: %s (%s)', file, error.line, error.column, message, error.rule | ||
)) | ||
}) | ||
}) | ||
} |
var util = require('util') | ||
module.exports = function (errorsCollection) { | ||
var errorCount = 0 | ||
errorsCollection.forEach(function (errors) { | ||
var file = errors.getFilename() | ||
if (!errors.isEmpty()) { | ||
errors.getErrorList().forEach(function (error) { | ||
errorCount++ | ||
console.log(util.format( | ||
'%s:%d:%d: %s', file, error.line, error.column, error.message | ||
)) | ||
}) | ||
} | ||
if (errors.isEmpty()) return | ||
errors.getErrorList().forEach(function (error) { | ||
console.log(util.format( | ||
'%s:%d:%d: %s', file, error.line, error.column, error.message | ||
)) | ||
}) | ||
}) | ||
} |
{ | ||
"name": "standard", | ||
"description": "JavaScript Standard Style", | ||
"version": "1.5.0", | ||
"version": "2.0.0", | ||
"author": { | ||
@@ -17,2 +17,3 @@ "name": "Feross Aboukhadijeh", | ||
"dependencies": { | ||
"eslint": "^0.13.0", | ||
"find-root": "^0.1.1", | ||
@@ -19,0 +20,0 @@ "glob": "^4.3.5", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
23648
16
263
7
+ Addedeslint@^0.13.0
+ Addedansi-regex@0.2.1(transitive)
+ Addedansi-styles@1.1.0(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedchalk@0.5.1(transitive)
+ Addedconcat-stream@1.6.2(transitive)
+ Addedd@0.1.11.0.2(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddeep-is@0.1.4(transitive)
+ Addeddoctrine@0.6.4(transitive)
+ Addedes5-ext@0.10.64(transitive)
+ Addedes6-iterator@0.1.32.0.3(transitive)
+ Addedes6-map@0.1.5(transitive)
+ Addedes6-set@0.1.6(transitive)
+ Addedes6-symbol@2.0.13.1.4(transitive)
+ Addedes6-weak-map@0.1.4(transitive)
+ Addedescope@2.0.7(transitive)
+ Addedeslint@0.13.0(transitive)
+ Addedesniff@2.0.1(transitive)
+ Addedespree@1.12.3(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedesrecurse@1.2.0(transitive)
+ Addedestraverse-fb@1.3.2(transitive)
+ Addedesutils@1.1.6(transitive)
+ Addedevent-emitter@0.3.5(transitive)
+ Addedext@1.7.0(transitive)
+ Addedfast-levenshtein@1.0.7(transitive)
+ Addedglobals@5.1.0(transitive)
+ Addedhas-ansi@0.1.0(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedlevn@0.2.5(transitive)
+ Addedms@2.0.0(transitive)
+ Addednext-tick@1.1.0(transitive)
+ Addedobject-assign@2.1.1(transitive)
+ Addedoptionator@0.5.0(transitive)
+ Addedprelude-ls@1.1.2(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedstrip-ansi@0.3.0(transitive)
+ Addedsupports-color@0.2.0(transitive)
+ Addedtext-table@0.2.0(transitive)
+ Addedtype@2.7.3(transitive)
+ Addedtype-check@0.3.2(transitive)
+ Addedtypedarray@0.0.6(transitive)
+ Addeduser-home@1.1.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedutil-extend@1.0.3(transitive)
+ Addedwordwrap@0.0.3(transitive)
+ Addedxml-escape@1.0.0(transitive)