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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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