Skip to content

Commit 074a33a

Browse files
committed
chore: tslint sweep done
1 parent 1cc5284 commit 074a33a

File tree

65 files changed

+199
-261
lines changed

Some content is hidden

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

65 files changed

+199
-261
lines changed

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

+3-3
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

+2-2
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

+1-1
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

+1
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

+17-11
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

+8-8
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

+2-2
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

+1
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

+1-1
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

+1-1
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/ts/app/hero-bio.component.ts

-2
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

+1-1
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

+1-1
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

+9-8
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* tslint:disable:no-unused-variable */
2-
/* tslint:disable:one-line:check-open-brace*/
1+
/* tslint:disable:no-unused-variable component-selector-name one-line check-open-brace */
2+
/* tslint:disable:*/
33
// #docplaster
44
// #docregion
55
import { Component, forwardRef, Optional, provide, SkipSelf } from '@angular/core';
@@ -23,7 +23,7 @@ const provideParent =
2323
// #enddocregion provide-parent, provide-the-parent
2424
// #docregion provide-parent
2525
(component: any, parentType?: any) => {
26-
return { provide: parentType || Parent, useExisting: forwardRef(() => component) };
26+
return { provide: parentType || Parent, useExisting: forwardRef(() => component) };
2727
};
2828
// #enddocregion provide-parent
2929

public/docs/_examples/cb-dynamic-form/ts/app/app.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// #docregion
22
import { Component } from '@angular/core';
33

4-
import { DynamicForm } from './dynamic-form.component';
4+
import { DynamicFormComponent } from './dynamic-form.component';
55
import { QuestionService } from './question.service';
66

