Fix tslint and related errors.

This commit is contained in:
József Farkas
2016-04-13 21:30:55 +02:00
parent 9b040c6665
commit 5542b66871
10 changed files with 26 additions and 25 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ let keyActionType = {
abstract class KeyAction extends Serializable<KeyAction> { abstract class KeyAction extends Serializable<KeyAction> {
assertKeyActionType(jsObject: any) { assertKeyActionType(jsObject: any) {
let keyActionClassname = this.constructor.name; let keyActionClassname = this.constructor.name;
let keyActionTypeString = keyActionType[keyActionClassname] let keyActionTypeString = keyActionType[keyActionClassname];
if (jsObject.keyActionType !== keyActionTypeString) { if (jsObject.keyActionType !== keyActionTypeString) {
throw `Invalid ${keyActionClassname}.keyActionType: ${jsObject.keyActionType}`; throw `Invalid ${keyActionClassname}.keyActionType: ${jsObject.keyActionType}`;
} }
+1 -1
View File
@@ -37,7 +37,7 @@
}, },
"scripts": { "scripts": {
"postinstall": "typings install", "postinstall": "typings install",
"lint": "tslint **/*.ts", "lint": "tslint 'src/**/*.ts' 'config-serializer/**/*.ts'",
"typings": "typings", "typings": "typings",
"webpack": "webpack", "webpack": "webpack",
"webpack-dev-server": "webpack-dev-server" "webpack-dev-server": "webpack-dev-server"
@@ -31,4 +31,4 @@ export class KeyboardButtonGroupComponent implements OnInit {
ngOnInit() { } ngOnInit() { }
} }
+2 -2
View File
@@ -13,7 +13,7 @@ import { Component, OnInit, Input } from 'angular2/core';
:host { :host {
display: flex; display: flex;
} }
`], `]
}) })
export class KeyboardButtonComponent implements OnInit { export class KeyboardButtonComponent implements OnInit {
@Input() id: string; @Input() id: string;
@@ -27,4 +27,4 @@ export class KeyboardButtonComponent implements OnInit {
ngOnInit() { } ngOnInit() { }
} }
+1 -1
View File
@@ -7,4 +7,4 @@ export interface KeyboardButton {
height: string; height: string;
width: string; width: string;
fill: string; fill: string;
} }
+7 -3
View File
@@ -7,7 +7,11 @@ import {Module, ModuleComponent} from './module';
selector: 'keyboard', selector: 'keyboard',
template: template:
` `
<module *ngIf="modules.length > 0" [case]="modules[0].case" [keyboardButtons]="modules[0].keyboardButtons" [fill]="modules[0].fill"></module> <module *ngIf="modules.length > 0"
[case]="modules[0].case"
[keyboardButtons]="modules[0].keyboardButtons"
[fill]="modules[0].fill">
</module>
`, `,
styles: styles:
[` [`
@@ -31,8 +35,8 @@ export class KeyboardComponent implements OnInit {
} }
private loadKeyboardModules(): void { private loadKeyboardModules(): void {
var svg: any = this.dps.getBaseLayer(); let svg: any = this.dps.getBaseLayer();
this.modules = svg.g[0].g.map(obj => new Module(obj, svg.g[0].$.fill)); this.modules = svg.g[0].g.map(obj => new Module(obj, svg.g[0].$.fill));
} }
} }
+9 -11
View File
@@ -30,27 +30,25 @@ export class ModuleComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.getButtonGroups().forEach(buttonGroup => { this.getButtonGroups().forEach(buttonGroup => {
this.dcl.loadIntoLocation(KeyboardButtonGroupComponent, this.elementRef, "row").then((bttnComponentRef: ComponentRef) => { this.dcl.loadIntoLocation(KeyboardButtonGroupComponent, this.elementRef, 'row')
var group: KeyboardButtonGroupComponent = bttnComponentRef.instance; .then((bttnComponentRef: ComponentRef) => {
group.keyboardButtons = buttonGroup; let group: KeyboardButtonGroupComponent = bttnComponentRef.instance;
// console.log(keyboardButtonComponent); group.keyboardButtons = buttonGroup;
}); });
}); });
} }
private getButtonGroups(): KeyboardButton[][] { private getButtonGroups(): KeyboardButton[][] {
var buttonGroups: KeyboardButton[][] = []; let buttonGroups: KeyboardButton[][] = [];
var buttonGroup: KeyboardButton[] = []; let buttonGroup: KeyboardButton[] = [];
this.keyboardButtons.forEach((keyboardButton, index) => { this.keyboardButtons.forEach(keyboardButton => {
if (buttonGroup.length > 0 && buttonGroup[buttonGroup.length - 1].y !== keyboardButton.y) { if (buttonGroup.length > 0 && buttonGroup[buttonGroup.length - 1].y !== keyboardButton.y) {
buttonGroups.push(buttonGroup); buttonGroups.push(buttonGroup);
buttonGroup = []; buttonGroup = [];
} }
buttonGroup.push(keyboardButton); buttonGroup.push(keyboardButton);
}); });
//console.log(buttonGroups, buttonGroup, this.keyboardButtons);
return buttonGroups; return buttonGroups;
} }
} }
+2 -2
View File
@@ -5,8 +5,8 @@ export class Module {
private keyboardButtons: KeyboardButton[]; private keyboardButtons: KeyboardButton[];
constructor(obj: { rect: any[], path: any[] }, fill?: string) { constructor(obj: { rect: any[], path: any[] }, fill?: string) {
this.keyboardButtons = obj.rect.map(obj => obj.$); this.keyboardButtons = obj.rect.map(rect => rect.$);
this.keyboardButtons.forEach(keyboardButton => keyboardButton.fill = fill ? fill : 'black'); this.keyboardButtons.forEach(keyboardButton => keyboardButton.fill = fill ? fill : 'black');
this.case = obj.path[0].$; this.case = obj.path[0].$;
} }
} }
+1 -1
View File
@@ -1,3 +1,3 @@
import {Module} from './module.model'; import {Module} from './module.model';
import {ModuleComponent} from './module.component'; import {ModuleComponent} from './module.component';
export {Module, ModuleComponent}; export {Module, ModuleComponent};
+1 -2
View File
@@ -5,9 +5,8 @@ export class DataProviderService {
constructor() { } constructor() { }
getBaseLayer(): any { getBaseLayer(): any {
return require('xml!../../images/base-layer.svg').svg; return require('xml!../../images/base-layer.svg').svg;
} }
} }