eslint: Extremely slow with antivirus

The company I work for requires that I run some horrible (but somehow popular) antivirus software on my PC which makes my eslint . take nearly 30 seconds to run on a very small project.

I did a little investigating and all of that slowness occurs in glob-util.js in the call to glob.sync(pattern, globOptions). If I modify globOptions to include ignore: 'node_modules/**' my linting drops to one second.

It appears that crawling node_modules causes my antivirus to kick in for each file, and I’m assuming I can’t be the only one with this problem. In any case, filtering out node_modules before the glob.sync call should certainly speed things up to some degree for everyone.

I understand that there is some complex logic involved with ignoring and unignoring paths so I see why all node_modules paths are included at this point in the code, but is there a chance this could be handled in some other way that would short-circuit the needless crawling? It would be a massive 99% speed increase, at least for me and anyone else in my position.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 43 (24 by maintainers)

Commits related to this issue

Most upvoted comments

From the looks of it this could be a huge performance improvement. Provided nobody else wants to solve it in the near future, I’ll take a look at it until the end of the week.

This doesn’t solve my own problem, which is that the huge ignored directory is logs/, not node_modules/

I’m working on a simple fix for this just for the default ignores, as mentioned here

@IanVS We could also do some fuzzy logic and avoid crawling node_modules and bower_components if either:

  1. There is no ignore file and no --ignore-pattern
  2. The ignore file or ignore pattern do not contain node_modules or bower_components

I’d really rather not add any more ignore-related flags if we can avoid it.

I understand that node_modules is ignored by default, but glob.sync(pattern, globOptions) happens before ignoredPaths rules are applied. My question is whether or not node_modules can be excluded from the glob crawling instead of each file under node_modules being filtered out one-by-one after the fact.

I’m using 2.5.0, but this was also an issue in 2.4.0.