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 . take longer time than a list of files #5839

Closed
trongthanh opened this issue Apr 13, 2016 · 3 comments
Closed

eslint . take longer time than a list of files #5839

trongthanh opened this issue Apr 13, 2016 · 3 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint

Comments

@trongthanh
Copy link

What version of ESLint are you using?
2.6.0
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
.eslintrc

{"root":true,"extends":"eslint:recommended","rules":{"block-scoped-var":1,"camelcase":[2,{"properties":"never"}],"comma-style":[2,"last"],"comma-dangle":2,"comma-spacing":[2,{"before":false,"after":true}],"curly":[2,"all"],"dot-notation":[2,{"allowKeywords":true}],"eqeqeq":[2,"allow-null"],"indent":[2,"tab",{"SwitchCase":1}],"linebreak-style":[2,"unix"],"new-cap":[2,{"capIsNew":false}],"no-bitwise":2,"no-caller":2,"no-console":0,"no-eval":2,"no-invalid-this":0,"no-iterator":2,"no-loop-func":2,"no-multi-str":2,"no-new":2,"no-proto":2,"no-script-url":2,"no-sequences":2,"no-shadow":2,"no-with":2,"one-var":[2,"never"],"quotes":[2,"single"],"semi":[2,"always"],"keyword-spacing":2,"space-before-blocks":2,"space-infix-ops":2,"space-unary-ops":[2,{"words":true}],"strict":0,"valid-jsdoc":2},"globals":{"google":true},"env":{"node":true,"browser":true,"jquery":true},"plugins":[]}

(I think my config is not related so I minify it to avoid clutter)

.eslintignore

public/js/vendor/
node_modules/
.*

What did you do? Please include the actual source code causing the issue.
My app is a keystone website, it is just created from a yeoman generator, so its structure will be exactly like this demo with eslint configs at the root of the repository.

Then I run the CLI command: eslint .

What did you expect to happen?
It should be fast (< 2s) as there are very few JS files to process.

What actually happened? Please include the actual, raw output from ESLint.
It took much longer (~10s) on my Macbook Air SSD.
Here's debug output:

$ time eslint ./  --debug
  eslint:cli Running on files +0ms
  eslint:ignored-paths Looking for ignore file in /Users/thanh/work/projects/keystone.git +54ms
  eslint:ignored-paths Loaded ignore file /Users/thanh/work/projects/keystone.git/.eslintignore +2ms
  eslint:ignored-paths Adding /Users/thanh/work/projects/keystone.git/.eslintignore +0ms
  eslint:glob-util Creating list of files to process. +1ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/gulpfile.js +9s
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/gulpfile.js +1ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/gulpfile.js +0ms
  eslint:config Using .eslintrc and package.json files +0ms
  eslint:config Loading /Users/thanh/work/projects/keystone.git/.eslintrc +9ms
  eslint:config-file Loading config file: /Users/thanh/work/projects/keystone.git/.eslintrc +2ms
  eslint:config-file Loading /usr/local/lib/node_modules/eslint/conf/eslint.json +163ms
  eslint:config-file Loading JSON config file: /usr/local/lib/node_modules/eslint/conf/eslint.json +0ms
  eslint:config Using /Users/thanh/work/projects/keystone.git/.eslintrc +275ms
  eslint:config Merging command line environment settings +1ms
  eslint:config-ops Apply environment settings to config +0ms
  eslint:config-ops Creating config for environment node +0ms
  eslint:config-ops Creating config for environment browser +1ms
  eslint:config-ops Creating config for environment jquery +0ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/keystone.js +164ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/keystone.js +2ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/keystone.js +0ms
  eslint:config Using config from cache +1ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/models/Enquiry.js +46ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/models/Enquiry.js +0ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/models/Enquiry.js +0ms
  eslint:config Using .eslintrc and package.json files +0ms
  eslint:config Loading /Users/thanh/work/projects/keystone.git/.eslintrc +1ms
  eslint:config-file Loading config file: /Users/thanh/work/projects/keystone.git/.eslintrc +0ms
  eslint:config-file Loading /usr/local/lib/node_modules/eslint/conf/eslint.json +3ms
  eslint:config-file Loading JSON config file: /usr/local/lib/node_modules/eslint/conf/eslint.json +0ms
  eslint:config Using /Users/thanh/work/projects/keystone.git/.eslintrc +7ms
  eslint:config Merging command line environment settings +1ms
  eslint:config-ops Apply environment settings to config +0ms
  eslint:config-ops Creating config for environment node +0ms
  eslint:config-ops Creating config for environment browser +1ms
  eslint:config-ops Creating config for environment jquery +0ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/models/Post.js +34ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/models/Post.js +1ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/models/Post.js +0ms
  eslint:config Using config from cache +1ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/models/PostCategory.js +35ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/models/PostCategory.js +1ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/models/PostCategory.js +0ms
  eslint:config Using config from cache +0ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/models/User.js +17ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/models/User.js +1ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/models/User.js +0ms
  eslint:config Using config from cache +0ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/public/js/main.js +18ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/public/js/main.js +1ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/public/js/main.js +0ms
  eslint:config Using .eslintrc and package.json files +0ms
  eslint:config Loading /Users/thanh/work/projects/keystone.git/.eslintrc +1ms
  eslint:config-file Loading config file: /Users/thanh/work/projects/keystone.git/.eslintrc +0ms
  eslint:config-file Loading /usr/local/lib/node_modules/eslint/conf/eslint.json +2ms
  eslint:config-file Loading JSON config file: /usr/local/lib/node_modules/eslint/conf/eslint.json +1ms
  eslint:config Using /Users/thanh/work/projects/keystone.git/.eslintrc +7ms
  eslint:config Merging command line environment settings +1ms
  eslint:config-ops Apply environment settings to config +0ms
  eslint:config-ops Creating config for environment node +0ms
  eslint:config-ops Creating config for environment browser +0ms
  eslint:config-ops Creating config for environment jquery +1ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/routes/emails.js +63ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/routes/emails.js +1ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/routes/emails.js +1ms
  eslint:config Using .eslintrc and package.json files +0ms
  eslint:config Loading /Users/thanh/work/projects/keystone.git/.eslintrc +0ms
  eslint:config-file Loading config file: /Users/thanh/work/projects/keystone.git/.eslintrc +0ms
  eslint:config-file Loading /usr/local/lib/node_modules/eslint/conf/eslint.json +3ms
  eslint:config-file Loading JSON config file: /usr/local/lib/node_modules/eslint/conf/eslint.json +0ms
  eslint:config Using /Users/thanh/work/projects/keystone.git/.eslintrc +4ms
  eslint:config Merging command line environment settings +2ms
  eslint:config-ops Apply environment settings to config +0ms
  eslint:config-ops Creating config for environment node +0ms
  eslint:config-ops Creating config for environment browser +1ms
  eslint:config-ops Creating config for environment jquery +0ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/routes/index.js +15ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/routes/index.js +0ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/routes/index.js +1ms
  eslint:config Using config from cache +0ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/routes/middleware.js +21ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/routes/middleware.js +1ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/routes/middleware.js +0ms
  eslint:config Using config from cache +0ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/routes/views/blog.js +46ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/routes/views/blog.js +1ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/routes/views/blog.js +0ms
  eslint:config Using .eslintrc and package.json files +0ms
  eslint:config Loading /Users/thanh/work/projects/keystone.git/.eslintrc +0ms
  eslint:config-file Loading config file: /Users/thanh/work/projects/keystone.git/.eslintrc +1ms
  eslint:config-file Loading /usr/local/lib/node_modules/eslint/conf/eslint.json +2ms
  eslint:config-file Loading JSON config file: /usr/local/lib/node_modules/eslint/conf/eslint.json +0ms
  eslint:config Using /Users/thanh/work/projects/keystone.git/.eslintrc +6ms
  eslint:config Merging command line environment settings +0ms
  eslint:config-ops Apply environment settings to config +1ms
  eslint:config-ops Creating config for environment node +0ms
  eslint:config-ops Creating config for environment browser +0ms
  eslint:config-ops Creating config for environment jquery +1ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/routes/views/contact.js +36ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/routes/views/contact.js +1ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/routes/views/contact.js +0ms
  eslint:config Using config from cache +0ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/routes/views/index.js +18ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/routes/views/index.js +0ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/routes/views/index.js +0ms
  eslint:config Using config from cache +0ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/routes/views/post.js +13ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/routes/views/post.js +0ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/routes/views/post.js +0ms
  eslint:config Using config from cache +0ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/templates/views/helpers/index.js +21ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/templates/views/helpers/index.js +1ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/templates/views/helpers/index.js +0ms
  eslint:config Using .eslintrc and package.json files +0ms
  eslint:config Loading /Users/thanh/work/projects/keystone.git/.eslintrc +0ms
  eslint:config-file Loading config file: /Users/thanh/work/projects/keystone.git/.eslintrc +0ms
  eslint:config-file Loading /usr/local/lib/node_modules/eslint/conf/eslint.json +2ms
  eslint:config-file Loading JSON config file: /usr/local/lib/node_modules/eslint/conf/eslint.json +0ms
  eslint:config Using /Users/thanh/work/projects/keystone.git/.eslintrc +4ms
  eslint:config Merging command line environment settings +2ms
  eslint:config-ops Apply environment settings to config +0ms
  eslint:config-ops Creating config for environment node +0ms
  eslint:config-ops Creating config for environment browser +0ms
  eslint:config-ops Creating config for environment jquery +2ms
  eslint:cli-engine Processing /Users/thanh/work/projects/keystone.git/updates/0.0.1-admins.js +70ms
  eslint:cli-engine Linting /Users/thanh/work/projects/keystone.git/updates/0.0.1-admins.js +1ms
  eslint:config Constructing config for /Users/thanh/work/projects/keystone.git/updates/0.0.1-admins.js +1ms
  eslint:config Using .eslintrc and package.json files +0ms
  eslint:config Loading /Users/thanh/work/projects/keystone.git/.eslintrc +0ms
  eslint:config-file Loading config file: /Users/thanh/work/projects/keystone.git/.eslintrc +0ms
  eslint:config-file Loading /usr/local/lib/node_modules/eslint/conf/eslint.json +2ms
  eslint:config-file Loading JSON config file: /usr/local/lib/node_modules/eslint/conf/eslint.json +2ms
  eslint:config Using /Users/thanh/work/projects/keystone.git/.eslintrc +5ms
  eslint:config Merging command line environment settings +1ms
  eslint:config-ops Apply environment settings to config +0ms
  eslint:config-ops Creating config for environment node +0ms
  eslint:config-ops Creating config for environment browser +1ms
  eslint:config-ops Creating config for environment jquery +0ms
  eslint:cli-engine Linting complete in: 10296ms +9ms

