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

overrides don't recognize dotfiles #11201

Closed
mysticatea opened this issue Dec 20, 2018 · 3 comments
Closed

overrides don't recognize dotfiles #11201

mysticatea opened this issue Dec 20, 2018 · 3 comments

Comments

@mysticatea
Copy link
Member

@mysticatea mysticatea commented Dec 20, 2018

Tell us about your environment

  • ESLint Version: 5.10.0
  • Node Version: 11.1.0
  • npm Version: 6.5.0

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

  • N/A

Please show your full configuration:

root: true

overrides:
  - files: "*.ts"
    parser: typescript-eslint-parser

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

eslint --print-config .test.ts

What did you expect to happen?

It prints:

{
  "globals": {},
  "env": {},
  "rules": {},
  "parserOptions": {},
  "root": true,
  "files": "*.ts",
  "parser": "typescript-eslint-parser"
}

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

It printed:

{
  "globals": {},
  "env": {},
  "rules": {},
  "parserOptions": {},
  "root": true
}

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

I'm sorry, I don't have enough time for now.

@aladdin-add
Copy link
Member

@aladdin-add aladdin-add commented Dec 22, 2018

is files expected to be an array? I believe eslint should output a warning, rather than ignoring it sliently.

oops, I confirmed the files also accept a single string. sorry for misleading. (@kaicataldo --.)

it actually works, as you are using --print-config .test.ts, and it output the config.

the files is only used in glob matching, I guess it was deleted after that (as in the OP, the files missing).

@kaicataldo
Copy link
Member

@kaicataldo kaicataldo commented Dec 23, 2018

As @aladdin-add mentioned, it looks like the files key is currently expected to be an array (see https://github.com/eslint/eslint/blob/5d451c510c15abc41b5bb14b4955a7db96aeb100/lib/config.js and https://github.com/eslint/eslint/blob/caeb223c4f7b0b6fe35e5348ae0df4c6446b5bed/lib/config/config-ops.js). It also looks like the JSDoc for configOps.pathMatchesGlobs is incorrect.

I think we should fix configOps.pathMatchesGlobs to allow for a single string instead of an array (since it looks like that was the intention), but I also think we should be validating the files key of objects in the overrides array so that it doesn’t silently fail when misconfigured. I’m willing to do the work if we decide to do this. It’s been a while since I looked at the configuration code and I’d like to familiarize myself again.

Edit: Looking at this one more time, I’m actually not so sure that’s what’s happening here. I’ll look again am when I can test it at a computer. I should probably not be doing this on my phone...

@mysticatea
Copy link
Member Author

@mysticatea mysticatea commented Dec 24, 2018

I had written that the code block in "What did you expect to happen?" section is the result of eslint --print-config test.ts (note the dot at the beggining of the filename doesn't exist). So, this means, I expected the following two commands to generate the same config.

eslint --print-config test.ts
eslint --print-config .test.ts

mysticatea added a commit that referenced this issue Dec 31, 2018
@not-an-aardvark not-an-aardvark added this to Ready to merge in v6.0.0 Feb 14, 2019
v6.0.0 automation moved this from Ready to merge to Done Apr 1, 2019
not-an-aardvark added a commit that referenced this issue Apr 1, 2019
chrisblossom added a commit to chrisblossom/typescript-eslint that referenced this issue Jul 22, 2019
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Sep 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
v6.0.0
  
Done
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants