Skip to content

Commit 4649116

Browse files
committed
feat: include version in CLI cache path to avoid conflicts
1 parent d10511f commit 4649116

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ npx tsslint --project {tsconfig.json,packages/*/tsconfig.json,extensions/*/tscon
138138
>
139139
> For glob patterns (`*`), TSSLint uses an internal `glob` library to ensure cross-platform compatibility (especially on Windows) and to support advanced features like file watching, where the original pattern is needed.
140140
>
141-
> **CLI Caching**: The CLI uses a file system cache to speed up subsequent runs. The cache files are stored in your operating system's temporary directory (`os.tmpdir()`) to avoid polluting your project's file system. The cache is automatically invalidated when the project's `tsslint.config.ts` or the CLI arguments change.
141+
> **CLI Caching**: The CLI uses a file system cache to speed up subsequent runs. The cache files are stored in your operating system's temporary directory (`os.tmpdir()`) to avoid polluting your project's file system. The cache is automatically invalidated when the project's `tsslint.config.ts`, the CLI arguments, or the TSSLint version changes.
142142
```
143143
144144
> [!TIP]

packages/cli/lib/cache.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import os = require('os');
55

66
export type CacheData = Record<string /* fileName */, core.FileLintCache>;
77

8+
const pkg = require('../package.json');
9+
810
export function loadCache(
911
tsconfig: string,
1012
configFilePath: string,
@@ -41,5 +43,5 @@ export function saveCache(
4143
function getTsslintCachePath(configFilePath: string, createHash: (path: string) => string): string {
4244
const projectRoot = path.resolve(configFilePath, '..');
4345
const projectHash = createHash(projectRoot);
44-
return path.join(os.tmpdir(), 'tsslint-cache-' + projectHash);
46+
return path.join(os.tmpdir(), 'tsslint-cache-' + pkg.version + '-' + projectHash);
4547
}

0 commit comments

Comments
 (0)