77
@Component({
@@ -12,7 +12,7 @@ import { QuestionService } from './question.service';
1212
<dynamic-form [questions]="questions"></dynamic-form>
1313
</div>
1414
`,
15-
directives: [DynamicForm],
15+
directives: [DynamicFormComponent],
1616
providers: [QuestionService]
1717
})
1818
export class AppComponent {

public/docs/_examples/cb-dynamic-form/ts/app/dynamic-form.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { DynamicFormQuestionComponent } from './dynamic-form-question.component'
1212
directives: [DynamicFormQuestionComponent],
1313
providers: [QuestionControlService]
1414
})
15-
export class DynamicForm {
15+
export class DynamicFormComponent implements OnInit {
1616

1717
@Input() questions: QuestionBase<any>[] = [];
1818
form: ControlGroup;

public/docs/_examples/cb-dynamic-form/ts/app/question-control.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docregion
22
import { Injectable } from '@angular/core';
3-
import { ControlGroup, FormBuilder, Validators } from '@angular/common';
3+
import { FormBuilder, Validators } from '@angular/common';
44
import { QuestionBase } from './question-base';
55

66
@Injectable()

public/docs/_examples/cb-dynamic-form/ts/app/question.service.ts

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { Injectable } from '@angular/core';
33

44
import { QuestionBase } from './question-base';
5-
import { DynamicForm } from './dynamic-form.component';
65
import { TextboxQuestion } from './question-textbox';
76
import { DropdownQuestion } from './question-dropdown';
87

public/docs/_examples/cb-ts-to-js/e2e-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('TypeScript to Javascript tests', function () {
5959

6060
it('should support content and view queries', function() {
6161
let app = element(by.css('heroes-queries'));
62-
let windstorm = app.element(by.css('hero:first-child'));
62+
let windstorm = app.element(by.css('a-hero:first-child'));
6363

6464
app.element(by.buttonText('Activate')).click();
6565
expect(windstorm.element(by.css('h2')).getAttribute('class')).toBe('active');

public/docs/_examples/cb-ts-to-js/js/app/heroes-queries.component.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
// #docregion content
1717
var HeroComponent = ng.core.Component({
18-
selector: 'hero',
18+
selector: 'a-hero',
1919
template: '<h2 [class.active]=active>' +
2020
'{{hero.name}} ' +
2121
'<ng-content></ng-content>' +
@@ -38,10 +38,10 @@
3838
var AppComponent = ng.core.Component({
3939
selector: 'heroes-queries',
4040
template:
41-
'<hero *ngFor="let hero of heroData"' +
41+
'<a-hero *ngFor="let hero of heroData"' +
4242
'[hero]="hero">' +
4343
'<active-label></active-label>' +
44-
'</hero>' +
44+
'</a-hero>' +
4545
'<button (click)="activate()">' +
4646
'Activate' +
4747
'</button>',

public/docs/_examples/cb-ts-to-js/ts/app/heroes-queries.component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ActiveLabelComponent {
2323

2424
// #docregion content
2525
@Component({
26-
selector: 'hero',
26+
selector: 'a-hero',
2727
template: `<h2 [class.active]=active>
2828
{{hero.name}}
2929
<ng-content></ng-content>
@@ -48,10 +48,10 @@ class HeroComponent {
4848
@Component({
4949
selector: 'heroes-queries',
5050
template: `
51-
<hero *ngFor="let hero of heroData"
51+
<a-hero *ngFor="let hero of heroData"
5252
[hero]="hero">
5353
<active-label></active-label>
54-
</hero>
54+
</a-hero>
5555
<button (click)="activate()">
5656
Activate
5757
</button>

public/docs/_examples/cb-ts-to-js/ts/app/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* tslint:disable no-unused-variable */
12
// #docregion ng2import
23
import { bootstrap }
34
from '@angular/platform-browser-dynamic';

public/docs/_examples/cli-quickstart/e2e-spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
describe('cli-quickstart App', () => {
33
beforeEach(() => {
44
return browser.get('/');
5-
})
5+
});
66

77
it('should display message saying app works', () => {
8-
var pageTitle = element(by.css('cli-quickstart-app h1')).getText()
8+
let pageTitle = element(by.css('cli-quickstart-app h1')).getText();
99
expect(pageTitle).toEqual('My First Angular 2 App');
1010
});
1111
});

public/docs/_examples/dependency-injection/ts/app/app.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { APP_CONFIG, AppConfig,
1010
HERO_DI_CONFIG } from './app.config';
1111
import { Logger } from './logger.service';
1212

13-
import { User, UserService } from './user.service';
13+
import { UserService } from './user.service';
1414
// #enddocregion imports
1515
import { InjectorComponent } from './injector.component';
1616
import { TestComponent } from './test.component';

public/docs/_examples/dependency-injection/ts/app/car/car.component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #docregion
2-
import { Component, Injector } from '@angular/core';
2+
import { Component } from '@angular/core';
33

44
import { Car, Engine, Tires } from './car';
55
import { Car as CarNoDi } from './car-no-di';
@@ -27,12 +27,12 @@ import { useInjector } from './car-injector';
2727
providers: [Car, Engine, Tires]
2828
})
2929
export class CarComponent {
30-
constructor(public car: Car) {}
31-
3230
factoryCar = (new CarFactory).createCar();
3331
injectorCar = useInjector();
3432
noDiCar = new CarNoDi;
3533
simpleCar = simpleCar();
3634
superCar = superCar();
3735
testCar = testCar();
36+
37+
constructor(public car: Car) {}
3838
}

public/docs/_examples/dependency-injection/ts/app/heroes/hero.service.1.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// #docregion
22
import { Injectable } from '@angular/core';
33

4-
import { Hero } from './hero';
54
import { HEROES } from './mock-heroes';
65

76
@Injectable()

public/docs/_examples/dependency-injection/ts/app/heroes/hero.service.2.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// #docregion
22
import { Injectable } from '@angular/core';
33

4-
import { Hero } from './hero';
54
import { HEROES } from './mock-heroes';
65
import { Logger } from '../logger.service';
76

0 commit comments

Comments
 (0)