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.

Override files globbing logic breaks with --config

See original GitHub issue

Tell us about your environment

  • ESLint Version: 5.15.3
  • Node Version: 10.15.0
  • npm Version: 6.9.0

What parser (default, Babel-ESLint, etc.) are you using?

Please show your full configuration:

Configuration
{
    "overrides": [{
        "files": ["**/blah.js"],
        "rules": {
            "prefer-const": 0
        }
    }],
    "parserOptions": {
        "ecmaVersion": 2018
    },
    "rules": {
        "prefer-const": 2
    }
}

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, in getConfigVector in config, we use config.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.

N/A
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 to cwd 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?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
mysticateacommented, Sep 19, 2019
1reaction
epmatswcommented, Jun 10, 2019

6.0.0 has been feature-frozen (breaking change frozen) in April.

Ah, bummer.

I think the current behavior is intentional.

It might be, but I think it’s not optimal. It makes it really difficult to use overrides and the --config option together, especially when the overrides can be in files in mostly-unpredictable locations in node_modules.

(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)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it better to specify source files with GLOB or each ...
In order to work around the first issue, you can simply "touch" the CMakeLists. txt that does the glob, either by using the...
Read more >
tmpfiles.d
Files in /etc/tmpfiles.d are reserved for the local administrator, who may use this logic to override the configuration files installed by vendor packages....
Read more >
Configuration options for isort
Additional files that isort should skip over (extending --skip-glob). ... WARNING: this overrides the behavior of future handling and therefore can result ...
Read more >
TSConfig Reference - Docs on every TSConfig option
The configuration from the base file are loaded first, then overridden by those in the inheriting config file. All relative paths found in...
Read more >
Git - git-config Documentation
These environment variables will override values in configuration files, ... Git breaks the cycle by prohibiting these files from affecting the resolution ...
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