-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
envs in overrides was not applied #11577
envs in overrides was not applied #11577
Comments
I've created a repro: https://github.com/aladdin-add/eslint-issue-11577 |
How about removing
|
it works! I'm not sure if it is a bug. |
Indeed, I agree that it's surprising if
It may be isaacs/minimatch#30. |
I would argue that this is unexpected/unintended behavior and is a bug. |
How about switching to https://github.com/micromatch/micromatch which is also widely used? |
I'm not positive to switch library because I'm not sure how the switch changes ESLint's behavior. |
They documented a notable difference: https://github.com/micromatch/micromatch#backslashes , and can we mark it as a breaking change if we decide to switch? |
Nice document. Hmm, I think that ESLint pretty depends on the Minimatch's spec that replaces |
TLDR; fwiw the reason that micromatch doesn't replace 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.) |
Well, just ignore my suggestion. |
Nope. Two things:
// strip leading "./" and normalize windows slashes to posix slashes
const format = str => str.replace(/^\.\/, '').replace(/\\/, '/'); |
This issue is that
I'm not sure if the option is useful. We can fix paths before we pass it to minimatch/micromatch. |
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.
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
The text was updated successfully, but these errors were encountered: