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.

envs in overrides was not applied

See original GitHub issue

Tell us about your environment

  • ESLint Version: v5.16.0
  • Node Version: v10.15.3
  • npm Version: 6.9.0

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

Please show your full configuration:

Configuration
  "eslintConfig": {
    "extends": [
      "eslint:recommended"
    ],
    "overrides": [
      {
        "files": [
          "./lib/*.js"
        ],
        "env": {
          "browser": true
        }
      }
    ]
  },

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

'use strict';

window.console.log('hello');

What did you expect to happen? not error reported, since it has setting env "browser": true

What actually happened? Please include the actual, raw output from ESLint.

/Users/weiran/repo/work/eslint-issue/lib/index.js
  3:1  error  'window' is not defined  no-unde

Are you willing to submit a pull request to fix this bug? yes

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
jonschlinkertcommented, Jun 3, 2019

Minimatch’s spec that replaces \ by / on Windows.

TLDR; fwiw the reason that micromatch doesn’t replace \ is that it’s unsafe. Occasionally users will create issues about it, but it’s easy to resolve and results in educating a user. Zero issues would be best, but we’d rather have issues about implementation problems than vulnerabilities and ReDoS.


If you’re interested in a little more info about why it’s unsafe to convert backslashes…

Since globs are converted to regular expressions, when backslashes are converted to forward slashes it can change the intent of the glob and match things that shouldn’t be matched, or create a malicious regular expression that can lead to DoS. I’ve seen many naive and clever attempts at guessing when backslashes should be converted, but there are so many different edge cases that it’s just not worth the risk and headache - especially since globs are often joined to path parts before passing them to a matcher, which further complicates the guesswork of determining whether or not 1) slashes can be safely converted, and that 2) converting slashes will not change the intent of the glob pattern (and ultimately the regex).

Also fwiw, in case you’re concerned about breaking people’s configs and getting a bunch of issues. Micromatch has something like 2.5m dependents, and believe me, we were cringing when we made the decision to enforce this with users. But I have to say it wasn’t nearly as bad as we anticipated. We’ll get an issue about it every now and then… maybe 4-6 a year. But I don’t recall seeing any issues about this in months, and we even have a tool that “watches” issues on every repository on GitHub so that we can be notified in near real-time when something needs to be triaged.

(Please don’t take my comment as an attempt to persuade you to use Micromatch. I don’t expect that and wouldn’t judge you for not switching. I just figured I’d drop by and share some things we’ve learned.)

1reaction
kaicataldocommented, May 29, 2019

I would argue that this is unexpected/unintended behavior and is a bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to override environment variables if they are present in ...
Description v2.9.0 does not allow environment variables to be overridden if they are already present in .env. Steps to reproduce the issue: ...
Read more >
java - Jenkins API: EnvVars.overrideAll not overriding existing ...
I edited your code to use the overrideAll method. Removing the elements from envs before calling overrideAll did not fix the issue. Thanks...
Read more >
How to overwrite doppler envs? - Need Help
I'm using react/node with nextjs for my projects) Let's say I have an env variable called base_url which points to an API hosted...
Read more >
Overriding One Single Value in Your Docker-Compose .env File
The current default behavior there, is to override env variables with entries from the . env file (as discussed in this issue). Python-dotenv...
Read more >
Create-react-app environments - Medium
If you're using an older version of react-scripts, have not used environment ... Thus others can override variables locally without changing .env.
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