standard-engine
Advanced tools
Comparing version 1.10.1 to 1.10.2
@@ -84,3 +84,3 @@ module.exports = Cli | ||
var lintOpts = { | ||
parser: argv.parser | ||
parser: argv.parser | ||
} | ||
@@ -87,0 +87,0 @@ |
@@ -5,2 +5,8 @@ # standard-engine Change Log | ||
## 1.10.2 2015-07-17 | ||
* Merged standard 4.5.4 changes: switch to using `deglob` | ||
## 1.10.1 2015-07-06 | ||
* Removed a stray console.log | ||
## 1.10.0 2015-07-06 | ||
@@ -7,0 +13,0 @@ * Fix bug in custom parser option to make it work. |
93
index.js
@@ -6,2 +6,3 @@ module.exports.cli = require('./bin/cmd') | ||
var defaults = require('defaults') | ||
var deglob = require('deglob') | ||
var dezalgo = require('dezalgo') | ||
@@ -12,9 +13,5 @@ var eslint = require('eslint') | ||
var fs = require('fs') | ||
var glob = require('glob') | ||
var ignorePkg = require('ignore') | ||
var os = require('os') | ||
var parallel = require('run-parallel') | ||
var path = require('path') | ||
var pkgConfig = require('pkg-config') | ||
var uniq = require('uniq') | ||
@@ -95,39 +92,18 @@ var DEFAULT_PATTERNS = [ | ||
// traverse filesystem | ||
parallel(files.map(function (pattern) { | ||
return function (cb) { | ||
glob(pattern, { | ||
cwd: opts.cwd, | ||
ignore: opts._ignore, | ||
nodir: true | ||
}, cb) | ||
} | ||
}), function (err, results) { | ||
var deglobOpts = { | ||
ignore: opts.ignore, | ||
cwd: opts.cwd, | ||
useGitIgnore: true, | ||
usePackageJson: true, | ||
configKey: self.cmd | ||
} | ||
deglob(files, deglobOpts, function (err, allFiles) { | ||
if (err) return cb(err) | ||
// flatten nested arrays | ||
var files = results.reduce(function (files, result) { | ||
result.forEach(function (file) { | ||
files.push(path.resolve(opts.cwd, file)) | ||
}) | ||
return files | ||
}, []) | ||
// de-dupe | ||
files = uniq(files) | ||
if (opts._gitignore) { | ||
files = toRelative(opts.cwd, files) | ||
if (os.platform() === 'win32') files = toUnix(files) | ||
files = opts._gitignore.filter(files) | ||
files = toAbsolute(opts.cwd, files) | ||
if (os.platform() === 'win32') files = toWin32(files) | ||
} | ||
// undocumented – do not use (used by bin/cmd.js) | ||
if (opts._onFiles) opts._onFiles(files) | ||
if (opts._onFiles) opts._onFiles(allFiles) | ||
var result | ||
try { | ||
result = new eslint.CLIEngine(self.eslintConfig).executeOnFiles(files) | ||
result = new eslint.CLIEngine(self.eslintConfig).executeOnFiles(allFiles) | ||
} catch (err) { | ||
@@ -138,2 +114,3 @@ return cb(err) | ||
}) | ||
} | ||
@@ -149,11 +126,7 @@ | ||
opts._ignore = DEFAULT_IGNORE_PATTERNS.slice(0) // passed into glob | ||
opts._gitignore = ignorePkg() | ||
var ignore = DEFAULT_IGNORE_PATTERNS.slice(0) // passed into glob | ||
function addIgnorePattern (patterns) { | ||
opts._ignore = opts._ignore.concat(patterns) | ||
opts._gitignore.addPattern(patterns) | ||
} | ||
if (opts.ignore) ignore.concat(opts.ignore) | ||
opts.ignore = ignore | ||
if (opts.ignore) addIgnorePattern(opts.ignore) | ||
if (opts.parser) useCustomParser(opts.parser) | ||
@@ -171,5 +144,2 @@ | ||
if (packageOpts) { | ||
// Use ignore patterns from package.json ("standard.ignore" property) | ||
if (packageOpts.ignore) addIgnorePattern(packageOpts.ignore) | ||
// Use globals from package.json ("standard.global" property) | ||
@@ -186,9 +156,2 @@ var globals = packageOpts.globals || packageOpts.global | ||
} | ||
// Use ignore patterns from project root .gitignore | ||
var gitignore | ||
try { | ||
gitignore = fs.readFileSync(path.join(root, '.gitignore'), 'utf8') | ||
} catch (e) {} | ||
if (gitignore) opts._gitignore.addPattern(gitignore.split(/\r?\n/)) | ||
} | ||
@@ -207,25 +170,1 @@ | ||
} | ||
function toAbsolute (cwd, files) { | ||
return files.map(function (file) { | ||
return path.join(cwd, file) | ||
}) | ||
} | ||
function toRelative (cwd, files) { | ||
return files.map(function (file) { | ||
return path.relative(cwd, file) | ||
}) | ||
} | ||
function toUnix (files) { | ||
return files.map(function (file) { | ||
return file.replace(/\\/g, '/') | ||
}) | ||
} | ||
function toWin32 (files) { | ||
return files.map(function (file) { | ||
return file.replace(/\//g, '\\') | ||
}) | ||
} |
{ | ||
"name": "standard-engine", | ||
"description": "Wrap your standards in a tortilla and cover it in special sauce.", | ||
"version": "1.10.1", | ||
"version": "1.10.2", | ||
"author": "Dan Flettre <flettre@gmail.com> (http://twitter.com/flettre/)", | ||
@@ -11,12 +11,9 @@ "bugs": { | ||
"defaults": "^1.0.2", | ||
"deglob": "^1.0.0", | ||
"dezalgo": "^1.0.2", | ||
"eslint": "^0.24.0", | ||
"eslint": "0.24.1", | ||
"find-root": "^0.1.1", | ||
"get-stdin": "^4.0.1", | ||
"glob": "^5.0.9", | ||
"ignore": "^2.2.15", | ||
"minimist": "^1.1.0", | ||
"pkg-config": "^1.0.1", | ||
"run-parallel": "^1.0.0", | ||
"uniq": "^1.0.1", | ||
"xtend": "^4.0.0" | ||
@@ -23,0 +20,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
9
24340
514
+ Addeddeglob@^1.0.0
+ Addeddeglob@1.1.2(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedignore@3.3.10(transitive)
+ Addedminimatch@3.1.2(transitive)
- Removedglob@^5.0.9
- Removedignore@^2.2.15
- Removedrun-parallel@^1.0.0
- Removeduniq@^1.0.1
- Removedglob@5.0.15(transitive)
- Removedignore@2.2.19(transitive)
Updatedeslint@0.24.1