build: remove staticQueryRule (#16713)

Initially we added the rule to enforce that we always set the `static` flag on queries while it was still optional. Now we can remove it since the `static` flag is required.
This commit is contained in:
Kristiyan Kostadinov
2019-08-08 22:18:01 +03:00
committed by Jeremy Elbourn
parent 93aba14c5f
commit 8ced0e76ef
2 changed files with 0 additions and 39 deletions
-38
View File
@@ -1,38 +0,0 @@
import * as ts from 'typescript';
import * as Lint from 'tslint';
/**
* Rule which enforces that all queries are explicitly marked as static or non-static.
*/
export class Rule extends Lint.Rules.AbstractRule {
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
return this.applyWithWalker(new Walker(sourceFile, this.getOptions()));
}
}
class Walker extends Lint.RuleWalker {
visitPropertyDeclaration(node: ts.PropertyDeclaration) {
const childQueryDecorator = node.decorators && node.decorators.find(decorator => {
const expression = (decorator.expression as ts.CallExpression);
const name = expression && expression.expression.getText();
return name === 'ViewChild' || name === 'ContentChild';
});
if (childQueryDecorator) {
const options = (childQueryDecorator.expression as ts.CallExpression).arguments[1];
if (!options || !ts.isObjectLiteralExpression(options) ||
!this._getObjectProperty(options, 'static')) {
this.addFailureAtNode(childQueryDecorator,
'Queries have to explicitly set the `static` option.');
}
}
super.visitPropertyDeclaration(node);
}
/** Gets the node of an object property by name. */
private _getObjectProperty(node: ts.ObjectLiteralExpression, name: string) {
return node.properties.find(property => (property.name as ts.Identifier).getText() === name);
}
}
-1
View File
@@ -104,7 +104,6 @@
"ng-on-changes-property-access": true,
"rxjs-imports": true,
"require-breaking-change-version": true,
"static-query": true,
"no-host-decorator-in-concrete": [
true,
"HostBinding",