Skip to content

reconcile() updates cache entries for all files #1648

@mdjermanovic

Description

@mdjermanovic

Describe the bug

We are trying to update file-entry-cache dependency from v8 to v11 in ESLint. So far we have found three differences that affect ESLint's use case:

  1. reconcile() in file-entry-cache v11 updates cache entries for all files that are tracked in the cache, not just those for which getFileDescriptor() was called. This effectively makes all cache entries valid. ESLint isn't necessarily always run on the same set of files. Making all cache entries valid means that files that have changed, but weren't included in the last lint run, would have outdated lint results stored in cache as valid lint results for the latest versions of the files. file-entry-cache v8 used to update cache entries only for files for which getFileDescriptor() was called.
  2. getFileDescriptor() in file-entry-cache v11 returns changed: false on additional calls for the same file. With file-entry-cache v8, if getFileDescriptor() returns changed: true on the first call for a file, it will also return changed: true on subsequent calls for the same file.
  3. create() in file-entry-cache v11 throws an error if the cache file content is invalid JSON. file-entry-cache v8 used to silently overwrite the cache file on reconcile().

I'm filing this as a bug (3 possible bugs) since I couldn't find mentions of these changes in release descriptions. Not sure if the changes were intentional, but for at least one (1.) I don't think we could find a viable workaround in ESLint.

How To Reproduce (best to provide workable code or tests!)

  1. https://stackblitz.com/edit/stackblitz-starters-oe4y59em?file=package.json,init.js,check.js,update.js
  2. https://stackblitz.com/edit/stackblitz-starters-hhkkanjb?file=package.json,init.js,update.js,check.js
  3. https://stackblitz.com/edit/stackblitz-starters-gbe5tfbu?file=package.json,init.js,check.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions