Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 9d0cb6e

Browse files
committed
chore: tslint sweep done
1 parent 1cc5284 commit 9d0cb6e

File tree

66 files changed

+226
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+226
-288
lines changed

public/docs/_examples/architecture/ts/app/hero-list.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ export class HeroesComponent { ... }
2424
*/
2525
// #docregion class
2626
export class HeroListComponent implements OnInit {
27+
heroes: Hero[];
28+
selectedHero: Hero;
29+
2730
// #docregion ctor
2831
constructor(private service: HeroService) { }
2932
// #enddocregion ctor
3033

31-
heroes: Hero[];
32-
selectedHero: Hero;
33-
3434
ngOnInit() {
3535
this.heroes = this.service.getHeroes();
3636
}

public/docs/_examples/architecture/ts/app/hero.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import { Logger } from './logger.service';
77
@Injectable()
88
// #docregion class
99
export class HeroService {
10+
private heroes: Hero[] = [];
11+
1012
// #docregion ctor
1113
constructor(
1214
private backend: BackendService,
1315
private logger: Logger) { }
1416
// #enddocregion ctor
1517

16-
private heroes: Hero[] = [];
17-
1818
getHeroes() {
1919
this.backend.getAll(Hero).then( (heroes: Hero[]) => {
2020
this.logger.log(`Fetched ${heroes.length} heroes.`);

public/docs/_examples/architecture/ts/app/sales-tax.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #docregion
2-
import { Inject, Injectable } from '@angular/core';
2+
import { Injectable } from '@angular/core';
33

44
import { TaxRateService } from './tax-rate.service';
55

public/docs/_examples/attribute-directives/ts/app/highlight.directive.1.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* tslint:disable:no-unused-variable */
12
// #docregion
23
import { Directive, ElementRef, Input } from '@angular/core';
34

public/docs/_examples/attribute-directives/ts/app/highlight.directive.2.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1+
/* tslint:disable:no-unused-variable */
2+
// #docplaster
13
// #docregion
2-
import { Directive, ElementRef, Input } from '@angular/core';
4+
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
35

46
@Directive({
5-
selector: '[myHighlight]',
6-
// #docregion host
7-
host: {
8-
'(mouseenter)': 'onMouseEnter()',
9-
'(mouseleave)': 'onMouseLeave()'
10-
}
11-
// #enddocregion host
7+
selector: '[myHighlight]'
128
})
139

1410
export class HighlightDirective {
@@ -18,9 +14,19 @@ export class HighlightDirective {
1814
constructor(el: ElementRef) { this.el = el.nativeElement; }
1915
// #enddocregion ctor
2016

21-
// #docregion mouse-methods
22-
onMouseEnter() { this.highlight('yellow'); }
23-
onMouseLeave() { this.highlight(null); }
17+
// #docregion mouse-methods, host
18+
@HostListener('mouseenter') onMouseEnter() {
19+
// #enddocregion host
20+
this.highlight('yellow');
21+
// #docregion host
22+
}
23+
24+
@HostListener('mouseleave') onMouseLeave() {
25+
// #enddocregion host
26+
this.highlight(null);
27+
// #docregion host
28+
}
29+
// #enddocregion host
2430

2531
private highlight(color: string) {
2632
this.el.style.backgroundColor = color;

public/docs/_examples/attribute-directives/ts/app/highlight.directive.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
// #docplaster
22
// #docregion full
3-
import { Directive, ElementRef, Input } from '@angular/core';
3+
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
44

55
@Directive({
6-
selector: '[myHighlight]',
7-
host: {
8-
'(mouseenter)': 'onMouseEnter()',
9-
'(mouseleave)': 'onMouseLeave()'
10-
}
6+
selector: '[myHighlight]'
117
})
128
// #docregion class-1
139
export class HighlightDirective {
@@ -29,9 +25,13 @@ export class HighlightDirective {
2925
// #enddocregion color
3026

3127
// #docregion mouse-enter
32-
onMouseEnter() { this.highlight(this.highlightColor || this._defaultColor); }
28+
@HostListener('mouseenter') onMouseEnter() {
29+
this.highlight(this.highlightColor || this._defaultColor);
30+
}
3331
// #enddocregion mouse-enter
34-
onMouseLeave() { this.highlight(null); }
32+
@HostListener('mouseleave') onMouseLeave() {
33+
this.highlight(null);
34+
}
3535

3636
private highlight(color: string) {
3737
this.el.style.backgroundColor = color;

public/docs/_examples/cb-a1-a2-quick-reference/ts/app/date.pipe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Injectable, Pipe } from '@angular/core';
1+
import { Injectable, Pipe, PipeTransform } from '@angular/core';
22
import { DatePipe } from '@angular/common';
33

44
@Injectable()
55
// #docregion date-pipe
66
@Pipe({name: 'date', pure: true})
7-
export class StringSafeDatePipe extends DatePipe {
7+
export class StringSafeDatePipe extends DatePipe implements PipeTransform {
88
transform(value: any, format: string): string {
99
value = typeof value === 'string' ?
1010
Date.parse(value) : value;

public/docs/_examples/cb-a1-a2-quick-reference/ts/app/movie-list.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* tslint:disable:no-unused-variable */
12
// #docplaster
23
// #docregion import
34
import { Component } from '@angular/core';

public/docs/_examples/cb-component-communication/ts/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (!/e2e/.test(location.search)) {
2525
}
2626

2727
@Component({
28-
selector: 'app',
28+
selector: 'my-app',
2929
templateUrl: 'app/app.component.html',
3030
directives: directives
3131
})

public/docs/_examples/cb-component-communication/ts/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</head>
2424

2525
<body>
26-
<app>loading...</app>
26+
<my-app>loading...</my-app>
2727
</body>
2828

2929
</html>

public/docs/_examples/cb-dependency-injection/e2e-spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ describe('Dependency Injection Cookbook', function () {
7575
});
7676

7777
describe('in Parent Finder', function () {
78-
let cathy1 = element(by.css('alex cathy'));
79-
let craig1 = element(by.css('alex craig'));
80-
let carol1 = element(by.css('alex carol p'));
81-
let carol2 = element(by.css('barry carol p'));
78+
let cathy1 = element(by.css('di-alex di-cathy'));
79+
let craig1 = element(by.css('di-alex di-craig'));
80+
let carol1 = element(by.css('di-alex di-carol p'));
81+
let carol2 = element(by.css('di-barry di-carol p'));
8282

8383
it('"Cathy" should find "Alex" via the component class', function () {
8484
expect(cathy1.getText()).toContain('Found Alex via the component');

public/docs/_examples/cb-dependency-injection/ts/app/hero-bio.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// #docregion
22
import { Component, Input, OnInit } from '@angular/core';
33

4-
import { Hero } from './hero';
54
import { HeroCacheService } from './hero-cache.service';
65

76
// #docregion component
@@ -17,7 +16,6 @@ import { HeroCacheService } from './hero-cache.service';
1716
})
1817

1918
export class HeroBioComponent implements OnInit {
20-
2119
@Input() heroId: number;
2220

2321
constructor(private heroCache: HeroCacheService) { }

public/docs/_examples/cb-dependency-injection/ts/app/hero-bios.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docplaster
22
// #docregion
3-
import { Component} from '@angular/core';
3+
import { Component } from '@angular/core';
44

55
import { HeroContactComponent } from './hero-contact.component';
66
import { HeroBioComponent } from './hero-bio.component';

public/docs/_examples/cb-dependency-injection/ts/app/hero-contact.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docplaster
22
// #docregion
3-
import { Component, ElementRef, Host, Inject, Optional } from '@angular/core';
3+
import { Component, Host, Optional } from '@angular/core';
44

55
import { HeroCacheService } from './hero-cache.service';
66
import { LoggerService } from './logger.service';

public/docs/_examples/cb-dependency-injection/ts/app/highlight.directive.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
// #docplaster
22
// #docregion
3-
import { Directive, ElementRef, Input } from '@angular/core';
3+
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
44

55
@Directive({
6-
selector: '[myHighlight]',
7-
host: {
8-
'(mouseenter)': 'onMouseEnter()',
9-
'(mouseleave)': 'onMouseLeave()'
10-
}
6+
selector: '[myHighlight]'
117
})
128
export class HighlightDirective {
139

@@ -19,8 +15,13 @@ export class HighlightDirective {
1915
this.el = el.nativeElement;
2016
}
2117

22-
onMouseEnter() { this.highlight(this.highlightColor || 'cyan'); }
23-
onMouseLeave() { this.highlight(null); }
18+
@HostListener('mouseenter') onMouseEnter() {
19+
this.highlight(this.highlightColor || 'cyan');
20+
}
21+
22+
@HostListener('mouseleave') onMouseLeave() {
23+
this.highlight(null);
24+
}
2425

2526
private highlight(color: string) {
2627
this.el.style.backgroundColor = color;

public/docs/_examples/cb-dependency-injection/ts/app/parent-finder.component.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ const templateC = `
4545
</div>`;
4646

4747
@Component({
48-
selector: 'carol',
48+
selector: 'di-carol',
4949
template: templateC
5050
})
5151
// #docregion carol-class
5252
export class CarolComponent {
53-
name= 'Carol';
53+
name = 'Carol';
5454
// #docregion carol-ctor
5555
constructor( @Optional() public parent: Parent ) { }
5656
// #enddocregion carol-ctor
@@ -59,11 +59,11 @@ export class CarolComponent {
5959
// #enddocregion carol
6060

6161
@Component({
62-
selector: 'chris',
62+
selector: 'di-chris',
6363
template: templateC
6464
})
6565
export class ChrisComponent {
66-
name= 'Chris';
66+
name = 'Chris';
6767
constructor( @Optional() public parent: Parent ) { }
6868
}
6969

@@ -73,7 +73,7 @@ export class ChrisComponent {
7373
*/
7474
// #docregion craig
7575
@Component({
76-
selector: 'craig',
76+
selector: 'di-craig',
7777
template: `
7878
<div class="c">
7979
<h3>Craig</h3>
@@ -100,12 +100,12 @@ const templateB = `
100100
<h3>{{name}}</h3>
101101
<p>My parent is {{parent?.name}}</p>
102102
</div>
103-
<carol></carol>
104-
<chris></chris>
103+
<di-carol></di-carol>
104+
<di-chris></di-chris>
105105
</div>`;
106106

107107
@Component({
108-
selector: 'barry',
108+
selector: 'di-barry',
109109
template: templateB,
110110
directives: C_DIRECTIVES,
111111
providers: [{ provide: Parent, useExisting: forwardRef(() => BarryComponent) }]
@@ -119,26 +119,26 @@ export class BarryComponent implements Parent {
119119
// #enddocregion barry
120120

121121
@Component({
122-
selector: 'bob',
122+
selector: 'di-bob',
123123
template: templateB,
124124
directives: C_DIRECTIVES,
125125
providers: [ provideParent(BobComponent) ]
126126
})
127127
export class BobComponent implements Parent {
128-
name= 'Bob';
128+
name = 'Bob';
129129
constructor( @SkipSelf() @Optional() public parent: Parent ) { }
130130
}
131131

132132
@Component({
133-
selector: 'beth',
133+
selector: 'di-beth',
134134
template: templateB,
135135
directives: C_DIRECTIVES,
136136
// #docregion beth-providers
137137
providers: [ provideParent(BethComponent, DifferentParent) ]
138138
// #enddocregion beth-providers
139139
})
140140
export class BethComponent implements Parent {
141-
name= 'Beth';
141+
name = 'Beth';
142142
constructor( @SkipSelf() @Optional() public parent: Parent ) { }
143143
}
144144

@@ -148,13 +148,13 @@ const B_DIRECTIVES = [ BarryComponent, BethComponent, BobComponent ];
148148

149149
// #docregion alex, alex-1
150150
@Component({
151-
selector: 'alex',
151+
selector: 'di-alex',
152152
template: `
153153
<div class="a">
154154
<h3>{{name}}</h3>
155-
<cathy></cathy>
156-
<craig></craig>
157-
<carol></carol>
155+
<di-cathy></di-cathy>
156+
<di-craig></di-craig>
157+
<di-carol></di-carol>
158158
</div>`,
159159
// #enddocregion alex-1
160160
// #docregion alex-providers
@@ -170,22 +170,22 @@ const B_DIRECTIVES = [ BarryComponent, BethComponent, BobComponent ];
170170
export class AlexComponent extends Base
171171
// #enddocregion alex-class-signature
172172
{
173-
name= 'Alex';
173+
name = 'Alex';
174174
}
175175
// #enddocregion alex, alex-1
176176

177177
/////
178178

179179
// #docregion alice
180180
@Component({
181-
selector: 'alice',
181+
selector: 'di-alice',
182182
template: `
183183
<div class="a">
184184
<h3>{{name}}</h3>
185-
<barry></barry>
186-
<beth></beth>
187-
<bob></bob>
188-
<carol></carol>
185+
<di-barry></di-barry>
186+
<di-beth></di-beth>
187+
<di-bob></di-bob>
188+
<di-carol></di-carol>
189189
</div> `,
190190
directives: [ B_DIRECTIVES, C_DIRECTIVES ],
191191
// #docregion alice-providers
@@ -196,7 +196,7 @@ export class AlexComponent extends Base
196196
export class AliceComponent implements Parent
197197
// #enddocregion alice-class-signature
198198
{
199-
name= 'Alice';
199+
name = 'Alice';
200200
}
201201
// #enddocregion alice
202202

@@ -206,7 +206,7 @@ export class AliceComponent implements Parent
206206
*/
207207
// #docregion cathy
208208
@Component({
209-
selector: 'cathy',
209+
selector: 'di-cathy',
210210
template: `
211211
<div class="c">
212212
<h3>Cathy</h3>
@@ -223,8 +223,8 @@ export class CathyComponent {
223223
selector: 'parent-finder',
224224
template: `
225225
<h2>Parent Finder</h2>
226-
<alex></alex>
227-
<alice></alice>`,
226+
<di-alex></di-alex>
227+
<di-alice></di-alice>`,
228228
directives: [ AlexComponent, AliceComponent ]
229229
})
230230
export class ParentFinderComponent { }

0 commit comments

Comments
 (0)