Skip to content
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

Relative paths are broken with eslint 6.7.0 #205

Closed
brettjonesdev opened this issue Nov 23, 2019 · 12 comments · Fixed by peopledoc/eslint-config-peopledoc#71
Closed

Relative paths are broken with eslint 6.7.0 #205

brettjonesdev opened this issue Nov 23, 2019 · 12 comments · Fixed by peopledoc/eslint-config-peopledoc#71

Comments

@brettjonesdev
Copy link

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",
@brettjonesdev
Copy link
Author

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

@weekitmo
Copy link

weekitmo commented Nov 23, 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}'",

@iGuan7u
Copy link

iGuan7u commented Nov 27, 2019

"$(pwd)/**/*.js"

That saved my day. Thx!

@MrCheater
Copy link

+1

@ricahcyuzuzo
Copy link

Truly man This is Great!!

@tr1ms
Copy link

tr1ms commented Jan 31, 2020

I also experience this error with eslint 6.8.0, I think there is an issue with the latest version but roll back to version 6.4.0 worked fine.

dpwilhelmsen added a commit to dpwilhelmsen/prettier-eslint-cli that referenced this issue Apr 19, 2020
…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
dpwilhelmsen added a commit to dpwilhelmsen/prettier-eslint-cli that referenced this issue Apr 19, 2020
…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
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue May 29, 2020
I'm not deeply familiar with the details, but there's an open issue
about an error message we're seeing in the upcoming
`prettier-eslint` update, that says "'basePath' should be an
absolute path.". That's
prettier/prettier-eslint-cli#205.

The first reply at that thread is a workaround that works for us:
make the paths absolute. Instead of using `pwd`, as suggested there,
we reuse our existing `rootdir` variable, which looks like it's
designed for reuse for consistency.
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue May 29, 2020
I'm not deeply familiar with the details, but there's an open issue
about an error message we're seeing in the upcoming
`prettier-eslint` update, that says "'basePath' should be an
absolute path.". That's
prettier/prettier-eslint-cli#205.

The first reply at that thread is a workaround that works for us:
make the paths absolute. Instead of using `pwd`, as suggested there,
we reuse our existing `rootdir` variable, which looks like it's
designed for reuse for consistency.
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jun 11, 2020
I'm not deeply familiar with the details, but there's an open issue
about an error message we're seeing in the upcoming
`prettier-eslint` update, that says "'basePath' should be an
absolute path.". That's
prettier/prettier-eslint-cli#205.

The first reply at that thread is a workaround that works for us:
make the paths absolute. Instead of using `pwd`, as suggested there,
we reuse our existing `rootdir` variable, which looks like it's
designed for reuse for consistency.
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jul 13, 2020
I'm not deeply familiar with the details, but there's an open issue
about an error message we're seeing in the upcoming
`prettier-eslint` update, that says "'basePath' should be an
absolute path.". That's
prettier/prettier-eslint-cli#205.

The first reply at that thread is a workaround that works for us:
make the paths absolute. Instead of using `pwd`, as suggested there,
we reuse our existing `rootdir` variable, which looks like it's
designed for reuse for consistency.

For a discussion that will help clarify the arcane bit of Bash here:
https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.23M4120.20ESLint.206.2E8.2E0.20upgrade/near/889570.
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Aug 1, 2020
I'm not deeply familiar with the details, but there's an open issue
about an error message we're seeing in the upcoming
`prettier-eslint` update, that says "'basePath' should be an
absolute path.". That's
prettier/prettier-eslint-cli#205.

The first reply at that thread is a workaround that works for us:
make the paths absolute. Instead of using `pwd`, as suggested there,
we reuse our existing `rootdir` variable, which looks like it's
designed for reuse for consistency.

For a discussion that will help clarify the arcane bit of Bash here:
https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.23M4120.20ESLint.206.2E8.2E0.20upgrade/near/889570.
gnprice pushed a commit to chrisbobbe/zulip-mobile that referenced this issue Aug 4, 2020
I'm not deeply familiar with the details, but there's an open issue
about an error message we're seeing in the upcoming
`prettier-eslint` update, that says "'basePath' should be an
absolute path.". That's
prettier/prettier-eslint-cli#205.

The first reply at that thread is a workaround that works for us:
make the paths absolute. Instead of using `pwd`, as suggested there,
we reuse our existing `rootdir` variable, which looks like it's
designed for reuse for consistency.

For a discussion that will help clarify the arcane bit of Bash here:
https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.23M4120.20ESLint.206.2E8.2E0.20upgrade/near/889570.
kylemh pushed a commit that referenced this issue Mar 6, 2021
…ute paths (#259)

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
@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2021

Stale issue

@chrisbobbe
Copy link

Was this fixed in #259? 🙂

@gsouf
Copy link

gsouf commented Aug 1, 2022

Short answer - no

@JounQin
Copy link
Member

JounQin commented Aug 7, 2022

https://antfu.me/posts/why-reproductions-are-required

Feel free to create a new issue with minimal but runnable reproduction.

@JounQin JounQin closed this as not planned Won't fix, can't repro, duplicate, stale Aug 7, 2022
@gsouf
Copy link

gsouf commented Aug 7, 2022

@JounQin I think the ticket already describes the issue properly. Can't you reproduce it?

@JounQin
Copy link
Member

JounQin commented Aug 7, 2022

@JounQin I think the ticket already describes the issue properly. Can't you reproduce it?

This ticket is very old and outdated.

Perhaps https://github.com/prettier/prettier-eslint-cli/releases/tag/v5.0.1 has resolved this.

So if you still trouble with this, please feel free to create a new one instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants