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:

committed by
Alex Rickabaugh

parent
04a9f28c3d
commit
4c12d742dc
@ -10,7 +10,6 @@ import {Replacement, RuleFailure, Rules} from 'tslint';
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {NgComponentTemplateVisitor} from '../../../utils/ng_component_template';
|
||||
import {visitAllNodes} from '../../../utils/typescript/visit_nodes';
|
||||
import {NgQueryResolveVisitor} from '../angular/ng_query_visitor';
|
||||
import {QueryTiming} from '../angular/query-definition';
|
||||
import {QueryUsageStrategy} from '../strategies/usage_strategy/usage_strategy';
|
||||
@ -35,10 +34,8 @@ export class Rule extends Rules.TypedRule {
|
||||
|
||||
// Analyze source files by detecting queries, class relations and component templates.
|
||||
rootSourceFiles.forEach(sourceFile => {
|
||||
// The visit utility function only traverses the source file once. We don't want to
|
||||
// traverse through all source files multiple times for each visitor as this could be
|
||||
// slow.
|
||||
visitAllNodes(sourceFile, [queryVisitor, templateVisitor]);
|
||||
queryVisitor.visitNode(sourceFile);
|
||||
templateVisitor.visitNode(sourceFile);
|
||||
});
|
||||
|
||||
const {resolvedQueries, classMetadata} = queryVisitor;
|
||||
|
Reference in New Issue
Block a user