From eb4ac8d109bd17bc1f8f81a099871a1a2c0f5563 Mon Sep 17 00:00:00 2001 From: Rossen Hristov Date: Fri, 6 Jan 2017 12:00:06 +0200 Subject: [PATCH] Fix all tslint errors --- tests/app/TKUnit.ts | 8 ++++---- tests/app/ui/label/label-tests.ts | 2 -- tns-core-modules/ui/core/view-common.ts | 4 ++-- .../ui/layouts/flexbox-layout/flexbox-layout-common.ts | 4 ++-- tns-core-modules/ui/styling/style-scope.ts | 8 +------- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/tests/app/TKUnit.ts b/tests/app/TKUnit.ts index affc91470..66c3a725c 100644 --- a/tests/app/TKUnit.ts +++ b/tests/app/TKUnit.ts @@ -59,17 +59,17 @@ var runTest = function (testInfo: TestInfoEntry) { } if (testInfo.isTest) { - duration = (time() - start).toFixed(2); + duration = time() - start; testInfo.duration = duration; - write(`--- [${testInfo.testName}] OK, duration: ${duration}`, trace.messageType.info); + write(`--- [${testInfo.testName}] OK, duration: ${duration.toFixed(2)}`, trace.messageType.info); testInfo.isPassed = true; } } catch (e) { if (testInfo.isTest) { - duration = (time() - start).toFixed(2); + duration = time() - start; testInfo.duration = duration; - write(`--- [${testInfo.testName}] FAILED: ${e.message}, Stack: ${e.stack}, duration: ${duration}`, trace.messageType.error); + write(`--- [${testInfo.testName}] FAILED: ${e.message}, Stack: ${e.stack}, duration: ${duration.toFixed(2)}`, trace.messageType.error); testInfo.isPassed = false; testInfo.errorMessage = e.message; } diff --git a/tests/app/ui/label/label-tests.ts b/tests/app/ui/label/label-tests.ts index f47a3f3aa..0445237be 100644 --- a/tests/app/ui/label/label-tests.ts +++ b/tests/app/ui/label/label-tests.ts @@ -20,8 +20,6 @@ import {isIOS} from "platform"; import {Label} from "ui/label"; import {LayoutBase} from "ui/layouts/layout-base"; import * as helper from "../helper"; -import * as viewModule from "ui/core/view"; -import {Page} from "ui/page"; export class LabelTest extends testModule.UITest { diff --git a/tns-core-modules/ui/core/view-common.ts b/tns-core-modules/ui/core/view-common.ts index 12dba5203..3c7b0879d 100644 --- a/tns-core-modules/ui/core/view-common.ts +++ b/tns-core-modules/ui/core/view-common.ts @@ -1406,7 +1406,7 @@ function transformConverter(value: string): Object { } function convertToTransform(value: string): [CssProperty, any][] { - let newTransform = value == unsetValue ? { "none": "none" } : transformConverter(value); + let newTransform = value === unsetValue ? { "none": "none" } : transformConverter(value); let array = []; let values: Array; for (let transform in newTransform) { @@ -1950,7 +1950,7 @@ const fontProperty = new ShorthandProperty({ return `${this.fontStyle} ${this.fontWeight} ${this.fontSize} ${this.fontFamily}`; }, converter: function (value) { - if (value == unsetValue) { + if (value === unsetValue) { return [ [fontStyleProperty, unsetValue], [fontWeightProperty, unsetValue], diff --git a/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout-common.ts b/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout-common.ts index a9d6859e1..0d6594952 100644 --- a/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout-common.ts +++ b/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout-common.ts @@ -316,7 +316,7 @@ const flexFlowProperty = new ShorthandProperty({ }, converter: function (value: string) { const properties: [CssProperty, any][] = []; - if (value == unsetValue) { + if (value === unsetValue) { properties.push([flexDirectionProperty, value]); properties.push([flexWrapProperty, value]); } else { @@ -344,7 +344,7 @@ const flexProperty = new ShorthandProperty({ }, converter: function (value: string) { const properties: [CssProperty, any][] = []; - if (value == unsetValue) { + if (value === unsetValue) { properties.push([flexGrowProperty, value]); properties.push([flexShrinkProperty, value]); } else { diff --git a/tns-core-modules/ui/styling/style-scope.ts b/tns-core-modules/ui/styling/style-scope.ts index 0631e21c7..63b93cd82 100644 --- a/tns-core-modules/ui/styling/style-scope.ts +++ b/tns-core-modules/ui/styling/style-scope.ts @@ -1,5 +1,5 @@ import { ViewBase, resetStyleProperties } from "ui/core/view-base"; -import { SyntaxTree, Keyframes, parse as parseCss, Rule, Declaration, Node } from "css"; +import { SyntaxTree, Keyframes, parse as parseCss, Node } from "css"; import { RuleSet, SelectorsMap, SelectorCore, SelectorsMatch, ChangeMap, fromAstNodes } from "ui/styling/css-selector"; import { KeyframeAnimationInfo, KeyframeAnimation } from "ui/animation/keyframe-animation"; import { write as traceWrite, categories as traceCategories, messageType as traceMessageType } from "trace"; @@ -270,12 +270,6 @@ export function applyInlineStyle(view: ViewBase, style: string) { } } -function isRule(node: Node): node is Rule { - return node.type === "rule"; -} -function isDeclaration(node: Node): node is Declaration { - return node.type === "declaration"; -} function isKeyframe(node: Node): node is Keyframes { return node.type === "keyframes"; }