Skip to content

Commit 3e98034

Browse files
crisbetojelbourn
authored andcommitted
build: enforce that the descendants flag is set on all queries (#17778)
Updates the linting config to require that the `descendants` flag is set on all `ContentChildren` queries so that we can avoid backsliding.
1 parent 2f17450 commit 3e98034

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

src/material-experimental/mdc-tabs/tab-header.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import {MatInkBar} from './ink-bar';
5050
},
5151
})
5252
export class MatTabHeader extends _MatTabHeaderBase implements AfterContentInit {
53-
@ContentChildren(MatTabLabelWrapper) _items: QueryList<MatTabLabelWrapper>;
53+
@ContentChildren(MatTabLabelWrapper, {descendants: false}) _items: QueryList<MatTabLabelWrapper>;
5454
@ViewChild('tabListContainer', {static: true}) _tabListContainer: ElementRef;
5555
@ViewChild('tabList', {static: true}) _tabList: ElementRef;
5656
@ViewChild('nextPaginator') _nextPaginator: ElementRef<HTMLElement>;

src/material/menu/menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export class _MatMenuBase implements AfterContentInit, MatMenuPanel<MatMenuItem>
162162
* @deprecated
163163
* @breaking-change 8.0.0
164164
*/
165-
@ContentChildren(MatMenuItem) items: QueryList<MatMenuItem>;
165+
@ContentChildren(MatMenuItem, {descendants: false}) items: QueryList<MatMenuItem>;
166166

167167
/**
168168
* Menu content that will be rendered lazily.

src/material/tabs/tab-header.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export abstract class _MatTabHeaderBase extends MatPaginatedTabHeader implements
8888
},
8989
})
9090
export class MatTabHeader extends _MatTabHeaderBase {
91-
@ContentChildren(MatTabLabelWrapper) _items: QueryList<MatTabLabelWrapper>;
91+
@ContentChildren(MatTabLabelWrapper, {descendants: false}) _items: QueryList<MatTabLabelWrapper>;
9292
@ViewChild(MatInkBar, {static: true}) _inkBar: MatInkBar;
9393
@ViewChild('tabListContainer', {static: true}) _tabListContainer: ElementRef;
9494
@ViewChild('tabList', {static: true}) _tabList: ElementRef;

tslint.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@
154154
"properties": {
155155
"*": "^(?!\\s*$).+"
156156
}
157+
},
158+
"ContentChildren": {
159+
"argument": 1,
160+
"required": true,
161+
"properties": {
162+
"descendants": "^(true|false)$"
163+
}
157164
}
158165
}, "src/!(a11y-demo|e2e-app|components-examples|universal-app|dev-app)/**/!(*.spec).ts"],
159166
"require-license-banner": [

0 commit comments

Comments
 (0)