Skip to content

[heft-lint-plugin] Stabilize the hash suffix in the linter cache file #5436

@dmichon-msft

Description

@dmichon-msft

const relativePaths: Map<string, string> = new Map();
const fileHash: Hash = createHash('md5');
for (const file of options.typeScriptFilenames) {
// Need to use relative paths to ensure portability.
const relative: string = Path.convertToSlashes(path.relative(commonDirectory, file));
relativePaths.set(file, relative);
fileHash.update(relative);
}
const hashSuffix: string = fileHash.digest('base64').replace(/\+/g, '-').replace(/\//g, '_').slice(0, 8);

Update the hash calculation for the linter cache filename to only be a hash of the project-relative path of the tsconfig file that corresponds to the program instance, rather than a hash of the list of file names.

The hash of the list of filenames may be placed inside of the cache file instead as a check to verify that it was run with the same files.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Low priority

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions