style(docs-infra): fix docs examples for tslint rule `semicolon` (#38143)

This commit updates the docs examples to be compatible with the
`semicolon` 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:11 +03:00 committed by Alex Rickabaugh
parent 7c0f11789b
commit 77f38d3be1
21 changed files with 23 additions and 23 deletions

View File

@ -84,7 +84,7 @@ export class AppComponent implements OnInit {
} }
resetList() { resetList() {
this.resetItems() this.resetItems();
this.itemsWithTrackByCountReset = 0; this.itemsWithTrackByCountReset = 0;
this.itemsNoTrackByCount = ++this.itemsNoTrackByCount; this.itemsNoTrackByCount = ++this.itemsNoTrackByCount;
} }

View File

@ -22,5 +22,5 @@ export function runnersUpFactory(take: number) {
.join(', '); .join(', ');
// #docregion factory-synopsis // #docregion factory-synopsis
}; };
}; }
// #enddocregion factory-synopsis // #enddocregion factory-synopsis

View File

@ -107,7 +107,7 @@ export class OldLogger {
logs: string[] = []; logs: string[] = [];
log(message: string) { log(message: string) {
throw new Error('Should not call the old logger!'); throw new Error('Should not call the old logger!');
}; }
} }
@Component({ @Component({

View File

@ -14,7 +14,7 @@ describe('Elements', () => {
const waitForText = (elem: ElementFinder) => { const waitForText = (elem: ElementFinder) => {
// Waiting for the element to have some text, makes the tests less flaky. // Waiting for the element to have some text, makes the tests less flaky.
browser.wait(async () => /\S/.test(await elem.getText()), 5000); browser.wait(async () => /\S/.test(await elem.getText()), 5000);
} };
beforeEach(() => browser.get('')); beforeEach(() => browser.get(''));

View File

@ -160,7 +160,7 @@ function expectFormIsInvalid() {
function triggerAlterEgoValidation() { function triggerAlterEgoValidation() {
// alterEgo has updateOn set to 'blur', click outside of the input to trigger the blur event // alterEgo has updateOn set to 'blur', click outside of the input to trigger the blur event
element(by.css('app-root')).click() element(by.css('app-root')).click();
} }
function waitForAlterEgoValidation() { function waitForAlterEgoValidation() {

View File

@ -19,7 +19,7 @@ export const identityRevealedValidator: ValidatorFn = (control: FormGroup): Vali
}) })
export class IdentityRevealedValidatorDirective implements Validator { export class IdentityRevealedValidatorDirective implements Validator {
validate(control: AbstractControl): ValidationErrors { validate(control: AbstractControl): ValidationErrors {
return identityRevealedValidator(control) return identityRevealedValidator(control);
} }
} }
// #enddocregion cross-validation-directive // #enddocregion cross-validation-directive

View File

@ -30,9 +30,9 @@ export class HeroTaxReturnComponent {
onCanceled() { onCanceled() {
this.flashMessage('Canceled'); this.flashMessage('Canceled');
this.heroTaxReturnService.restoreTaxReturn(); this.heroTaxReturnService.restoreTaxReturn();
}; }
onClose() { this.close.emit(); }; onClose() { this.close.emit(); }
onSaved() { onSaved() {
this.flashMessage('Saved'); this.flashMessage('Saved');

View File

@ -12,7 +12,7 @@ export interface RequestCacheEntry {
// #docregion request-cache // #docregion request-cache
export abstract class RequestCache { export abstract class RequestCache {
abstract get(req: HttpRequest<any>): HttpResponse<any> | undefined; abstract get(req: HttpRequest<any>): HttpResponse<any> | undefined;
abstract put(req: HttpRequest<any>, response: HttpResponse<any>): void abstract put(req: HttpRequest<any>, response: HttpResponse<any>): void;
} }
// #enddocregion request-cache // #enddocregion request-cache

View File

@ -97,11 +97,11 @@ describe('NgModule-example', function () {
newContactButton.click().then(function () { newContactButton.click().then(function () {
input.click(); input.click();
nextButton.click() nextButton.click();
expect(contacts.validationError.getText()).toBe('Name is required.'); expect(contacts.validationError.getText()).toBe('Name is required.');
input.click(); input.click();
contacts.input.sendKeys('Watson'); contacts.input.sendKeys('Watson');
saveButton.click() saveButton.click();
expect(contacts.contactNameHeader.getText()).toBe('Awesome Watson'); expect(contacts.contactNameHeader.getText()).toBe('Awesome Watson');
}); });

View File

@ -6,4 +6,4 @@ export const CRISES: Crisis[] = [
{ id: 2, name: 'Sky Rains Great White Sharks' }, { id: 2, name: 'Sky Rains Great White Sharks' },
{ id: 3, name: 'Giant Asteroid Heading For Earth' }, { id: 3, name: 'Giant Asteroid Heading For Earth' },
{ id: 4, name: 'Procrastinators Meeting Delayed Again' }, { id: 4, name: 'Procrastinators Meeting Delayed Again' },
] ];

View File

@ -19,5 +19,5 @@ export class DialogService {
const confirmation = window.confirm(message || 'Is it OK?'); const confirmation = window.confirm(message || 'Is it OK?');
return of(confirmation); return of(confirmation);
}; }
} }

View File

@ -18,7 +18,7 @@ export class FilterTextService {
match = true; match = true;
break; break;
} }
}; }
return match; return match;
}); });
filteredList = filtered; filteredList = filtered;

