Skip to content

Commit

Permalink
fix(format-files): ensure paths passed to prettier-eslint are absol…
Browse files Browse the repository at this point in the history
…ute paths

As of the 6.7.0 release of eslint, absolute paths are required when eslint is
searching for ignore patterns (eslint/eslint@ca3b2a6).
This causes prettier-eslint-cli to fail if called with a glob pattern using
relative paths. This commit passes the file path through the `path.resolve` method
to ensure they are always absolute paths.

Addresses issues #205 & #208
  • Loading branch information
dpwilhelmsen committed Apr 19, 2020
1 parent 29db6b5 commit 7c885bb
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 7 deletions.
13 changes: 12 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,18 @@
"contributions": [
"doc"
]
},
{
"login": "dpwilhelmsen",
"name": "Daniel Wilhelmsen",
"avatar_url": "https://avatars3.githubusercontent.com/u/1758049?v=4",
"profile": "http://danielwilhelmsen.com",
"contributions": [
"code",
"maintenance"
]
}
],
"repoType": "github"
"repoType": "github",
"commitConvention": "none"
}
43 changes: 38 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,44 @@ Any linter that support ESLint [CLIEngine](http://eslint.org/docs/developer-guid
Thanks goes to these people ([emoji key][emojis]):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=kentcdodds "Code") [📖](https://github.com/prettier/prettier-eslint-cli/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=kentcdodds "Tests") | [<img src="https://avatars3.githubusercontent.com/u/3266363?v=3" width="100px;"/><br /><sub><b>Adam Harris</b></sub>](https://github.com/aharris88)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=aharris88 "Code") [📖](https://github.com/prettier/prettier-eslint-cli/commits?author=aharris88 "Documentation") [👀](#review-aharris88 "Reviewed Pull Requests") | [<img src="https://avatars.githubusercontent.com/u/622118?v=3" width="100px;"/><br /><sub><b>Eric McCormick</b></sub>](https://ericmccormick.io)<br />[👀](#review-edm00se "Reviewed Pull Requests") | [<img src="https://avatars.githubusercontent.com/u/12389411?v=3" width="100px;"/><br /><sub><b>Joel Sequeira</b></sub>](https://github.com/joelseq)<br />[📖](https://github.com/prettier/prettier-eslint-cli/commits?author=joelseq "Documentation") | [<img src="https://avatars.githubusercontent.com/u/103008?v=3" width="100px;"/><br /><sub><b>Frank Taillandier</b></sub>](https://frank.taillandier.me)<br /> | [<img src="https://avatars3.githubusercontent.com/u/292365?v=3" width="100px;"/><br /><sub><b>Adam Stankiewicz</b></sub>](http://sheerun.net)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=sheerun "Code") | [<img src="https://avatars3.githubusercontent.com/u/487068?v=3" width="100px;"/><br /><sub><b>Stephen John Sorensen</b></sub>](http://www.stephenjohnsorensen.com/)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=spudly "Code") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [<img src="https://avatars0.githubusercontent.com/u/11560964?v=3" width="100px;"/><br /><sub><b>Gandem</b></sub>](https://github.com/Gandem)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=Gandem "Code") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=Gandem "Tests") | [<img src="https://avatars0.githubusercontent.com/u/129991?v=3" width="100px;"/><br /><sub><b>Matteo Ronchi</b></sub>](https://github.com/cef62)<br />[🐛](https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Acef62 "Bug reports") [💻](https://github.com/prettier/prettier-eslint-cli/commits?author=cef62 "Code") | [<img src="https://avatars2.githubusercontent.com/u/61787?v=3" width="100px;"/><br /><sub><b>Benoît Zugmeyer</b></sub>](https://github.com/BenoitZugmeyer)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=BenoitZugmeyer "Code") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=BenoitZugmeyer "Tests") | [<img src="https://avatars0.githubusercontent.com/u/5038030?v=3" width="100px;"/><br /><sub><b>Charlike Mike Reagent</b></sub>](https://i.am.charlike.online)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=tunnckoCore "Code") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=tunnckoCore "Tests") | [<img src="https://avatars0.githubusercontent.com/u/10954870?v=3" width="100px;"/><br /><sub><b>Dion Dirza</b></sub>](https://github.com/diondirza)<br />[🐛](https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Adiondirza "Bug reports") | [<img src="https://avatars0.githubusercontent.com/u/3297808?v=3" width="100px;"/><br /><sub><b>mrm007</b></sub>](https://github.com/mrm007)<br />[🐛](https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Amrm007 "Bug reports") [💻](https://github.com/prettier/prettier-eslint-cli/commits?author=mrm007 "Code") | [<img src="https://avatars0.githubusercontent.com/u/193238?v=3" width="100px;"/><br /><sub><b>Jack Franklin</b></sub>](http://www.jackfranklin.co.uk)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=jackfranklin "Code") |
| [<img src="https://avatars0.githubusercontent.com/u/17342435?v=3" width="100px;"/><br /><sub><b>Ryan Zimmerman</b></sub>](http://www.ryanzim.com)<br />[📖](https://github.com/prettier/prettier-eslint-cli/commits?author=RyanZim "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/1186409?v=3" width="100px;"/><br /><sub><b>Paolo Moretti</b></sub>](http://stackoverflow.com/users/63011)<br />[🐛](https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Amoretti "Bug reports") [💻](https://github.com/prettier/prettier-eslint-cli/commits?author=moretti "Code") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=moretti "Tests") | [<img src="https://avatars0.githubusercontent.com/u/6242574?v=3" width="100px;"/><br /><sub><b>bySabi Files</b></sub>](https://github.com/bySabi)<br />[📖](https://github.com/prettier/prettier-eslint-cli/commits?author=bySabi "Documentation") [🔧](#tool-bySabi "Tools") | [<img src="https://avatars1.githubusercontent.com/u/554231?v=4" width="100px;"/><br /><sub><b>Pavel Pertsev</b></sub>](http://morhetz.com)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=morhetz "Code") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=morhetz "Tests") | [<img src="https://avatars3.githubusercontent.com/u/13577271?v=4" width="100px;"/><br /><sub><b>Josh English</b></sub>](http://www.joshenglish.com)<br />[⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=jmenglis "Tests") [🐛](https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Ajmenglis "Bug reports") [💻](https://github.com/prettier/prettier-eslint-cli/commits?author=jmenglis "Code") [🔌](#plugin-jmenglis "Plugin/utility libraries") | [<img src="https://avatars2.githubusercontent.com/u/1706502?v=4" width="100px;"/><br /><sub><b>Spenser Isdahl</b></sub>](https://disquisition.net)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=disquisition "Code") [📖](https://github.com/prettier/prettier-eslint-cli/commits?author=disquisition "Documentation") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=disquisition "Tests") | [<img src="https://avatars0.githubusercontent.com/u/10961167?v=4" width="100px;"/><br /><sub><b>Björn Dalfors</b></sub>](https://github.com/bj00rn)<br />[🚇](#infra-bj00rn "Infrastructure (Hosting, Build-Tools, etc)") |
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://kentcdodds.com"><img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;" alt=""/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=kentcdodds" title="Code">💻</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=kentcdodds" title="Documentation">📖</a> <a href="#infra-kentcdodds" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=kentcdodds" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/aharris88"><img src="https://avatars3.githubusercontent.com/u/3266363?v=3" width="100px;" alt=""/><br /><sub><b>Adam Harris</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=aharris88" title="Code">💻</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=aharris88" title="Documentation">📖</a> <a href="https://github.com/prettier/prettier-eslint-cli/pulls?q=is%3Apr+reviewed-by%3Aaharris88" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://ericmccormick.io"><img src="https://avatars.githubusercontent.com/u/622118?v=3" width="100px;" alt=""/><br /><sub><b>Eric McCormick</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/pulls?q=is%3Apr+reviewed-by%3Aedm00se" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://github.com/joelseq"><img src="https://avatars.githubusercontent.com/u/12389411?v=3" width="100px;" alt=""/><br /><sub><b>Joel Sequeira</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=joelseq" title="Documentation">📖</a></td>
<td align="center"><a href="https://frank.taillandier.me"><img src="https://avatars.githubusercontent.com/u/103008?v=3" width="100px;" alt=""/><br /><sub><b>Frank Taillandier</b></sub></a><br /></td>
<td align="center"><a href="http://sheerun.net"><img src="https://avatars3.githubusercontent.com/u/292365?v=3" width="100px;" alt=""/><br /><sub><b>Adam Stankiewicz</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=sheerun" title="Code">💻</a></td>
<td align="center"><a href="http://www.stephenjohnsorensen.com/"><img src="https://avatars3.githubusercontent.com/u/487068?v=3" width="100px;" alt=""/><br /><sub><b>Stephen John Sorensen</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=spudly" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/Gandem"><img src="https://avatars0.githubusercontent.com/u/11560964?v=3" width="100px;" alt=""/><br /><sub><b>Gandem</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=Gandem" title="Code">💻</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=Gandem" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/cef62"><img src="https://avatars0.githubusercontent.com/u/129991?v=3" width="100px;" alt=""/><br /><sub><b>Matteo Ronchi</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Acef62" title="Bug reports">🐛</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=cef62" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/BenoitZugmeyer"><img src="https://avatars2.githubusercontent.com/u/61787?v=3" width="100px;" alt=""/><br /><sub><b>Benoît Zugmeyer</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=BenoitZugmeyer" title="Code">💻</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=BenoitZugmeyer" title="Tests">⚠️</a></td>
<td align="center"><a href="https://i.am.charlike.online"><img src="https://avatars0.githubusercontent.com/u/5038030?v=3" width="100px;" alt=""/><br /><sub><b>Charlike Mike Reagent</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=tunnckoCore" title="Code">💻</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=tunnckoCore" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/diondirza"><img src="https://avatars0.githubusercontent.com/u/10954870?v=3" width="100px;" alt=""/><br /><sub><b>Dion Dirza</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Adiondirza" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/mrm007"><img src="https://avatars0.githubusercontent.com/u/3297808?v=3" width="100px;" alt=""/><br /><sub><b>mrm007</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Amrm007" title="Bug reports">🐛</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=mrm007" title="Code">💻</a></td>
<td align="center"><a href="http://www.jackfranklin.co.uk"><img src="https://avatars0.githubusercontent.com/u/193238?v=3" width="100px;" alt=""/><br /><sub><b>Jack Franklin</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=jackfranklin" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="http://www.ryanzim.com"><img src="https://avatars0.githubusercontent.com/u/17342435?v=3" width="100px;" alt=""/><br /><sub><b>Ryan Zimmerman</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=RyanZim" title="Documentation">📖</a></td>
<td align="center"><a href="http://stackoverflow.com/users/63011"><img src="https://avatars3.githubusercontent.com/u/1186409?v=3" width="100px;" alt=""/><br /><sub><b>Paolo Moretti</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Amoretti" title="Bug reports">🐛</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=moretti" title="Code">💻</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=moretti" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/bySabi"><img src="https://avatars0.githubusercontent.com/u/6242574?v=3" width="100px;" alt=""/><br /><sub><b>bySabi Files</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=bySabi" title="Documentation">📖</a> <a href="#tool-bySabi" title="Tools">🔧</a></td>
<td align="center"><a href="http://morhetz.com"><img src="https://avatars1.githubusercontent.com/u/554231?v=4" width="100px;" alt=""/><br /><sub><b>Pavel Pertsev</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=morhetz" title="Code">💻</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=morhetz" title="Tests">⚠️</a></td>
<td align="center"><a href="http://www.joshenglish.com"><img src="https://avatars3.githubusercontent.com/u/13577271?v=4" width="100px;" alt=""/><br /><sub><b>Josh English</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=jmenglis" title="Tests">⚠️</a> <a href="https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Ajmenglis" title="Bug reports">🐛</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=jmenglis" title="Code">💻</a> <a href="#plugin-jmenglis" title="Plugin/utility libraries">🔌</a></td>
<td align="center"><a href="https://disquisition.net"><img src="https://avatars2.githubusercontent.com/u/1706502?v=4" width="100px;" alt=""/><br /><sub><b>Spenser Isdahl</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=disquisition" title="Code">💻</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=disquisition" title="Documentation">📖</a> <a href="https://github.com/prettier/prettier-eslint-cli/commits?author=disquisition" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/bj00rn"><img src="https://avatars0.githubusercontent.com/u/10961167?v=4" width="100px;" alt=""/><br /><sub><b>Björn Dalfors</b></sub></a><br /><a href="#infra-bj00rn" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/sscaff1"><img src="https://avatars1.githubusercontent.com/u/1554424?v=4" width="100px;" alt=""/><br /><sub><b>Steven Scaffidi</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=sscaff1" title="Documentation">📖</a></td>
<td align="center"><a href="http://danielwilhelmsen.com"><img src="https://avatars3.githubusercontent.com/u/1758049?v=4" width="100px;" alt=""/><br /><sub><b>Daniel Wilhelmsen</b></sub></a><br /><a href="https://github.com/prettier/prettier-eslint-cli/commits?author=dpwilhelmsen" title="Code">💻</a> <a href="#maintenance-dpwilhelmsen" title="Maintenance">🚧</a></td>
</tr>
</table>

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

Expand Down
3 changes: 2 additions & 1 deletion src/format-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ function formatFilesFromGlobs({
.subscribe(onNext, onError, onComplete);

function filePathToFormatted(filePath) {
return formatFile(filePath, prettierESLintOptions, cliOptions);
const absoluteFilePath = path.resolve(filePath);
return formatFile(absoluteFilePath, prettierESLintOptions, cliOptions);
}

function onNext(info) {
Expand Down

0 comments on commit 7c885bb

Please sign in to comment.