eslint: Can't pass dot/hidden files on command line

Hello, since JavaScript config files are supported now, can you please consider adding a (at least optional) way to ask eslint to lint also hidden/dot files (e.g. .eslintrc.js or .eslintrc.json with the JSON plugin) if a name to a directory is passed (e.g. eslint .)?

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 50 (38 by maintainers)

Commits related to this issue

Most upvoted comments

@alberto

So if we do eslint node_modules should we also lint that?

Yes because it was passed on the command line.

What about eslint . with a node_modules folder?

No because it wasn’t passed on the command line.

Thanks. So this looks like a bug, we should be linting anything passed on the command line. We should fix that.

He’s proposing to change glob options in glob-util to make it consider dot files and folders. This won’t change anything by default since they are ignored by eslint, but it will allow unignoring them in .eslintignore. I’m 👍 on that.

Regarding my last statement above, I think this highlights a deeper problem, similar to https://github.com/eslint/eslint/issues/5547. Using --no-ignore should not unignore the default ignores (dependency folders and dotfiles).

So to be clear, my proposal is:

  1. Prevent dotfiles from being unignored by --no-ignore.
  2. Return dotfiles from glob-util as described in https://github.com/eslint/eslint/issues/4828#issuecomment-206016457.

Actually now that you mention that, it should already be possible, by putting !.* in the .eslintignore (in 2.5.0 onward).

@radek-holy, could you try that and see if it meets your need?

@radek-holy you asked for a way to pass dot files to be linted, we said you should be able to do so on the change line, but it turns out that doesn’t work. To me, everything in this issue makes sense.

@IanVS @alberto Id say let’s focus on making sure anything passed on the command line is linted. If you want to talk about maybe unignoring dot files, then a new issue is a good idea.