Relative paths are broken with eslint 6.7.0
See original GitHub issueI recently upgrade my eslint
and prettier-eslint-cli
dependencies in a project, and ran into an error when running prettier-eslint
command.
I have created a repository which reproduces the issue.
There appears to be a bug within prettier-eslint-cli
which breaks relative paths in file globs. Here’s what I get when I run prettier-eslint
:
> prettier-eslint './src/**/*.js' --list-different
prettier-eslint-cli [ERROR]: There was an error formatting "level1-dir/level2-dir2/test.js":
Error: EISDIR: illegal operation on a directory, read
prettier-eslint [ERROR]: There was trouble creating the ESLint CLIEngine.
prettier-eslint-cli [ERROR]: There was an error formatting "level1-dir/level1-dir1/index.js":
AssertionError [ERR_ASSERTION]: 'basePath' should be an absolute path.
at new IgnorePattern (~/prettier-eslint-dir-issue-repro/node_modules/eslint/lib/cli-engine/config-array/ignore-pattern.js:178:9)
I tested, and it turns out that sure enough, if I replace './src/**/*.js
with an absolute path: /Users/brett/projects/repo/src/**/*.js
, then prettier-eslint
works as expected.
Version:
"eslint": "6.7.0",
"eslint-plugin-import": "2.18.2",
"prettier-eslint-cli": "5.0.0",
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:12 (3 by maintainers)
Top Results From Across the Web
babel-eslint and prettier-eslint-cli Are Broken | rockyourcode
Relative paths are broken with prettier-eslint-cli and eslint ... There is a workaround for Linux and MacOS: inject $(pwd) before the file path....
Read more >After upgrading to vue-cli-4, relative paths no longer work in ...
Now I'm going to try to track down this breaking change. So anyone out there that runs into something similar, make sure the...
Read more >eslint-plugin-no-relative-import-paths - npm
Moving a file to different folder, could result in changing all imports statement in that file. This will not happen is the import...
Read more >Changelog - Cypress Documentation
Fixed an issue where absolute path glob manipulation was incorrectly breaking supportFile and specPattern glob patterns that contained deep instances of the ...
Read more >linux - Relative path to anything not working (while running ...
After reading this post, the problem is solved! I had noticed when running the mount command that two entries appeared for / :...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
the same error,i replaced eslint version to 6.0.1 and the error disappears
or in pkg scripts
"format": "prettier-eslint --write $PWD/'src/**/*.{js,ts,jsx,tsx,vue}' $PWD/'*.{js,ts}'",
A workaround I found is to just inject
pwd
output into the command in yourscripts
:"test": "prettier-eslint \"$(pwd)/**/*.js\" --list-different"