refactor(docs-infra): fix docs examples for tslint rule `member-ordering` (#38143)

This commit updates the docs examples to be compatible with the
`member-ordering` tslint rule.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
This commit is contained in:
George Kalpakas 2020-07-30 13:03:15 +03:00 committed by Alex Rickabaugh
parent 3c7359f026
commit 6334749d2c
7 changed files with 21 additions and 11 deletions

View File

@ -8,8 +8,7 @@ import { trigger, transition, state, animate, style, AnimationEvent } from '@ang
// #docregion trigger, trigger-wildcard1, trigger-transition
animations: [
trigger('openClose', [
// #enddocregion events1
// #docregion state1, events1
// #docregion state1
// ...
// #enddocregion events1
state('open', style({
@ -34,8 +33,7 @@ import { trigger, transition, state, animate, style, AnimationEvent } from '@ang
transition('closed => open', [
animate('0.5s')
]),
// #enddocregion trigger, component
// #enddocregion transition2
// #enddocregion transition2, trigger, component
// #docregion trigger-wildcard1
transition('* => closed', [
animate('1s')
@ -70,7 +68,9 @@ import { trigger, transition, state, animate, style, AnimationEvent } from '@ang
})
// #docregion events
export class OpenCloseComponent {
// #enddocregion events1, events
// #enddocregion events1, events, component
@Input() logging = false;
// #docregion component
isOpen = true;
toggle() {
@ -78,7 +78,6 @@ export class OpenCloseComponent {
}
// #enddocregion component
@Input() logging = false;
// #docregion events1, events
onAnimationEvent( event: AnimationEvent ) {
// #enddocregion events1, events

View File

@ -30,6 +30,14 @@ export class AppComponent implements OnInit {
itemsWithTrackByCountReset = 0;
itemIdIncrement = 1;
// #docregion setClasses
currentClasses: {};
// #enddocregion setClasses
// #docregion setStyles
currentStyles: {};
// #enddocregion setStyles
ngOnInit() {
this.resetItems();
this.setCurrentClasses();
@ -41,8 +49,7 @@ export class AppComponent implements OnInit {
this.currentItem.name = name.toUpperCase();
}
// #docregion setClasses
currentClasses: {};
// #docregion setClasses
setCurrentClasses() {
// CSS classes: added/removed per current state of component properties
this.currentClasses = {
@ -54,7 +61,6 @@ export class AppComponent implements OnInit {
// #enddocregion setClasses
// #docregion setStyles
currentStyles: {};
setCurrentStyles() {
// CSS styles: set per current state of component properties
this.currentStyles = {

View File

@ -32,6 +32,9 @@ export class ChildViewComponent {
})
// #docregion hooks
export class AfterViewComponent implements AfterViewChecked, AfterViewInit {
// #enddocregion hooks
comment = '';
// #docregion hooks
private prevHero = '';
// Query for a VIEW child of type `ChildViewComponent`
@ -61,8 +64,6 @@ export class AfterViewComponent implements AfterViewChecked, AfterViewInit {
}
// #enddocregion hooks
comment = '';
// #docregion do-something
// This surrogate for real business logic sets the `comment`
private doSomething() {

View File

@ -1,3 +1,4 @@
/* tslint:disable: member-ordering */
// #docregion
class PhoneDetailController {
phone: any;

View File

@ -1,3 +1,4 @@
/* tslint:disable: member-ordering */
// #docregion
class PhoneListController {
phones: any[];

View File

@ -1,3 +1,4 @@
/* tslint:disable: member-ordering */
// #docregion
declare var angular: angular.IAngularStatic;
import { Phone, PhoneData } from '../core/phone/phone.service';

View File

@ -1,3 +1,4 @@
/* tslint:disable: member-ordering */
// #docregion
declare var angular: angular.IAngularStatic;
import { Phone, PhoneData } from '../core/phone/phone.service';