real    0m10.772s
user    0m9.398s
sys 0m1.036s

When I tried running the command with a list of folders and files instead of the dot (./), it take really fast. For example, I can lint all my JS files with this command instead:

$ time eslint models/ public/ routes/ templates/ updates/ gulpfile.js keystone.js

real    0m1.794s
user    0m1.730s
sys 0m0.139s
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Apr 13, 2016
@ilyavolodin
Copy link
Member

This is most likely a duplicate of #5679 Basically, while node_modules directory is excluded from linting by default, it's not excluded from globbing.

@ilyavolodin ilyavolodin added question This issue asks a question about ESLint and removed triage An ESLint team member will look at this issue soon labels Apr 13, 2016
@trongthanh
Copy link
Author

Did some test scenarios, I have to agree that it take longer because of the node_modules globbing.

I take a look at #5679. I think that, while sometimes it's needed to un-ignore some folders in node_modules, but they're rare. Most of the time we don't want to lint or glob node_modules folder at all.

I think it's not uncommon for people to use eslint . as their linting script and in my case, I'm using it for git pre-commit hook which slows everyone down every time they do a commit.

My temporary workaround is to pass a specific list of folders and files so that node_modules is not in the globbing list.

@ilyavolodin
Copy link
Member

@trongthanh #5679 has been accepted as an issue that we should fix. So we agree that this is a bug. If you want to submit a PR with a fix, we would be greatful!
Closing this as duplicate of #5679

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 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 6, 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 question This issue asks a question about ESLint
Projects
None yet
Development

No branches or pull requests

3 participants