From 77f38d3be1007f29f1cbb43e1d78d4d0ded0c9ad Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 30 Jul 2020 13:03:11 +0300 Subject: [PATCH] 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 --- .../examples/built-in-directives/src/app/app.component.ts | 2 +- .../dependency-injection-in-action/src/app/runners-up.ts | 2 +- .../dependency-injection/src/app/providers.component.ts | 2 +- aio/content/examples/elements/e2e/src/app.e2e-spec.ts | 2 +- aio/content/examples/form-validation/e2e/src/app.e2e-spec.ts | 2 +- .../src/app/shared/identity-revealed.directive.ts | 2 +- .../src/app/hero-tax-return.component.ts | 4 ++-- aio/content/examples/http/src/app/request-cache.service.ts | 2 +- aio/content/examples/ngmodules/e2e/src/app.e2e-spec.ts | 4 ++-- .../examples/router/src/app/crisis-center/mock-crises.ts | 2 +- aio/content/examples/router/src/app/dialog.service.ts | 2 +- .../src/04-10/app/shared/filter-text/filter-text.service.ts | 2 +- aio/content/examples/testing/src/app/demo/demo.ts | 2 +- .../examples/testing/src/app/hero/hero-list.component.spec.ts | 2 +- .../testing/src/app/welcome/welcome.component.spec.ts | 2 +- aio/content/examples/toh-pt2/e2e/src/app.e2e-spec.ts | 2 +- aio/content/examples/toh-pt3/e2e/src/app.e2e-spec.ts | 2 +- aio/content/examples/toh-pt4/e2e/src/app.e2e-spec.ts | 2 +- aio/content/examples/toh-pt5/e2e/src/app.e2e-spec.ts | 2 +- aio/content/examples/toh-pt6/e2e/src/app.e2e-spec.ts | 2 +- .../examples/upgrade-phonecat-1-typescript/e2e-spec.ts | 2 +- 21 files changed, 23 insertions(+), 23 deletions(-) diff --git a/aio/content/examples/built-in-directives/src/app/app.component.ts b/aio/content/examples/built-in-directives/src/app/app.component.ts index 36b75f60b7..f7c7bc7ccd 100644 --- a/aio/content/examples/built-in-directives/src/app/app.component.ts +++ b/aio/content/examples/built-in-directives/src/app/app.component.ts @@ -84,7 +84,7 @@ export class AppComponent implements OnInit { } resetList() { - this.resetItems() + this.resetItems(); this.itemsWithTrackByCountReset = 0; this.itemsNoTrackByCount = ++this.itemsNoTrackByCount; } diff --git a/aio/content/examples/dependency-injection-in-action/src/app/runners-up.ts b/aio/content/examples/dependency-injection-in-action/src/app/runners-up.ts index 96d8557f98..1c0afb823c 100644 --- a/aio/content/examples/dependency-injection-in-action/src/app/runners-up.ts +++ b/aio/content/examples/dependency-injection-in-action/src/app/runners-up.ts @@ -22,5 +22,5 @@ export function runnersUpFactory(take: number) { .join(', '); // #docregion factory-synopsis }; -}; +} // #enddocregion factory-synopsis diff --git a/aio/content/examples/dependency-injection/src/app/providers.component.ts b/aio/content/examples/dependency-injection/src/app/providers.component.ts index 1467ec07b6..cb1160aa40 100644 --- a/aio/content/examples/dependency-injection/src/app/providers.component.ts +++ b/aio/content/examples/dependency-injection/src/app/providers.component.ts @@ -107,7 +107,7 @@ export class OldLogger { logs: string[] = []; log(message: string) { throw new Error('Should not call the old logger!'); - }; + } } @Component({ diff --git a/aio/content/examples/elements/e2e/src/app.e2e-spec.ts b/aio/content/examples/elements/e2e/src/app.e2e-spec.ts index 28127fa6ca..ad5de6efcd 100644 --- a/aio/content/examples/elements/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/elements/e2e/src/app.e2e-spec.ts @@ -14,7 +14,7 @@ describe('Elements', () => { const waitForText = (elem: ElementFinder) => { // Waiting for the element to have some text, makes the tests less flaky. browser.wait(async () => /\S/.test(await elem.getText()), 5000); - } + }; beforeEach(() => browser.get('')); diff --git a/aio/content/examples/form-validation/e2e/src/app.e2e-spec.ts b/aio/content/examples/form-validation/e2e/src/app.e2e-spec.ts index b86f913e5c..ceb8c96ff7 100644 --- a/aio/content/examples/form-validation/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/form-validation/e2e/src/app.e2e-spec.ts @@ -160,7 +160,7 @@ function expectFormIsInvalid() { function triggerAlterEgoValidation() { // 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() { diff --git a/aio/content/examples/form-validation/src/app/shared/identity-revealed.directive.ts b/aio/content/examples/form-validation/src/app/shared/identity-revealed.directive.ts index b5dbd05c15..5801f6bdb4 100644 --- a/aio/content/examples/form-validation/src/app/shared/identity-revealed.directive.ts +++ b/aio/content/examples/form-validation/src/app/shared/identity-revealed.directive.ts @@ -19,7 +19,7 @@ export const identityRevealedValidator: ValidatorFn = (control: FormGroup): Vali }) export class IdentityRevealedValidatorDirective implements Validator { validate(control: AbstractControl): ValidationErrors { - return identityRevealedValidator(control) + return identityRevealedValidator(control); } } // #enddocregion cross-validation-directive diff --git a/aio/content/examples/hierarchical-dependency-injection/src/app/hero-tax-return.component.ts b/aio/content/examples/hierarchical-dependency-injection/src/app/hero-tax-return.component.ts index 500bcc09b9..cbca85946a 100644 --- a/aio/content/examples/hierarchical-dependency-injection/src/app/hero-tax-return.component.ts +++ b/aio/content/examples/hierarchical-dependency-injection/src/app/hero-tax-return.component.ts @@ -30,9 +30,9 @@ export class HeroTaxReturnComponent { onCanceled() { this.flashMessage('Canceled'); this.heroTaxReturnService.restoreTaxReturn(); - }; + } - onClose() { this.close.emit(); }; + onClose() { this.close.emit(); } onSaved() { this.flashMessage('Saved'); diff --git a/aio/content/examples/http/src/app/request-cache.service.ts b/aio/content/examples/http/src/app/request-cache.service.ts index a055a74d75..aeb2ff9662 100644 --- a/aio/content/examples/http/src/app/request-cache.service.ts +++ b/aio/content/examples/http/src/app/request-cache.service.ts @@ -12,7 +12,7 @@ export interface RequestCacheEntry { // #docregion request-cache export abstract class RequestCache { abstract get(req: HttpRequest): HttpResponse | undefined; - abstract put(req: HttpRequest, response: HttpResponse): void + abstract put(req: HttpRequest, response: HttpResponse): void; } // #enddocregion request-cache diff --git a/aio/content/examples/ngmodules/e2e/src/app.e2e-spec.ts b/aio/content/examples/ngmodules/e2e/src/app.e2e-spec.ts index 66c9fad50d..f470c9b3fa 100644 --- a/aio/content/examples/ngmodules/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/ngmodules/e2e/src/app.e2e-spec.ts @@ -97,11 +97,11 @@ describe('NgModule-example', function () { newContactButton.click().then(function () { input.click(); - nextButton.click() + nextButton.click(); expect(contacts.validationError.getText()).toBe('Name is required.'); input.click(); contacts.input.sendKeys('Watson'); - saveButton.click() + saveButton.click(); expect(contacts.contactNameHeader.getText()).toBe('Awesome Watson'); }); diff --git a/aio/content/examples/router/src/app/crisis-center/mock-crises.ts b/aio/content/examples/router/src/app/crisis-center/mock-crises.ts index 1870a86170..c21611815d 100644 --- a/aio/content/examples/router/src/app/crisis-center/mock-crises.ts +++ b/aio/content/examples/router/src/app/crisis-center/mock-crises.ts @@ -6,4 +6,4 @@ export const CRISES: Crisis[] = [ { id: 2, name: 'Sky Rains Great White Sharks' }, { id: 3, name: 'Giant Asteroid Heading For Earth' }, { id: 4, name: 'Procrastinators Meeting Delayed Again' }, -] +]; diff --git a/aio/content/examples/router/src/app/dialog.service.ts b/aio/content/examples/router/src/app/dialog.service.ts index e0ed6760cb..2c4de6b403 100644 --- a/aio/content/examples/router/src/app/dialog.service.ts +++ b/aio/content/examples/router/src/app/dialog.service.ts @@ -19,5 +19,5 @@ export class DialogService { const confirmation = window.confirm(message || 'Is it OK?'); return of(confirmation); - }; + } } diff --git a/aio/content/examples/styleguide/src/04-10/app/shared/filter-text/filter-text.service.ts b/aio/content/examples/styleguide/src/04-10/app/shared/filter-text/filter-text.service.ts index 87978e10e5..7de3b3ce33 100644 --- a/aio/content/examples/styleguide/src/04-10/app/shared/filter-text/filter-text.service.ts +++ b/aio/content/examples/styleguide/src/04-10/app/shared/filter-text/filter-text.service.ts @@ -18,7 +18,7 @@ export class FilterTextService { match = true; break; } - }; + } return match; }); filteredList = filtered; diff --git a/aio/content/examples/testing/src/app/demo/demo.ts b/aio/content/examples/testing/src/app/demo/demo.ts index db9383a116..b51ee5c6bc 100644 --- a/aio/content/examples/testing/src/app/demo/demo.ts +++ b/aio/content/examples/testing/src/app/demo/demo.ts @@ -51,7 +51,7 @@ export class MasterService { export class ReversePipe implements PipeTransform { transform(s: string) { let r = ''; - for (let i = s.length; i; ) { r += s[--i]; }; + for (let i = s.length; i; ) { r += s[--i]; } return r; } } diff --git a/aio/content/examples/testing/src/app/hero/hero-list.component.spec.ts b/aio/content/examples/testing/src/app/hero/hero-list.component.spec.ts index 50ae12f7d6..526be15c43 100644 --- a/aio/content/examples/testing/src/app/hero/hero-list.component.spec.ts +++ b/aio/content/examples/testing/src/app/hero/hero-list.component.spec.ts @@ -139,5 +139,5 @@ class Page { // Get the component's injected router navigation spy const routerSpy = fixture.debugElement.injector.get(Router); this.navSpy = routerSpy.navigate as jasmine.Spy; - }; + } } diff --git a/aio/content/examples/testing/src/app/welcome/welcome.component.spec.ts b/aio/content/examples/testing/src/app/welcome/welcome.component.spec.ts index fd91488f26..076f4c7405 100644 --- a/aio/content/examples/testing/src/app/welcome/welcome.component.spec.ts +++ b/aio/content/examples/testing/src/app/welcome/welcome.component.spec.ts @@ -8,7 +8,7 @@ import { WelcomeComponent } from './welcome.component'; class MockUserService { isLoggedIn = true; user = { name: 'Test User'}; -}; +} // #enddocregion mock-user-service describe('WelcomeComponent (class only)', () => { diff --git a/aio/content/examples/toh-pt2/e2e/src/app.e2e-spec.ts b/aio/content/examples/toh-pt2/e2e/src/app.e2e-spec.ts index d8133c60f4..4927c996c9 100644 --- a/aio/content/examples/toh-pt2/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/toh-pt2/e2e/src/app.e2e-spec.ts @@ -120,7 +120,7 @@ function expectHeading(hLevel: number, expectedText: string): void { let hTag = `h${hLevel}`; let hText = element(by.css(hTag)).getText(); expect(hText).toEqual(expectedText, hTag); -}; +} function getPageElts() { return { diff --git a/aio/content/examples/toh-pt3/e2e/src/app.e2e-spec.ts b/aio/content/examples/toh-pt3/e2e/src/app.e2e-spec.ts index 02b1b11ac6..cfd1009289 100644 --- a/aio/content/examples/toh-pt3/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/toh-pt3/e2e/src/app.e2e-spec.ts @@ -120,7 +120,7 @@ function expectHeading(hLevel: number, expectedText: string): void { let hTag = `h${hLevel}`; let hText = element(by.css(hTag)).getText(); expect(hText).toEqual(expectedText, hTag); -}; +} function getPageElts() { return { diff --git a/aio/content/examples/toh-pt4/e2e/src/app.e2e-spec.ts b/aio/content/examples/toh-pt4/e2e/src/app.e2e-spec.ts index ae104b4011..3a35cb51dc 100644 --- a/aio/content/examples/toh-pt4/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/toh-pt4/e2e/src/app.e2e-spec.ts @@ -124,7 +124,7 @@ function expectHeading(hLevel: number, expectedText: string): void { let hTag = `h${hLevel}`; let hText = element(by.css(hTag)).getText(); expect(hText).toEqual(expectedText, hTag); -}; +} function getPageElts() { return { diff --git a/aio/content/examples/toh-pt5/e2e/src/app.e2e-spec.ts b/aio/content/examples/toh-pt5/e2e/src/app.e2e-spec.ts index 13ad32cd11..d4a833b0ba 100644 --- a/aio/content/examples/toh-pt5/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/toh-pt5/e2e/src/app.e2e-spec.ts @@ -164,7 +164,7 @@ function expectHeading(hLevel: number, expectedText: string): void { let hTag = `h${hLevel}`; let hText = element(by.css(hTag)).getText(); expect(hText).toEqual(expectedText, hTag); -}; +} function getHeroLiEltById(id: number) { let spanForId = element(by.cssContainingText('li span.badge', id.toString())); diff --git a/aio/content/examples/toh-pt6/e2e/src/app.e2e-spec.ts b/aio/content/examples/toh-pt6/e2e/src/app.e2e-spec.ts index 2d579dc763..c723c0bf77 100644 --- a/aio/content/examples/toh-pt6/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/toh-pt6/e2e/src/app.e2e-spec.ts @@ -286,7 +286,7 @@ function expectHeading(hLevel: number, expectedText: string): void { let hTag = `h${hLevel}`; let hText = element(by.css(hTag)).getText(); expect(hText).toEqual(expectedText, hTag); -}; +} function getHeroAEltById(id: number): ElementFinder { let spanForId = element(by.cssContainingText('li span.badge', id.toString())); diff --git a/aio/content/examples/upgrade-phonecat-1-typescript/e2e-spec.ts b/aio/content/examples/upgrade-phonecat-1-typescript/e2e-spec.ts index 9abbd0648c..a72d3b5f09 100644 --- a/aio/content/examples/upgrade-phonecat-1-typescript/e2e-spec.ts +++ b/aio/content/examples/upgrade-phonecat-1-typescript/e2e-spec.ts @@ -81,7 +81,7 @@ describe('PhoneCat Application', function() { waitForCount(phoneList, 1); let nexusPhone = phoneList.first(); - let detailLink = nexusPhone.all(by.css('a')).first() + let detailLink = nexusPhone.all(by.css('a')).first(); detailLink.click(); expect(browser.getLocationAbsUrl()).toBe('/phones/nexus-s');