Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First, thank you for these rules, they've caught many issues before they became issues.
I work on a very large monorepo https://github.com/adobe/react-spectrum and our eslint has slowed down substantially.
Eslint performance today:
I put together this PR in order to improve our overall runtime.
This does two things to speed up performance of this rule:
minimatch is a glob expressions conversion into JavaScript RegExp, this is useful for complex things, however, the way it's used here is
minimatch(filePath, path.join(pkg.location, '**'))
this would lead to a glob of
${pkg.location}/**
and we want to know if filePath matches that globthis is the same as isInside, which is faster
overall though the time saved isn't that big, but ~7% of a several minute run is nothing to be sad about
this rule only cares about relative imports, I may be wrong about this, but I believe all relative imports will have '../' in them, therefore we can shortcut the entire rule if that isn't in the import path
this is where the big time savings came from
After minimatch replacement:
After '../' shortcut: