- Start Date: 2020-07-15
- RFC PR: eslint#63
- Authors: @c-home
This RFC proposes improving cache for CI by providing an option to use a hash (instead of mtime
and fsize
) comparison to determine whether a file has changed.
Motivation for this change is the same as #11490, where details of files like mtime
are not preserved in the CI environment. With a hash comparison, the cache can be used in CI and would significantly reduce the time ESLint takes to run.
ESLint uses file-entry-create
as its cache provider. fileEntryCache#create gives the option to use a md5 hash through the useChecksum
argument, but ESLint currently does not utilize it.
This RFC adds a --cache-strategy
CLI option. Users can specify the option to be:
contents
, for the use of an md5 hashmetadata
, for the use ofmtime
andfsize
Modified time and size (metadata
), does not need to be specified as it will remain the default.
The implementation will be similar to #11487, with differences in the naming of the options. The options were kept general so if the underlying implementation of the comparison method were to change, the usage and documentation can remain the same.
Documentation for ESLint CLI will be updated with a description of the option.
- Specifying the details of the cache behaviour through a public option can make it more difficult to change the design and implementation without breaking its usage.
- Comparing files based on their contents is slower than comparing files by their file metadata. However, a file contents comparison is not the default.
- Like any new feature, this flag will slightly increase the complexity and maintenance costs of ESLint.
This change is backwards-compatible. It adds a new CLI option while keeping the behavior the same if the option is not specified.
Mentioned as an alternative in #11487, and if file-entry-cache
#14 were to be merged, an environment variable could be passed through eslint
to file-entry-cache
.
None
None yet