fix(core): static-query migration should not prompt if no queries are used (#30254)

Currently we always prompt when the static-query migration runs. This is not
always needed because some applications do not even use `ViewChild` or
`ContentChild` queries and it just causes confusion if developers need to
decide on a migration strategy while there is nothing to migrate.

In order to avoid this confusion, we no longer prompt for a strategy
if there are no queries declared within the project.

PR Close #30254
This commit is contained in:
Paul Gschwendtner
2019-05-03 15:02:08 +02:00
committed by Alex Rickabaugh
parent 04a9f28c3d
commit 4c12d742dc
9 changed files with 147 additions and 97 deletions

View File

@ -11,7 +11,6 @@ import * as ts from 'typescript';
import {NgComponentTemplateVisitor} from '../../../utils/ng_component_template';
import {createHtmlSourceFile} from '../../../utils/tslint/tslint_html_source_file';
import {visitAllNodes} from '../../../utils/typescript/visit_nodes';
import {analyzeResolvedTemplate} from '../analyze_template';
const FAILURE_MESSAGE = 'Found assignment to template variable. This does not work with Ivy and ' +
@ -27,7 +26,7 @@ export class Rule extends Rules.TypedRule {
const failures: RuleFailure[] = [];
// Analyze the current source files by detecting all referenced HTML templates.
visitAllNodes(sourceFile, [templateVisitor]);
templateVisitor.visitNode(sourceFile);
const {resolvedTemplates} = templateVisitor;