Skip to content

Commit

Permalink
fix(parser): coerce non-absolute paths to cwd (#22)
Browse files Browse the repository at this point in the history
Closes #9
  • Loading branch information
Kent C. Dodds committed Feb 21, 2017
1 parent 24818a6 commit 31e9e92
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/parser.js
Expand Up @@ -19,8 +19,12 @@ const parser = yargs
eslintPath: {
default: getPathInHostNodeModules('eslint'),
describe: 'The path to the eslint module to use',
coerce: coercePath,
},
prettierPath: {
describe: 'The path to the prettier module to use',
coerce: coercePath,
},
prettierPath: {describe: 'The path to the prettier module to use'},
ignore: {
describe: oneLine`
pattern(s) you wish to ignore
Expand Down Expand Up @@ -61,3 +65,7 @@ function getPathInHostNodeModules(module) {
return path.relative(__dirname, `../node_modules/${module}`)
}
}

function coercePath(input) {
return path.isAbsolute(input) ? input : path.join(process.cwd(), input)
}

0 comments on commit 31e9e92

Please sign in to comment.