fix: move handledFiles from module scope to Walker instance#16
Merged
filipenevola merged 1 commit intomainfrom Mar 27, 2026
Merged
fix: move handledFiles from module scope to Walker instance#16filipenevola merged 1 commit intomainfrom
filipenevola merged 1 commit intomainfrom
Conversation
Two related bugs caused non-deterministic warning counts: 1. The module-level `handledFiles` Set persisted across Walker instances. When the file cache (`.eslint-meteor-files`) expired mid-run (default 5s TTL), re-walking the app tree skipped every file already in `handledFiles`, producing an empty `cachedParsedFile` written to disk. 2. `shouldSkip()` created a new Walker on every call and depended solely on the disk cache. If the cache expired between the `Program` handler writing it and `MemberExpression` reading it, `shouldSkip()` saw an empty file list and skipped the file. Fixes: - Move `handledFiles` from module scope into the Walker instance. - Add an in-memory cache (`inMemoryCache` Map) that survives the entire ESLint process so `shouldSkip()` always sees the complete file list regardless of disk cache TTL. Made-with: Cursor
684f35d to
c58d0fe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
handledFilesSet inwalker.jspersisted across Walker instances within a single ESLint run. When the file cache (.eslint-meteor-files) expired mid-run (default 5s TTL), re-walking the app tree produced an emptycachedParsedFilebecausehandledFilescausedhandleFile()to skip every previously-seen file. All files linted after this point had their warnings silently dropped, making the count non-deterministic.handledFilesfrom module scope into the Walker class instance, and threaded it throughhandleFile/handleFolderas a parameter. Each walk now builds a complete file list independently.Reproduction
Run
eslint --no-cache . --format jsonon a Meteor project withno-sync-mongo-methods-on-serverenabled, multiple times in quick succession. The warning count will vary between runs (e.g. 510, 538, 578) because the 5-second cache expires partway through the ~10s ESLint run.Test plan
npm test)Made with Cursor