Comparing version 0.4.3 to 0.4.4
@@ -28,3 +28,3 @@ 'use strict'; | ||
} | ||
isDupe = !!isDupe; | ||
return !isDupe; | ||
@@ -31,0 +31,0 @@ } |
@@ -69,3 +69,3 @@ 'use strict'; | ||
setRules(dir, files[0], opts.lineLength, setIndentRuleCallback); | ||
setRules(dir, files, opts.lineLength, setIndentRuleCallback); | ||
@@ -118,6 +118,6 @@ function setIndentRuleCallback(err) { | ||
return function lint(files, readFromStdin) { | ||
return function lint(files, opts) { | ||
files.sort(); | ||
var streams = linters.map(function initLinter(linterName) { | ||
var stream = lintStream(linterName, files, readFromStdin); | ||
var stream = lintStream(linterName, files, opts); | ||
return stream; | ||
@@ -124,0 +124,0 @@ }); |
'use strict'; | ||
var lintStream = require('./lint-stream')(); | ||
var makeStylishStreamWriter = require('./stylish-stream-reporter'); | ||
var printStylish = require('./stylish-reporter'); | ||
var printCheckstyle = require('./checkstyle-reporter'); | ||
@@ -32,3 +32,4 @@ var printJSON = require('./json-reporter'); | ||
process.stdout.write(printer(fileMessages)); | ||
var output = printer(fileMessages); | ||
process.stdout.write(output); | ||
} | ||
@@ -51,3 +52,3 @@ return es.writeArray(writer); | ||
writer = (r === 'stylish') ? makeStylishStreamWriter() : | ||
writer = (r === 'stylish') ? makeWriter(printStylish, callback) : | ||
(r === 'checkstyle') ? makeWriter(printCheckstyle, callback) : | ||
@@ -65,3 +66,2 @@ (r === 'json') ? makeWriter(printJSON, callback) : | ||
uberLintStream.once('error', callback); | ||
uberLintStream.once('end', partial(onEnd, errorMeter, callback)); | ||
@@ -68,0 +68,0 @@ } |
{ | ||
"name": "lint-trap", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "JavaScript linter module for Uber projects", | ||
@@ -5,0 +5,0 @@ "author": "Andrew de Andrade <aandrade@uber.com>", |
'use strict'; | ||
var detectIndent = require('detect-indent'); | ||
var extend = require('extend'); | ||
var path = require('path'); | ||
@@ -35,15 +34,11 @@ var fs = require('fs'); | ||
function updateJSON(jsonPath, diffs, callback) { | ||
jf.readFile(jsonPath, function readFileCallback(err, content) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
Object.keys(diffs).forEach(function applyDiff(diffKey) { | ||
var value = diffs[diffKey]; | ||
dotty.put(content, diffKey, value); | ||
}); | ||
jf.writeFile(jsonPath, content, callback); | ||
function updateJSON(jsonPath, diffs) { | ||
// Synchronous method to be safe since multiple rules might touch the | ||
// same file. | ||
var content = jf.readFileSync(jsonPath); | ||
Object.keys(diffs).forEach(function applyDiff(diffKey) { | ||
var value = diffs[diffKey]; | ||
dotty.put(content, diffKey, value); | ||
}); | ||
jf.writeFileSync(jsonPath, content); | ||
} | ||
@@ -63,3 +58,4 @@ | ||
var diff = { validateIndentation: indent.length }; | ||
updateJSON(jscsrcPath, diff, callback); | ||
updateJSON(jscsrcPath, diff); | ||
callback(); | ||
} | ||
@@ -82,11 +78,9 @@ | ||
var jscsdiff = { | ||
'maximumLineLength.value' : lineLength | ||
'maximumLineLength.value': lineLength | ||
}; | ||
updateJSON(jscsrcPath, jscsdiff, updateEslint); | ||
updateJSON(jscsrcPath, jscsdiff); | ||
updateEslint(); | ||
function updateEslint(err) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
function updateEslint() { | ||
var eslintrcPath = path.resolve(__dirname, './rc/.eslintrc'); | ||
@@ -96,3 +90,4 @@ var eslintdiff = { | ||
}; | ||
updateJSON(eslintrcPath, eslintdiff, callback); | ||
updateJSON(eslintrcPath, eslintdiff); | ||
callback(); | ||
} | ||
@@ -102,2 +97,3 @@ } | ||
function setRules(dir, files, lineLength, callback) { | ||
setIndentRule(dir, files[0], function setIndentRuleCallback(err) { | ||
@@ -104,0 +100,0 @@ if (err) { |
'use strict'; | ||
require('array.prototype.find'); | ||
var lint = require('../lint-stream')(); | ||
var makeLintStream = require('../lint-stream')(); | ||
var path = require('path'); | ||
@@ -19,7 +19,8 @@ var getJavaScriptFiles = require('../get-javascript-files'); | ||
var streamMessages = []; | ||
var uberLintStream = lint(jsfiles); | ||
var opts = { stdin: false, lineLength: 80 }; | ||
var lintStream = makeLintStream(jsfiles, opts); | ||
uberLintStream.on('data', streamMessages.push.bind(streamMessages)); | ||
uberLintStream.on('error', t.fail.bind(t)); | ||
uberLintStream.on('end', onEnd); | ||
lintStream.on('data', streamMessages.push.bind(streamMessages)); | ||
lintStream.on('error', t.fail.bind(t)); | ||
lintStream.on('end', onEnd); | ||
@@ -26,0 +27,0 @@ function onEnd() { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
125196
100
1553