From 04c4a71f147b2e1c1f50f54d18055438aabaafa9 Mon Sep 17 00:00:00 2001 From: Darren Nelsen Date: Wed, 26 Jul 2017 16:52:34 -0400 Subject: [PATCH] cleaned up tslint warnings --- .../pages/block-detail/block-detail.module.ts | 4 +- app/src/pages/blocksPage/blocksPage.ts | 41 +++++++++++-------- app/src/services/blocksService.spec.ts | 8 ++-- app/src/services/blocksService.ts | 2 +- app/src/test.ts | 2 +- 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/app/src/pages/block-detail/block-detail.module.ts b/app/src/pages/block-detail/block-detail.module.ts index 7e8158f..58e5429 100644 --- a/app/src/pages/block-detail/block-detail.module.ts +++ b/app/src/pages/block-detail/block-detail.module.ts @@ -4,10 +4,10 @@ import { BlockDetailPage } from './block-detail'; @NgModule({ declarations: [ - BlockDetailPage, + BlockDetailPage ], imports: [ - IonicPageModule.forChild(BlockDetailPage), + IonicPageModule.forChild(BlockDetailPage) ], exports: [ BlockDetailPage diff --git a/app/src/pages/blocksPage/blocksPage.ts b/app/src/pages/blocksPage/blocksPage.ts index 141ebe5..dbe3131 100644 --- a/app/src/pages/blocksPage/blocksPage.ts +++ b/app/src/pages/blocksPage/blocksPage.ts @@ -11,6 +11,7 @@ import { Http } from '@angular/http'; export class BlocksPage { + public loading: boolean; public title: string; public blocks: Observable; public q: string; @@ -25,7 +26,7 @@ export class BlocksPage { blocksService.getLatestBlocks(); } - public search(event) { + public search(): void { console.log('q is', this.q); let apiPrefix: string = 'http://localhost:3001/insight-api/'; this.http.get(apiPrefix + 'block/' + this.q).subscribe( @@ -33,30 +34,28 @@ export class BlocksPage { this.resetSearch(); console.log('block', data); }, - (err) => { + () => { this.http.get(apiPrefix + 'tx/' + this.q).subscribe( - (data) => { + (data: any) => { this.resetSearch(); console.log('tx', data); }, - (err) => { + () => { this.http.get(apiPrefix + 'addr/' + this.q).subscribe( - (data) => { + (data: any) => { this.resetSearch(); console.log('addr', data); }, - (err) => { + () => { this.http.get(apiPrefix + 'block-index/' + this.q).subscribe( - function (data) { + function (data: any): void { this.resetSearch(); - console.log('block-index', data); - let parsedData = JSON.parse(data._body); - console.log('parsedData', parsedData); + let parsedData: any = JSON.parse(data._body); this.navCtrl.push('block-detail', { 'blockHash': parsedData.blockHash }); }.bind(this), - function (err) { + function (): void { this.loading = false; this.reportBadQuery(); }.bind(this) @@ -69,18 +68,24 @@ export class BlocksPage { ); } - resetSearch = function() { + private resetSearch(): void { this.q = ''; this.loading = false; - }; + } - reportBadQuery() { + /* tslint:disable:no-unused-variable */ + private reportBadQuery(): void { this.badQuery = true; console.log('badQuery', this.badQuery); - setTimeout(function() { - this.badQuery = false; - console.log('badQuery', this.badQuery); - }.bind(this), 2000); + setTimeout( + function (): void { + this.badQuery = false; + console.log('badQuery', this.badQuery); + }.bind(this), + 2000 + ); }; + /* tslint:enable:no-unused-variable */ + } diff --git a/app/src/services/blocksService.spec.ts b/app/src/services/blocksService.spec.ts index cf99bfb..f104a48 100644 --- a/app/src/services/blocksService.spec.ts +++ b/app/src/services/blocksService.spec.ts @@ -1,8 +1,8 @@ -import { BlocksService } from './blocksService'; -import { Block } from '../models'; -import { TestUtils } from '../test'; +// import { BlocksService } from './blocksService'; +// import { Block } from '../models'; +// import { TestUtils } from '../test'; -let blocks: BlocksService = null; +// let blocks: BlocksService = null; // describe('BlocksService', () => { diff --git a/app/src/services/blocksService.ts b/app/src/services/blocksService.ts index 747f49d..724b593 100644 --- a/app/src/services/blocksService.ts +++ b/app/src/services/blocksService.ts @@ -1,6 +1,6 @@ import { Http, Response } from '@angular/http'; import { Injectable } from '@angular/core'; -import { Observable, Subject } from 'rxjs'; +import { Subject } from 'rxjs'; import { Block, InsightBlockObject } from '../models'; @Injectable() diff --git a/app/src/test.ts b/app/src/test.ts index ee17df7..8ba1c44 100644 --- a/app/src/test.ts +++ b/app/src/test.ts @@ -11,7 +11,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { getTestBed, TestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; import { HttpModule } from '@angular/http'; -import { MockBackend } from '@angular/http/testing'; +// import { MockBackend } from '@angular/http/testing'; import { App, Config, Form, IonicModule, Keyboard, DomController, MenuController, NavController, Platform, GestureController } from 'ionic-angular'; import { ConfigMock, PlatformMock } from './mocks'; import { BlocksServiceMock } from './services/mocks';