Skip to content

Commit

Permalink
Use cwd option for createEslintFix
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisl9029 committed Sep 9, 2019
1 parent c87b69b commit 155c31d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ function createPrettify(formatOptions, prettierPath) {

function createEslintFix(eslintConfig, eslintPath) {
return function eslintFix(text, filePath) {
const cliEngine = getESLintCLIEngine(eslintPath, eslintConfig);
const cliEngine = getESLintCLIEngine(eslintPath, {
...eslintConfig,
...(filePath ? { cwd: path.dirname(filePath) } : {})
});
try {
logger.trace(`calling cliEngine.executeOnText with the text`);
const report = cliEngine.executeOnText(text, filePath, true);
Expand Down

0 comments on commit 155c31d

Please sign in to comment.