@ -28,7 +28,7 @@ export class Rule extends Rules.TypedRule {
|
||||
const typeChecker = program.getTypeChecker();
|
||||
const queryVisitor = new NgQueryResolveVisitor(program.getTypeChecker());
|
||||
const templateVisitor = new NgComponentTemplateVisitor(typeChecker);
|
||||
const rootSourceFiles = program.getRootFileNames().map(f => program.getSourceFile(f) !);
|
||||
const rootSourceFiles = program.getRootFileNames().map(f => program.getSourceFile(f)!);
|
||||
const printer = ts.createPrinter();
|
||||
const failures: RuleFailure[] = [];
|
||||
|
||||
@ -44,7 +44,7 @@ export class Rule extends Rules.TypedRule {
|
||||
// check component templates for static query usage.
|
||||
templateVisitor.resolvedTemplates.forEach(template => {
|
||||
if (classMetadata.has(template.container)) {
|
||||
classMetadata.get(template.container) !.template = template;
|
||||
classMetadata.get(template.container)!.template = template;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -50,7 +50,7 @@ export class Rule extends Rules.TypedRule {
|
||||
transformer.recordChanges();
|
||||
|
||||
if (updateRecorders.has(sourceFile)) {
|
||||
failures.push(...updateRecorders.get(sourceFile) !.failures);
|
||||
failures.push(...updateRecorders.get(sourceFile)!.failures);
|
||||
}
|
||||
|
||||
return failures;
|
||||
@ -58,7 +58,7 @@ export class Rule extends Rules.TypedRule {
|
||||
/** Gets the update recorder for the specified source file. */
|
||||
function getUpdateRecorder(sourceFile: ts.SourceFile): TslintUpdateRecorder {
|
||||
if (updateRecorders.has(sourceFile)) {
|
||||
return updateRecorders.get(sourceFile) !;
|
||||
return updateRecorders.get(sourceFile)!;
|
||||
}
|
||||
const recorder = new TslintUpdateRecorder(ruleName, sourceFile);
|
||||
updateRecorders.set(sourceFile, recorder);
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {Replacement, RuleFailure, Rules} from 'tslint';
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {HelperFunction, getHelper} from '../renderer-to-renderer2/helpers';
|
||||
import {getHelper, HelperFunction} from '../renderer-to-renderer2/helpers';
|
||||
import {migrateExpression, replaceImport} from '../renderer-to-renderer2/migration';
|
||||
import {findCoreImport, findRendererReferences} from '../renderer-to-renderer2/util';
|
||||
|
||||
@ -75,7 +75,7 @@ export class Rule extends Rules.TypedRule {
|
||||
private _getTypedNodeFailure(
|
||||
node: ts.ParameterDeclaration|ts.PropertyDeclaration|ts.AsExpression,
|
||||
sourceFile: ts.SourceFile): RuleFailure {
|
||||
const type = node.type !;
|
||||
const type = node.type!;
|
||||
|
||||
return new RuleFailure(
|
||||
sourceFile, type.getStart(), type.getEnd(),
|
||||
|
@ -32,14 +32,14 @@ export class Rule extends Rules.TypedRule {
|
||||
transform.recordChanges();
|
||||
|
||||
if (updateRecorders.has(sourceFile)) {
|
||||
return updateRecorders.get(sourceFile) !.failures;
|
||||
return updateRecorders.get(sourceFile)!.failures;
|
||||
}
|
||||
return [];
|
||||
|
||||
/** Gets the update recorder for the specified source file. */
|
||||
function getUpdateRecorder(sourceFile: ts.SourceFile): TslintUpdateRecorder {
|
||||
if (updateRecorders.has(sourceFile)) {
|
||||
return updateRecorders.get(sourceFile) !;
|
||||
return updateRecorders.get(sourceFile)!;
|
||||
}
|
||||
const recorder = new TslintUpdateRecorder(ruleName, sourceFile);
|
||||
updateRecorders.set(sourceFile, recorder);
|
||||
|
Reference in New Issue
Block a user