View File

@ -51,7 +51,7 @@ export class MasterService {
export class ReversePipe implements PipeTransform { export class ReversePipe implements PipeTransform {
transform(s: string) { transform(s: string) {
let r = ''; let r = '';
for (let i = s.length; i; ) { r += s[--i]; }; for (let i = s.length; i; ) { r += s[--i]; }
return r; return r;
} }
} }

View File

@ -139,5 +139,5 @@ class Page {
// Get the component's injected router navigation spy // Get the component's injected router navigation spy
const routerSpy = fixture.debugElement.injector.get(Router); const routerSpy = fixture.debugElement.injector.get(Router);
this.navSpy = routerSpy.navigate as jasmine.Spy; this.navSpy = routerSpy.navigate as jasmine.Spy;
}; }
} }

View File

@ -8,7 +8,7 @@ import { WelcomeComponent } from './welcome.component';
class MockUserService { class MockUserService {
isLoggedIn = true; isLoggedIn = true;
user = { name: 'Test User'}; user = { name: 'Test User'};
}; }
// #enddocregion mock-user-service // #enddocregion mock-user-service
describe('WelcomeComponent (class only)', () => { describe('WelcomeComponent (class only)', () => {

View File

@ -120,7 +120,7 @@ function expectHeading(hLevel: number, expectedText: string): void {
let hTag = `h${hLevel}`; let hTag = `h${hLevel}`;
let hText = element(by.css(hTag)).getText(); let hText = element(by.css(hTag)).getText();
expect(hText).toEqual(expectedText, hTag); expect(hText).toEqual(expectedText, hTag);
}; }
function getPageElts() { function getPageElts() {
return { return {

View File

@ -120,7 +120,7 @@ function expectHeading(hLevel: number, expectedText: string): void {
let hTag = `h${hLevel}`; let hTag = `h${hLevel}`;
let hText = element(by.css(hTag)).getText(); let hText = element(by.css(hTag)).getText();
expect(hText).toEqual(expectedText, hTag); expect(hText).toEqual(expectedText, hTag);
}; }
function getPageElts() { function getPageElts() {
return { return {

View File

@ -124,7 +124,7 @@ function expectHeading(hLevel: number, expectedText: string): void {
let hTag = `h${hLevel}`; let hTag = `h${hLevel}`;
let hText = element(by.css(hTag)).getText(); let hText = element(by.css(hTag)).getText();
expect(hText).toEqual(expectedText, hTag); expect(hText).toEqual(expectedText, hTag);
}; }
function getPageElts() { function getPageElts() {
return { return {

View File

@ -164,7 +164,7 @@ function expectHeading(hLevel: number, expectedText: string): void {
let hTag = `h${hLevel}`; let hTag = `h${hLevel}`;
let hText = element(by.css(hTag)).getText(); let hText = element(by.css(hTag)).getText();
expect(hText).toEqual(expectedText, hTag); expect(hText).toEqual(expectedText, hTag);
}; }
function getHeroLiEltById(id: number) { function getHeroLiEltById(id: number) {
let spanForId = element(by.cssContainingText('li span.badge', id.toString())); let spanForId = element(by.cssContainingText('li span.badge', id.toString()));

View File

@ -286,7 +286,7 @@ function expectHeading(hLevel: number, expectedText: string): void {
let hTag = `h${hLevel}`; let hTag = `h${hLevel}`;
let hText = element(by.css(hTag)).getText(); let hText = element(by.css(hTag)).getText();
expect(hText).toEqual(expectedText, hTag); expect(hText).toEqual(expectedText, hTag);
}; }
function getHeroAEltById(id: number): ElementFinder { function getHeroAEltById(id: number): ElementFinder {
let spanForId = element(by.cssContainingText('li span.badge', id.toString())); let spanForId = element(by.cssContainingText('li span.badge', id.toString()));

View File

@ -81,7 +81,7 @@ describe('PhoneCat Application', function() {
waitForCount(phoneList, 1); waitForCount(phoneList, 1);
let nexusPhone = phoneList.first(); let nexusPhone = phoneList.first();
let detailLink = nexusPhone.all(by.css('a')).first() let detailLink = nexusPhone.all(by.css('a')).first();
detailLink.click(); detailLink.click();
expect(browser.getLocationAbsUrl()).toBe('/phones/nexus-s'); expect(browser.getLocationAbsUrl()).toBe('/phones/nexus-s');