-
-
Notifications
You must be signed in to change notification settings - Fork 929
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
Improve performance of globbing with ignored paths #2399
Comments
@ArmorDarks I'm not sure such a simple solution will work. The problem is that we allow different files to load different configs: there's not always just one config per process. For example, you could have 4 parallel folders, It seems to me that the simplest solution here is actually for you the user to enter a more complete input glob, instead of using |
@davidtheclark agree, best solution use |
Thanks for reply! Hm, as I initially though, case isn't that easy indeed. Since we're using Stylelint through npm scripts, solution with So, particularly my issue can be considered as resolved. Though, for those who using it via CLI typing all ignores in console can be very combustome. ESLint standard seems to behave in this matter much easier. It's just plug in and go, even in very large repositories. I can't tell does ESLint has same cascading approach for configs, though. I think it just applies ignores at first place, so if you're giving in wide glob for input, and your config has Well, it boils down to the point, that it just wasn't clear, that Maybe we need another option? Then Stylelint could locate first closest config by gradually checking from root to deeper directories, check does it have any global ignores, and continue based on them? But I can imagine that in some scenarios it can make things even slower... |
Open to implementation ideas to improve this. There are other corollary problems to consider. For example, verbose reporting tells you how many files were ignored, and which ones — would we be ok eliminating that feature?
Another configuration option would face the same problem as this one: which config is privileged? Does that mean we need to search for multiple configs for every file? |
I think this one is easier to solve — such wide globbing can be done only when verbose reporting is asked for, in other scenarios it seems to be excessive (except that configs story...)
ESLint and other tools expecting first found config to be privileged (be it rc config file, first encountered packages.json and so on), and it seems to be logically expected behavior to me. |
@ArmorDarks, I recently worked on adding cache to lint only changed and invalid files. That should improve stylelint execution time in general, but not globby part. |
@ArmorDarks: I'm trying to followup on this issue this weekend. To followup on your comments about ESLint: does ESLint even have an equivalent of If my suspicion is right that they do not have such a config property, then all we'd need to do to match ESLint here is to ensure that we don't look up |
Closed by #2464. |
Stylelint works extremely slow with large directories by taking a lot of time to discover files targeted by input glob, despite glob contain paths, ignored in Stylelint config with
ignoreFiles
option.I've digged in code and discovered that it happens, because Stylelin initially passes to
globby
whole input glob and does not account for specified inignoreFiles
option path and files.By stumbling into very large directory,
globby
tries to explore it completely and it takes a lot of time (with 4000 files it almost endless), while it had to ignore it in first place due to specified inignoreFiles
option path.Partially related to
ignoreFiles
option.Fortunately, no CSS needed to reproduce this issue. However, you will need directory with Craft CMS and Nginx (with around 4000 files) near css files.
You need to launch Stylelint with very wide glob as input:
And large directory near your css files.
7.9.0
Project with following structure:
CLI with
Config stored in
.stylelintrc.yml
:Funky and in some sense same globs for
ignoreFiles
just to be sure that I passed in correct path.No
Stylelint should add specified in
ignoreFiles
option paths to passed toglobby
files list as ignored (with!
), so thatglobby
won't try to scan directory which won't be ever used at first place.Stylelint hangs for very long time.
The text was updated successfully, but these errors were encountered: