question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Relative paths are broken with eslint 6.7.0

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Reactions:14
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
weekitmocommented, Dec 12, 2019

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}'",

11reactions
brettjonesdevcommented, Nov 23, 2019

A workaround I found is to just inject pwd output into the command in your scripts: "test": "prettier-eslint \"$(pwd)/**/*.js\" --list-different"

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found