Skip to content

Commit

Permalink
fix: ignore flags work with cache
Browse files Browse the repository at this point in the history
  • Loading branch information
plantain-00 committed Feb 23, 2021
1 parent 720b884 commit fbc2424
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/core/src/core.ts
Expand Up @@ -9,7 +9,8 @@ import {
SourceFileInfo,
LintOptions,
FileTypeCheckResult,
SourceFileInfoWithoutCache
SourceFileInfoWithoutCache,
FileAnyInfoKind
} from './interfaces'
import { checkNode } from './checker'
import { clearCacheOfDependencies, collectDependencies } from './dependencies'
Expand Down Expand Up @@ -49,6 +50,20 @@ export async function lint(project: string, options?: Partial<LintOptions>) {
allFiles.add(file)
const hash = await getFileHash(file, lintOptions.enableCache)
const cache = typeCheckResult.cache[file]
if (cache) {
if (lintOptions.ignoreNested) {
cache.anys = cache.anys.filter((c) => c.kind !== FileAnyInfoKind.containsAny)
}
if (lintOptions.ignoreAsAssertion) {
cache.anys = cache.anys.filter((c) => c.kind !== FileAnyInfoKind.unsafeAs)
}
if (lintOptions.ignoreTypeAssertion) {
cache.anys = cache.anys.filter((c) => c.kind !== FileAnyInfoKind.unsafeTypeAssertion)
}
if (lintOptions.ignoreNonNullAssertion) {
cache.anys = cache.anys.filter((c) => c.kind !== FileAnyInfoKind.unsafeNonNull)
}
}
sourceFileInfos.push({
file,
sourceFile,
Expand Down

0 comments on commit fbc2424

Please sign in to comment.