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
Override files globbing logic breaks with --config #11558
Comments
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
Never even triaged :( |
Apologies @epmatsw, the ESLint team has been very busy lately and things have slipped through the cracks. I'll reopen this. |
@eslint/eslint-team Thoughts? This seems like undesirable behavior to me. |
what if creating an eslint config in cwd? |
ESLint makes the paths to source codes to the relative paths from the config file then compares with glob patterns. By the way, how does |
Wrote up a quick demo in https://github.com/epmatsw/eslintglobs.
Basically, to answer @mysticatea's question, it looks like |
Hmm.
The two indicate the paths are relative to the However, On the other hand, "Ignoring Files and Directories" section says "Paths are relative to .eslintignore location or the current working directory." But this description is not changed since ESLint 2.0.0; I think this documentation is outdated. |
Any more thoughts on this? Seems like it would probably be a breaking change to fix it, and it looks like the window for 6.0 is closing soon... |
|
Ah, bummer.
It might be, but I think it's not optimal. It makes it really difficult to use (Note: this is in the 5.x series, it's possible that the overrides changes in 6.x will fix this in some other way or make people write configs that are less likely to trigger this issue) |
I run into exactly the same issue as I learned after filing #12278 which was closed as a duplicate. You can find more details there. I also think that ESLint should scan from the project’s current directory when executing with —config option. |
I have posted an RFC eslint/rfcs#37. |
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
In this case, I have a configuration that is inside of my node_modules, or another subdirectory. Using the
--config
flag, I use that file directly rather than having a config in the root of my project. In the file, as above, I've got a glob that should match some files. However, that glob is not matched correctly. In particular, ingetConfigVector
inconfig
, we useconfig.baseDirectory
to compute a relative path. In this case, because the config is in a sibling directory, that relative path starts with something like../
, which makes the glob always fail.eslint --config ./configs/.eslintrc.json .
What did you expect to happen?
It seems likely that if someone is using
--config
, they probably want the globs to be computed relative tocwd
rather than wherever that config happens to be on disk.What actually happened? Please include the actual, raw output from ESLint.
Globs are computed relative to the config's location on disk, which makes them not work super well.
Are you willing to submit a pull request to fix this bug?
The text was updated successfully, but these errors were encountered: