File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed
common/changes/@rushstack/heft-lint-plugin
heft-plugins/heft-lint-plugin/src Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "changes" : [
3+ {
4+ "packageName" : " @rushstack/heft-lint-plugin" ,
5+ "comment" : " Fix an issue where the cache is only populated for incremental TypeScript builds." ,
6+ "type" : " patch"
7+ }
8+ ],
9+ "packageName" : " @rushstack/heft-lint-plugin"
10+ }
Original file line number Diff line number Diff line change @@ -176,7 +176,14 @@ export class Eslint extends LinterBase<TEslint.ESLint.LintResult> {
176176 return lintResult . fixableErrorCount + lintResult . fixableWarningCount > 0 ;
177177 } ) ) ;
178178
179- return lintResults ;
179+ const trimmedLintResults : TEslint . ESLint . LintResult [ ] = [ ] ;
180+ for ( const lintResult of lintResults ) {
181+ if ( lintResult . messages . length > 0 || lintResult . warningCount > 0 || lintResult . errorCount > 0 ) {
182+ trimmedLintResults . push ( lintResult ) ;
183+ }
184+ }
185+
186+ return trimmedLintResults ;
180187 }
181188
182189 protected async lintingFinishedAsync ( lintResults : TEslint . ESLint . LintResult [ ] ) : Promise < void > {
Original file line number Diff line number Diff line change @@ -138,8 +138,15 @@ export abstract class LinterBase<TLintResult> {
138138 continue ;
139139 }
140140
141- // Compute the version from the source file content
142- const version : string = sourceFile . version || '' ;
141+ // TypeScript only computes the version during an incremental build.
142+ let version : string = sourceFile . version ;
143+ if ( ! version ) {
144+ // Compute the version from the source file content
145+ const sourceCodeHash : Hash = createHash ( 'sha1' ) ;
146+ sourceCodeHash . update ( sourceFile . text ) ;
147+ version = sourceCodeHash . digest ( 'base64' ) ;
148+ }
149+
143150 const cachedVersion : string = cachedNoFailureFileVersions . get ( relative ) || '' ;
144151 if (
145152 cachedVersion === '' ||
You can’t perform that action at this time.
0 commit comments