Skip to content

Commit

Permalink
Merge pull request #73 from Flet/fix-snazzy-8
Browse files Browse the repository at this point in the history
support passing `cwd` option in Linter constructor
  • Loading branch information
feross committed Feb 18, 2016
2 parents bd60ac4 + 17e990d commit e8934df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 :)
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e8934df

Please sign in to comment.