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

ESLint doesn't support globbing? #1663

Closed
briandipalma opened this issue Jan 17, 2015 · 12 comments
Closed

ESLint doesn't support globbing? #1663

briandipalma opened this issue Jan 17, 2015 · 12 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon

Comments

@briandipalma
Copy link
Contributor

eslint doesn't seem able to be run on all files in a directory to any depth, is this a limitation of optionator? As it stands I'll have to add all the directories I want linted by hand to the npm script. That's a lot of directories, ** support would be great.

@nzakas
Copy link
Member

nzakas commented Jan 17, 2015

We don't currently support globbing, though you can do eslint . to run on all subdirectories. Does that do what you want?

@nzakas nzakas added the triage An ESLint team member will look at this issue soon label Jan 17, 2015
@briandipalma
Copy link
Contributor Author

According to this SO issue you need an option to be set in bash for ** to expand all files in subdirectories. I guess that's the issue I'm having, as it stands that means I can't rely on npm script to run ESLint over large nested codebases. I was hoping to avoid Gulp for these sort of tasks but it looks like I'd be best using it.

Sorry about the noise of this issue, I incorrectly thought optionator expanded the arguments from npm scripts but the issue seems to be in bash. I think an option in .eslintrc to specify a minimatch glob for the files to lint would be handy though. Will I leave this open as a feature request or close it?

@nzakas
Copy link
Member

nzakas commented Jan 17, 2015

You can use eslint . in the root directory of a project and it will recurse through all subdirectories for you. If that's your use case, then we've already got you covered.

I'm not sure it's worth adding globbing support to the command line. Most people use ESLint through a build system like Grunt that does its own globbing.

Can you let me know if eslint . solves the problem you have?

@briandipalma
Copy link
Contributor Author

Nope eslint . only lints files in the current directory. I guess it's no big deal a few Gulp tasks aren't a major issue.

@lo1tuma
Copy link
Member

lo1tuma commented Jan 18, 2015

@briandipalma that’s not true, eslint . lints all files in the current directory AND recursively all subdirectories.

@briandipalma
Copy link
Contributor Author

@lo1tuma I must have messed something up in my bash setup yesterday because it didn't work for me, today it does. Thanks for disagreeing with me, prompted me to test again! Hopefully Windows works the same.

@nihey
Copy link

nihey commented Sep 29, 2015

eslint . lints all .js files recursively. But I have a project full of .jsx files, and my .eslintrc has:

  "ecmaFeatures": {
    "jsx": true,
  },

In this case, eslint . doesn't seem to be looking for any of the .jsx.

This is not a critical issue to me, as there are ways to work around it. But what do you think? Should it look for the .jsx files?

@ilyavolodin
Copy link
Member

You have to tell ESLint that you want to lint .jsx files by specifying --ext CLI option.

@nihey
Copy link

nihey commented Sep 30, 2015

Nice catch, using eslint . --ext .jsx seems good enough.

@anodynos
Copy link

Worth noting for anyone looking that in package.json this solved the eslint not globbing problem in bash / linux :

"scripts": {
    "lint": "eslint './src/**/*.js' './specs/**/*.js'",
 ....
  }

All you need is single quotes around the path eg './some/path/with/glob/**/*.js'.

@platinumazure
Copy link
Member

I think we do support globbing now, incidentally. If you want to avoid the shell expanding your globs, you can quote them with double quotes and that should do it in most shells.

@FieryCod
Copy link

Is there a way to lint files recursively on Windows like I do on Linux using eslint .?

brettz9 added a commit to bahaidev/textbrowser that referenced this issue Oct 1, 2017
…ndencies)

- Refactoring: Remove (mostly) no longer needed `URLSearchParams` polyfill
- Linting: ESLint (indents)
- npm: Fix ESLint script per eslint/eslint#1663 (comment)
- npm: Upgrade dev deps
- npm: Bump to version 0.7.0
brettz9 added a commit to bahaidev/textbrowser that referenced this issue Oct 1, 2017
…ndencies)

- Refactoring: Remove (mostly) no longer needed `URLSearchParams` polyfill
- Linting: ESLint (indents)
- npm: Fix ESLint script per eslint/eslint#1663 (comment)
- npm: Upgrade dev deps
- npm: Bump to version 0.7.0
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

8 participants