-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(format-files): ensure paths passed to prettier-eslint
are absolute paths
#259
Conversation
…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 prettier#205 & prettier#208
7c885bb
to
4b9682b
Compare
Codecov Report
@@ Coverage Diff @@
## master #259 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 123 124 +1
Branches 16 16
=========================================
+ Hits 123 124 +1
Continue to review full report at Codecov.
|
This PR solved my issue. I am hoping for this PR to be merged |
Bump :) |
@kentcdodds What needs to happen for this to be merged? |
Sorry, I haven't maintained this project for years now. You'll need to find an active maintainer. |
+1 would be nice to get this fixed |
Looks like this repo is dead |
🎉 This PR is included in version 5.0.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
What:
This addresses the error reported in #205 & #208.
Error: 'basePath' should be an absolute path
Why:
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 PR ensures they are always absolute paths.
As an example, this command would fail:
prettier-eslint --list-different --write "./src/**/*.{js,jsx}"
To get it working with
eslint@^6.7.0
, you'd have to find a way to ensure the paths are absolute in the glob, like this:prettier-eslint --list-different --write "$(pwd)/src/**/*.{js,jsx}"
This change would make either glob pattern valid.
How:
In
format-files.js
thefilePathToFormatted
has been updated to run thefilePath
variable throughpath.resolve()
to ensure it is an absolute path before being passed into theformatFile
method.