From ebe93e82e10f4ea2ca65c87348aa85ebd70eabe1 Mon Sep 17 00:00:00 2001 From: SteveVanOpstal Date: Tue, 31 May 2016 22:59:36 +0200 Subject: [PATCH] fix(tslint): errors --- src/app/build/ability-sequence.component.ts | 2 +- src/app/build/items/item-slot.component.ts | 11 +++-------- src/app/build/shop/pipes/tags.pipe.ts | 6 +++--- src/app/champions/pipes/sort.pipe.spec.ts | 4 ++-- src/server/server.ts | 5 ++--- tslint.json | 7 +------ 6 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/app/build/ability-sequence.component.ts b/src/app/build/ability-sequence.component.ts index b39ab4e..0d275da 100644 --- a/src/app/build/ability-sequence.component.ts +++ b/src/app/build/ability-sequence.component.ts @@ -9,7 +9,7 @@ import {DDragonDirective} from '../misc/ddragon.directive'; selector: 'g[ability-sequence]', directives: [NgFor, NgClass, DDragonDirective], template: ` - + diff --git a/src/app/build/items/item-slot.component.ts b/src/app/build/items/item-slot.component.ts index 5476bcf..f0c8559 100644 --- a/src/app/build/items/item-slot.component.ts +++ b/src/app/build/items/item-slot.component.ts @@ -1,8 +1,7 @@ -import {Component, Input, Inject, forwardRef, OnInit} from '@angular/core'; +import {Component, Input} from '@angular/core'; import {NgClass} from '@angular/common'; import {Observable} from 'rxjs/Observable'; -import {ItemsComponent} from './items.component'; import {ItemComponent} from './item.component'; import {Item} from '../../misc/item'; import {Config} from '../config'; @@ -18,7 +17,7 @@ import * as d3 from 'd3'; // TODO: remove test ` }) -export class ItemSlotComponent implements OnInit { +export class ItemSlotComponent { @Input() id: number; @Input() config: Config; private items: Array = new Array(); @@ -29,11 +28,7 @@ export class ItemSlotComponent implements OnInit { .domain([0, 3600000]) .range([0, 1460]); - constructor( @Inject(forwardRef(() => ItemsComponent)) private itemsComponent: ItemsComponent) { - } - - ngOnInit() { - this.itemsComponent.addItemSlotComponent(this); + constructor() { } addItem(item: Item) { diff --git a/src/app/build/shop/pipes/tags.pipe.ts b/src/app/build/shop/pipes/tags.pipe.ts index edef2b9..16f01ca 100644 --- a/src/app/build/shop/pipes/tags.pipe.ts +++ b/src/app/build/shop/pipes/tags.pipe.ts @@ -15,10 +15,10 @@ export class TagsPipe implements PipeTransform { if (!item.tags) { return false; } - if (tags && tags.length > 0) { - for (let tag in tags) { + if (tags) { + for (let index = 0; index < tags.length; index++) { item.tags = item.tags.map(tag => tag.toLowerCase()); - if (item.tags.indexOf(tags[tag].toLowerCase()) === -1) { + if (item.tags.indexOf(tags[index].toLowerCase()) === -1) { return false; } } diff --git a/src/app/champions/pipes/sort.pipe.spec.ts b/src/app/champions/pipes/sort.pipe.spec.ts index 882c2e1..4e52627 100644 --- a/src/app/champions/pipes/sort.pipe.spec.ts +++ b/src/app/champions/pipes/sort.pipe.spec.ts @@ -18,8 +18,8 @@ describe('SortPipe', () => { champions = [champion1, champion2, champion3]; }); - it('should order alphabetical on \'undefined\'', inject([SortPipe], (pipe) => { - let result = pipe.transform(champions, undefined); + it('should order alphabetical on \'null\'', inject([SortPipe], (pipe) => { + let result = pipe.transform(champions, null); expect(result).toHaveEqualContent([champion2, champion1, champion3]); // alphabetical order })); diff --git a/src/server/server.ts b/src/server/server.ts index 4211e39..ee9ea4b 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -174,9 +174,8 @@ export class Server { } private preRun() { - this.getRegions((regions) => { - for (let index in regions) { - let region = regions[index]; + this.getRegions((regions: Array) => { + for (let region of regions) { this.champions[region] = []; this.getChampions(region, this.handleChampions); } diff --git a/tslint.json b/tslint.json index e64f032..19cd9b5 100644 --- a/tslint.json +++ b/tslint.json @@ -34,7 +34,7 @@ ], "ban": false, "curly": false, - "forin": true, + "forin": false, "label-position": true, "label-undefined": true, "no-arg": true, @@ -54,7 +54,6 @@ "no-duplicate-variable": true, "no-empty": false, "no-eval": true, - "no-null-keyword": true, "no-shadowed-variable": true, "no-string-literal": true, "no-switch-case-fall-through": true, @@ -69,10 +68,6 @@ true, "allow-null-check" ], - "use-strict": [ - true, - "check-module" - ], "eofline": true, "indent": [ true,