refactor: ensure all 'TODO's are consistent (#23252)

PR Close #23252
This commit is contained in:
Rafael 2018-04-08 18:19:25 -03:00 committed by Igor Minar
parent aa27155618
commit 639d52fe71
26 changed files with 41 additions and 41 deletions

View File

@ -15,7 +15,7 @@ export class BackendService {
getAll(type: Type<any>): PromiseLike<any[]> {
if (type === Hero) {
// TODO get from the database
// TODO: get from the database
return Promise.resolve<Hero[]>(HEROES);
}
let err = new Error('Cannot get object of this type');

View File

@ -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 {

View File

@ -5,7 +5,7 @@ import { Hero } from './hero';
@Injectable()
export class HeroService {
// TODO move to database
// TODO: move to database
private heroes: Array<Hero> = [
new Hero(1, 'RubberMan', 'Hero of many talents', '123-456-7899'),
new Hero(2, 'Magma', 'Hero of all trades', '555-555-5555'),

View File

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

View File

@ -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);

View File

@ -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<any>[] = [

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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';

View File

@ -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';

View File

@ -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(<any> httpClientSpy);
});

View File

@ -26,7 +26,7 @@ export class HeroService {
// #docregion getHeroes, getHeroes-1
getHeroes(): Observable<Hero[]> {
// #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);

View File

@ -12,14 +12,14 @@ export class HeroService {
constructor(private messageService: MessageService) { }
getHeroes(): Observable<Hero[]> {
// 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<Hero> {
// 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));
}

View File

@ -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() });

View File

@ -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.
}

View File

@ -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);

View File

@ -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},

View File

@ -248,7 +248,7 @@ export class DefaultIterableDiffer<V> implements IterableDiffer<V>, 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<V> implements IterableDiffer<V>, 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<V> implements IterableDiffer<V>, IterableChan
_insertAfter(
record: IterableChangeRecord_<V>, prevRecord: IterableChangeRecord_<V>|null,
index: number): IterableChangeRecord_<V> {
// todo(vicb)
// TODO(vicb):
// assert(record != prevRecord);
// assert(record._next === null);
// assert(record._prev === null);
const next: IterableChangeRecord_<V>|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<V> implements IterableDiffer<V>, 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<V> implements IterableDiffer<V>, IterableChan
/** @internal */
_addToMoves(record: IterableChangeRecord_<V>, toIndex: number): IterableChangeRecord_<V> {
// todo(vicb)
// TODO(vicb):
// assert(record._nextMoved === null);
if (record.previousIndex === toIndex) {
@ -510,11 +510,11 @@ export class DefaultIterableDiffer<V> implements IterableDiffer<V>, 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<V> implements IterableDiffer<V>, 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<V> {
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<V> {
* Returns whether the list of duplicates is empty.
*/
remove(record: IterableChangeRecord_<V>): 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) {

View File

@ -21,6 +21,6 @@ export function isPromise(obj: any): obj is Promise<any> {
* Determine if the argument is an Observable
*/
export function isObservable(obj: any | Observable<any>): obj is Observable<any> {
// 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';
}

View File

@ -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() {

View File

@ -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() {

View File

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

View File

@ -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;
}

View File

@ -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]) => {
(<any>postMessage)(message, transferrables);

View File

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

View File

@ -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',
])