diff --git a/README.md b/README.md index 86b63b8..df44f6f 100644 --- a/README.md +++ b/README.md @@ -55,15 +55,16 @@ var pkg = require('./package.json') module.exports = { // homepage, version and bugs pulled from package.json - eslint: eslint, // pass any version of eslint >= 1.0.0 - cmd: 'pocketlint', // should match the "bin" key in your package.json version: pkg.version, homepage: pkg.homepage, bugs: pkg.bugs.url, + eslint: eslint, // pass any version of eslint >= 1.0.0 + cmd: 'pocketlint', // should match the "bin" key in your package.json tagline: 'Live by your own standards!', // displayed in output --help eslintConfig: { configFile: path.join(__dirname, 'eslintrc.json') }, + cwd: '', // current working directory, passed to eslint // These are optional. If included, the --format option will be made available formatter: require('pocketlint-format'), // note you'll have to create this :) diff --git a/index.js b/index.js index 2a192be..87cad21 100644 --- a/index.js +++ b/index.js @@ -28,6 +28,7 @@ function Linter (opts) { self.cmd = opts.cmd || 'standard' self.eslint = opts.eslint + self.cwd = opts.cwd if (!self.eslint) throw new Error('opts.eslint option is required') self.eslintConfig = defaults(opts.eslintConfig, { @@ -120,7 +121,7 @@ Linter.prototype.parseOpts = function (opts) { opts = extend(opts) opts.eslintConfig = extend(self.eslintConfig) - if (!opts.cwd) opts.cwd = process.cwd() + if (!opts.cwd) opts.cwd = self.cwd || process.cwd() if (!opts.ignore) opts.ignore = [] opts.ignore = opts.ignore.concat(DEFAULT_IGNORE)