From 639d52fe7158783a0385646c2affd42be486c80f Mon Sep 17 00:00:00 2001 From: Rafael Date: Sun, 8 Apr 2018 18:19:25 -0300 Subject: [PATCH] refactor: ensure all 'TODO's are consistent (#23252) PR Close #23252 --- .../architecture/src/app/backend.service.ts | 2 +- .../src/app/hero-of-the-month.component.1.ts | 2 +- .../src/app/hero.service.ts | 2 +- .../src/app/parent-finder.component.ts | 2 +- .../src/app/user.service.ts | 2 +- .../dynamic-form/src/app/question.service.ts | 4 +-- .../http-interceptors/upload-interceptor.ts | 2 +- .../src/app/hero-list/hero-list.component.ts | 2 +- .../src/app/heroes/hero-list.component.1.ts | 2 +- .../src/app/heroes/hero-list.component.ts | 2 +- .../src/app/model/hero.service.spec.ts | 2 +- .../examples/toh-pt4/src/app/hero.service.ts | 2 +- .../examples/toh-pt5/src/app/hero.service.ts | 4 +-- .../custom-elements/api/api-list.component.ts | 2 +- .../app/custom-elements/api/api.service.ts | 2 +- aio/src/app/shared/location.service.ts | 2 +- packages/benchpress/src/runner.ts | 2 +- .../differs/default_iterable_differ.ts | 26 +++++++++---------- packages/core/src/util/lang.ts | 2 +- .../differs/default_iterable_differ_spec.ts | 2 +- .../differs/default_keyvalue_differ_spec.ts | 2 +- packages/http/testing/src/mock_backend.ts | 2 +- .../web_workers/shared/post_message_bus.ts | 2 +- packages/platform-webworker/src/worker_app.ts | 2 +- scripts/ci/test-js.sh | 2 +- tools/gulp-tasks/lint.js | 4 +-- 26 files changed, 41 insertions(+), 41 deletions(-) diff --git a/aio/content/examples/architecture/src/app/backend.service.ts b/aio/content/examples/architecture/src/app/backend.service.ts index e3e21a6ff4..c05a8fcb8a 100644 --- a/aio/content/examples/architecture/src/app/backend.service.ts +++ b/aio/content/examples/architecture/src/app/backend.service.ts @@ -15,7 +15,7 @@ export class BackendService { getAll(type: Type): PromiseLike { if (type === Hero) { - // TODO get from the database + // TODO: get from the database return Promise.resolve(HEROES); } let err = new Error('Cannot get object of this type'); diff --git a/aio/content/examples/dependency-injection-in-action/src/app/hero-of-the-month.component.1.ts b/aio/content/examples/dependency-injection-in-action/src/app/hero-of-the-month.component.1.ts index beaa35c53a..4eb3a14060 100644 --- a/aio/content/examples/dependency-injection-in-action/src/app/hero-of-the-month.component.1.ts +++ b/aio/content/examples/dependency-injection-in-action/src/app/hero-of-the-month.component.1.ts @@ -8,7 +8,7 @@ import { MinimalLogger } from './minimal-logger.service'; @Component({ selector: 'app-hero-of-the-month', templateUrl: './hero-of-the-month.component.html', - // Todo: move this aliasing, `useExisting` provider to the AppModule + // TODO: move this aliasing, `useExisting` provider to the AppModule providers: [{ provide: MinimalLogger, useExisting: LoggerService }] }) export class HeroOfTheMonthComponent { diff --git a/aio/content/examples/dependency-injection-in-action/src/app/hero.service.ts b/aio/content/examples/dependency-injection-in-action/src/app/hero.service.ts index 2063c30d7a..6eb5ffa14b 100644 --- a/aio/content/examples/dependency-injection-in-action/src/app/hero.service.ts +++ b/aio/content/examples/dependency-injection-in-action/src/app/hero.service.ts @@ -5,7 +5,7 @@ import { Hero } from './hero'; @Injectable() export class HeroService { - // TODO move to database + // TODO: move to database private heroes: Array = [ new Hero(1, 'RubberMan', 'Hero of many talents', '123-456-7899'), new Hero(2, 'Magma', 'Hero of all trades', '555-555-5555'), diff --git a/aio/content/examples/dependency-injection-in-action/src/app/parent-finder.component.ts b/aio/content/examples/dependency-injection-in-action/src/app/parent-finder.component.ts index f1e48d7695..1a3eaf8695 100644 --- a/aio/content/examples/dependency-injection-in-action/src/app/parent-finder.component.ts +++ b/aio/content/examples/dependency-injection-in-action/src/app/parent-finder.component.ts @@ -151,7 +151,7 @@ export class BethComponent implements Parent { // #docregion alex-1 }) // #enddocregion alex-1 -// Todo: Add `... implements Parent` to class signature +// TODO: Add `... implements Parent` to class signature // #docregion alex-1 // #docregion alex-class-signature export class AlexComponent extends Base diff --git a/aio/content/examples/dependency-injection/src/app/user.service.ts b/aio/content/examples/dependency-injection/src/app/user.service.ts index 8fdda925db..03e23b7687 100644 --- a/aio/content/examples/dependency-injection/src/app/user.service.ts +++ b/aio/content/examples/dependency-injection/src/app/user.service.ts @@ -7,7 +7,7 @@ export class User { public isAuthorized = false) { } } -// Todo: get the user; don't 'new' it. +// TODO: get the user; don't 'new' it. let alice = new User('Alice', true); let bob = new User('Bob', false); diff --git a/aio/content/examples/dynamic-form/src/app/question.service.ts b/aio/content/examples/dynamic-form/src/app/question.service.ts index bb452cf5e6..a1d9499c68 100644 --- a/aio/content/examples/dynamic-form/src/app/question.service.ts +++ b/aio/content/examples/dynamic-form/src/app/question.service.ts @@ -8,8 +8,8 @@ import { TextboxQuestion } from './question-textbox'; @Injectable() export class QuestionService { - // Todo: get from a remote source of question metadata - // Todo: make asynchronous + // TODO: get from a remote source of question metadata + // TODO: make asynchronous getQuestions() { let questions: QuestionBase[] = [ diff --git a/aio/content/examples/http/src/app/http-interceptors/upload-interceptor.ts b/aio/content/examples/http/src/app/http-interceptors/upload-interceptor.ts index 6acb5d0cdb..849e8f1f27 100644 --- a/aio/content/examples/http/src/app/http-interceptors/upload-interceptor.ts +++ b/aio/content/examples/http/src/app/http-interceptors/upload-interceptor.ts @@ -14,7 +14,7 @@ export class UploadInterceptor implements HttpInterceptor { if (req.url.indexOf('/upload/file') === -1) { return next.handle(req); } - const delay = 300; // Todo: inject delay? + const delay = 300; // TODO: inject delay? return createUploadEvents(delay); } } diff --git a/aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.ts b/aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.ts index c310fb8dd8..1243a0a5c0 100644 --- a/aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.ts +++ b/aio/content/examples/reactive-forms/src/app/hero-list/hero-list.component.ts @@ -23,7 +23,7 @@ export class HeroListComponent implements OnInit { getHeroes() { this.isLoading = true; this.heroes = this.heroService.getHeroes() - // Todo: error handling + // TODO: error handling .pipe(finalize(() => this.isLoading = false)); this.selectedHero = undefined; } diff --git a/aio/content/examples/router/src/app/heroes/hero-list.component.1.ts b/aio/content/examples/router/src/app/heroes/hero-list.component.1.ts index 8744772f06..50ad9b74e1 100644 --- a/aio/content/examples/router/src/app/heroes/hero-list.component.1.ts +++ b/aio/content/examples/router/src/app/heroes/hero-list.component.1.ts @@ -1,6 +1,6 @@ // #docplaster // #docregion -// TODO SOMEDAY: Feature Componetized like HeroCenter +// TODO: Feature Componetized like HeroCenter import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { Observable } from 'rxjs'; diff --git a/aio/content/examples/router/src/app/heroes/hero-list.component.ts b/aio/content/examples/router/src/app/heroes/hero-list.component.ts index 803aa73436..cbb97c4cf0 100644 --- a/aio/content/examples/router/src/app/heroes/hero-list.component.ts +++ b/aio/content/examples/router/src/app/heroes/hero-list.component.ts @@ -1,6 +1,6 @@ // #docplaster // #docregion -// TODO SOMEDAY: Feature Componetized like CrisisCenter +// TODO: Feature Componetized like CrisisCenter // #docregion rxjs-imports import { Observable } from 'rxjs'; import { switchMap } from 'rxjs/operators'; diff --git a/aio/content/examples/testing/src/app/model/hero.service.spec.ts b/aio/content/examples/testing/src/app/model/hero.service.spec.ts index b228692154..22bd98246d 100644 --- a/aio/content/examples/testing/src/app/model/hero.service.spec.ts +++ b/aio/content/examples/testing/src/app/model/hero.service.spec.ts @@ -15,7 +15,7 @@ describe ('HeroesService (with spies)', () => { let heroService: HeroService; beforeEach(() => { - // Todo: spy on other methods too + // TODO: spy on other methods too httpClientSpy = jasmine.createSpyObj('HttpClient', ['get']); heroService = new HeroService( httpClientSpy); }); diff --git a/aio/content/examples/toh-pt4/src/app/hero.service.ts b/aio/content/examples/toh-pt4/src/app/hero.service.ts index 1095915552..89a7b5d09c 100644 --- a/aio/content/examples/toh-pt4/src/app/hero.service.ts +++ b/aio/content/examples/toh-pt4/src/app/hero.service.ts @@ -26,7 +26,7 @@ export class HeroService { // #docregion getHeroes, getHeroes-1 getHeroes(): Observable { // #enddocregion getHeroes-1 - // Todo: send the message _after_ fetching the heroes + // TODO: send the message _after_ fetching the heroes this.messageService.add('HeroService: fetched heroes'); // #docregion getHeroes-1 return of(HEROES); diff --git a/aio/content/examples/toh-pt5/src/app/hero.service.ts b/aio/content/examples/toh-pt5/src/app/hero.service.ts index f0d6dc0a28..c0dc5e85f7 100644 --- a/aio/content/examples/toh-pt5/src/app/hero.service.ts +++ b/aio/content/examples/toh-pt5/src/app/hero.service.ts @@ -12,14 +12,14 @@ export class HeroService { constructor(private messageService: MessageService) { } getHeroes(): Observable { - // Todo: send the message _after_ fetching the heroes + // TODO: send the message _after_ fetching the heroes this.messageService.add('HeroService: fetched heroes'); return of(HEROES); } // #docregion getHero getHero(id: number): Observable { - // Todo: send the message _after_ fetching the hero + // TODO: send the message _after_ fetching the hero this.messageService.add(`HeroService: fetched hero id=${id}`); return of(HEROES.find(hero => hero.id === id)); } diff --git a/aio/src/app/custom-elements/api/api-list.component.ts b/aio/src/app/custom-elements/api/api-list.component.ts index 10d98ccd4c..1bf58756d3 100644 --- a/aio/src/app/custom-elements/api/api-list.component.ts +++ b/aio/src/app/custom-elements/api/api-list.component.ts @@ -78,7 +78,7 @@ export class ApiListComponent implements OnInit { this.initializeSearchCriteria(); } - // Todo: may need to debounce as the original did + // TODO: may need to debounce as the original did // although there shouldn't be any perf consequences if we don't setQuery(query: string) { this.setSearchCriteria({query: (query || '').toLowerCase().trim() }); diff --git a/aio/src/app/custom-elements/api/api.service.ts b/aio/src/app/custom-elements/api/api.service.ts index 6d9ae4926b..9d42350b2e 100644 --- a/aio/src/app/custom-elements/api/api.service.ts +++ b/aio/src/app/custom-elements/api/api.service.ts @@ -75,7 +75,7 @@ export class ApiService implements OnDestroy { .subscribe( sections => this.sectionsSubject.next(sections), (err: HttpErrorResponse) => { - // Todo: handle error + // TODO: handle error this.logger.error(err); throw err; // rethrow for now. } diff --git a/aio/src/app/shared/location.service.ts b/aio/src/app/shared/location.service.ts index 1f975ef7bc..a200774e58 100644 --- a/aio/src/app/shared/location.service.ts +++ b/aio/src/app/shared/location.service.ts @@ -37,7 +37,7 @@ export class LocationService { swUpdates.updateActivated.subscribe(() => this.swUpdateActivated = true); } - // TODO?: ignore if url-without-hash-or-search matches current location? + // TODO: ignore if url-without-hash-or-search matches current location? go(url: string|null|undefined) { if (!url) { return; } url = this.stripSlashes(url); diff --git a/packages/benchpress/src/runner.ts b/packages/benchpress/src/runner.ts index e33e6e4f2c..7ba28dbf8a 100644 --- a/packages/benchpress/src/runner.ts +++ b/packages/benchpress/src/runner.ts @@ -73,7 +73,7 @@ export class Runner { // This might still create instances twice. We are creating a new injector with all the // providers. // Only WebDriverAdapter is reused. - // TODO vsavkin consider changing it when toAsyncFactory is added back or when child + // TODO(vsavkin): consider changing it when toAsyncFactory is added back or when child // injectors are handled better. const injector = Injector.create([ sampleProviders, {provide: Options.CAPABILITIES, useValue: capabilities}, diff --git a/packages/core/src/change_detection/differs/default_iterable_differ.ts b/packages/core/src/change_detection/differs/default_iterable_differ.ts index 597cadce4c..05d7d02e10 100644 --- a/packages/core/src/change_detection/differs/default_iterable_differ.ts +++ b/packages/core/src/change_detection/differs/default_iterable_differ.ts @@ -248,7 +248,7 @@ export class DefaultIterableDiffer implements IterableDiffer, IterableChan this._removalsHead = this._removalsTail = null; this._identityChangesHead = this._identityChangesTail = null; - // todo(vicb) when assert gets supported + // TODO(vicb): when assert gets supported // assert(!this.isDirty); } } @@ -420,11 +420,11 @@ export class DefaultIterableDiffer implements IterableDiffer, IterableChan this._insertAfter(record, prevRecord, index); if (this._additionsTail === null) { - // todo(vicb) + // TODO(vicb): // assert(this._additionsHead === null); this._additionsTail = this._additionsHead = record; } else { - // todo(vicb) + // TODO(vicb): // assert(_additionsTail._nextAdded === null); // assert(record._nextAdded === null); this._additionsTail = this._additionsTail._nextAdded = record; @@ -436,14 +436,14 @@ export class DefaultIterableDiffer implements IterableDiffer, IterableChan _insertAfter( record: IterableChangeRecord_, prevRecord: IterableChangeRecord_|null, index: number): IterableChangeRecord_ { - // todo(vicb) + // TODO(vicb): // assert(record != prevRecord); // assert(record._next === null); // assert(record._prev === null); const next: IterableChangeRecord_|null = prevRecord === null ? this._itHead : prevRecord._next; - // todo(vicb) + // TODO(vicb): // assert(next != record); // assert(prevRecord != record); record._next = next; @@ -482,7 +482,7 @@ export class DefaultIterableDiffer implements IterableDiffer, IterableChan const prev = record._prev; const next = record._next; - // todo(vicb) + // TODO(vicb): // assert((record._prev = null) === null); // assert((record._next = null) === null); @@ -502,7 +502,7 @@ export class DefaultIterableDiffer implements IterableDiffer, IterableChan /** @internal */ _addToMoves(record: IterableChangeRecord_, toIndex: number): IterableChangeRecord_ { - // todo(vicb) + // TODO(vicb): // assert(record._nextMoved === null); if (record.previousIndex === toIndex) { @@ -510,11 +510,11 @@ export class DefaultIterableDiffer implements IterableDiffer, IterableChan } if (this._movesTail === null) { - // todo(vicb) + // TODO(vicb): // assert(_movesHead === null); this._movesTail = this._movesHead = record; } else { - // todo(vicb) + // TODO(vicb): // assert(_movesTail._nextMoved === null); this._movesTail = this._movesTail._nextMoved = record; } @@ -531,12 +531,12 @@ export class DefaultIterableDiffer implements IterableDiffer, IterableChan record._nextRemoved = null; if (this._removalsTail === null) { - // todo(vicb) + // TODO(vicb): // assert(_removalsHead === null); this._removalsTail = this._removalsHead = record; record._prevRemoved = null; } else { - // todo(vicb) + // TODO(vicb): // assert(_removalsTail._nextRemoved === null); // assert(record._nextRemoved === null); record._prevRemoved = this._removalsTail; @@ -607,7 +607,7 @@ class _DuplicateItemRecordList { record._nextDup = null; record._prevDup = null; } else { - // todo(vicb) + // TODO(vicb): // assert(record.item == _head.item || // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN); this._tail !._nextDup = record; @@ -636,7 +636,7 @@ class _DuplicateItemRecordList { * Returns whether the list of duplicates is empty. */ remove(record: IterableChangeRecord_): boolean { - // todo(vicb) + // TODO(vicb): // assert(() { // // verify that the record being removed is in the list. // for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) { diff --git a/packages/core/src/util/lang.ts b/packages/core/src/util/lang.ts index 3fc560f894..d539183af5 100644 --- a/packages/core/src/util/lang.ts +++ b/packages/core/src/util/lang.ts @@ -21,6 +21,6 @@ export function isPromise(obj: any): obj is Promise { * Determine if the argument is an Observable */ export function isObservable(obj: any | Observable): obj is Observable { - // TODO use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved + // TODO: use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved return !!obj && typeof obj.subscribe === 'function'; } diff --git a/packages/core/test/change_detection/differs/default_iterable_differ_spec.ts b/packages/core/test/change_detection/differs/default_iterable_differ_spec.ts index cdb62e7990..e1d8f09063 100644 --- a/packages/core/test/change_detection/differs/default_iterable_differ_spec.ts +++ b/packages/core/test/change_detection/differs/default_iterable_differ_spec.ts @@ -23,7 +23,7 @@ class ComplexItem { toString() { return `{id: ${this.id}, color: ${this.color}}`; } } -// todo(vicb): UnmodifiableListView / frozen object when implemented +// TODO(vicb): UnmodifiableListView / frozen object when implemented { describe('iterable differ', function() { describe('DefaultIterableDiffer', function() { diff --git a/packages/core/test/change_detection/differs/default_keyvalue_differ_spec.ts b/packages/core/test/change_detection/differs/default_keyvalue_differ_spec.ts index cff3397cb5..bba585f5b0 100644 --- a/packages/core/test/change_detection/differs/default_keyvalue_differ_spec.ts +++ b/packages/core/test/change_detection/differs/default_keyvalue_differ_spec.ts @@ -11,7 +11,7 @@ import {DefaultKeyValueDiffer, DefaultKeyValueDifferFactory} from '@angular/core import {kvChangesAsString, testChangesAsString} from '../../change_detection/util'; -// todo(vicb): Update the code & tests for object equality +// TODO(vicb): Update the code & tests for object equality { describe('keyvalue differ', function() { describe('DefaultKeyValueDiffer', function() { diff --git a/packages/http/testing/src/mock_backend.ts b/packages/http/testing/src/mock_backend.ts index 42209f4fea..130a90d8f1 100644 --- a/packages/http/testing/src/mock_backend.ts +++ b/packages/http/testing/src/mock_backend.ts @@ -19,7 +19,7 @@ import {take} from 'rxjs/operators'; * @deprecated use @angular/common/http instead */ export class MockConnection implements Connection { - // TODO Name `readyState` should change to be more generic, and states could be made to be more + // TODO: Name `readyState` should change to be more generic, and states could be made to be more // descriptive than ResourceLoader states. /** * Describes the state of the connection, based on `XMLHttpRequest.readyState`, but with diff --git a/packages/platform-webworker/src/web_workers/shared/post_message_bus.ts b/packages/platform-webworker/src/web_workers/shared/post_message_bus.ts index f7c11f5bc8..4de44d4301 100644 --- a/packages/platform-webworker/src/web_workers/shared/post_message_bus.ts +++ b/packages/platform-webworker/src/web_workers/shared/post_message_bus.ts @@ -12,7 +12,7 @@ import {MessageBus, MessageBusSink, MessageBusSource} from './message_bus'; -// TODO(jteplitz602) Replace this with the definition in lib.webworker.d.ts(#3492) +// TODO(jteplitz602): Replace this with the definition in lib.webworker.d.ts(#3492) export interface PostMessageTarget { postMessage: (message: any, transfer?: [ArrayBuffer]) => void; } diff --git a/packages/platform-webworker/src/worker_app.ts b/packages/platform-webworker/src/worker_app.ts index 7476a65475..07bf264d64 100644 --- a/packages/platform-webworker/src/worker_app.ts +++ b/packages/platform-webworker/src/worker_app.ts @@ -33,7 +33,7 @@ export function errorHandler(): ErrorHandler { } -// TODO(jteplitz602) remove this and compile with lib.webworker.d.ts (#3492) +// TODO(jteplitz602): remove this and compile with lib.webworker.d.ts (#3492) const _postMessage = { postMessage: (message: any, transferrables?: [ArrayBuffer]) => { (postMessage)(message, transferrables); diff --git a/scripts/ci/test-js.sh b/scripts/ci/test-js.sh index 0257ab1ae3..67db3eafcf 100755 --- a/scripts/ci/test-js.sh +++ b/scripts/ci/test-js.sh @@ -9,7 +9,7 @@ source ${thisDir}/_travis-fold.sh # Run unit tests for our tools/ directory travisFoldStart "test.unit.tools" - # TODO(i) could this be rolled into the tools tests above? why is it separate? + # TODO(i): could this be rolled into the tools tests above? why is it separate? travisFoldStart "test.unit.validate-commit-message" ( cd tools/validate-commit-message diff --git a/tools/gulp-tasks/lint.js b/tools/gulp-tasks/lint.js index 9f6cebd4a4..ddc1ba0574 100644 --- a/tools/gulp-tasks/lint.js +++ b/tools/gulp-tasks/lint.js @@ -13,7 +13,7 @@ module.exports = (gulp) => () => { const path = require('path'); return gulp .src([ - // todo(vicb): add .js files when supported + // TODO(vicb): add .js files when supported // see https://github.com/palantir/tslint/pull/1515 './modules/**/*.ts', './modules/**/*.js', @@ -34,7 +34,7 @@ module.exports = (gulp) => () => { '!**/*.externs.js', // Ignore generated files due to lack of copyright header - // todo(alfaproject): make generated files lintable + // TODO(alfaproject): make generated files lintable '!**/*.d.ts', '!**/*.ngfactory.ts', ])