From 77e54cfcfbafe54abd4aefa1dde4ea87e7fb383f Mon Sep 17 00:00:00 2001 From: Mikael Sand Date: Wed, 7 Jun 2017 17:25:22 +0300 Subject: [PATCH] Fix linting --- elements/TSpan.js | 4 +-- elements/Text.js | 4 +-- elements/TextPath.js | 2 +- lib/extract/extractStroke.js | 2 +- lib/extract/extractTransform.js | 46 ++++++++++++++++----------------- lib/extract/extractViewBox.js | 7 +---- 6 files changed, 30 insertions(+), 35 deletions(-) diff --git a/elements/TSpan.js b/elements/TSpan.js index 153fc460..3249c3c3 100644 --- a/elements/TSpan.js +++ b/elements/TSpan.js @@ -26,13 +26,13 @@ export default class extends Shape { return { isInAParentText: true }; - }; + } getContextTypes() { return { isInAParentText: React.PropTypes.bool }; - }; + } setNativeProps = (...args) => { this.root.setNativeProps(...args); diff --git a/elements/Text.js b/elements/Text.js index 7f5399d6..471293ba 100644 --- a/elements/Text.js +++ b/elements/Text.js @@ -25,13 +25,13 @@ export default class extends Shape { return { isInAParentText: true }; - }; + } getContextTypes() { return { isInAParentText: React.PropTypes.bool }; - }; + } setNativeProps = (...args) => { this.root.setNativeProps(...args); diff --git a/elements/TextPath.js b/elements/TextPath.js index 095e9dd7..83774994 100644 --- a/elements/TextPath.js +++ b/elements/TextPath.js @@ -43,7 +43,7 @@ export default class extends Shape { } console.warn('Invalid `href` prop for `TextPath` element, expected a href like `"#id"`, but got: "' + props.href + '"'); - return {children} + return {children}; } } diff --git a/lib/extract/extractStroke.js b/lib/extract/extractStroke.js index c82d8155..270f76db 100644 --- a/lib/extract/extractStroke.js +++ b/lib/extract/extractStroke.js @@ -1,6 +1,6 @@ import extractBrush from './extractBrush'; import extractOpacity from './extractOpacity'; -import {strokeProps} from '../props' +import {strokeProps} from '../props'; const separator = /\s*,\s*/; diff --git a/lib/extract/extractTransform.js b/lib/extract/extractTransform.js index ef96a15f..afaa8aeb 100644 --- a/lib/extract/extractTransform.js +++ b/lib/extract/extractTransform.js @@ -37,33 +37,33 @@ class TransformParser { let transLst = _.filter( transform.split(this.regex.split), (ele) => { - return ele !== ""; + return ele !== ''; } ); - for (let i=0; i= 0 ; i--) { + for (var i = matrix.length - 1; i >= 0; i--) { matrix[i] = parseFloat(matrix[i]); - }; + } } return matrix; } @@ -90,7 +90,7 @@ const tp = new TransformParser(); function appendTransform(transform) { if (transform) { - if (typeof transform === "string") { + if (typeof transform === 'string') { var transformParsed = tp.parse(transform); if (transformParsed.matrix) { pooledMatrix.append(...transformParsed.matrix); @@ -102,7 +102,7 @@ function appendTransform(transform) { } } } - if (typeof transform !== "string") { + if (typeof transform !== 'string') { pooledMatrix .appendTransform( transform.x + transform.originX, @@ -148,7 +148,7 @@ function universal2axis(universal, axisX, axisY, defaultValue) { } function props2transform(props) { - if (props && (typeof props === "string")) { + if (props && (typeof props === 'string')) { return props; } let [originX, originY] = universal2axis(props.origin, props.originX, props.originY); @@ -156,7 +156,7 @@ function props2transform(props) { let [skewX, skewY] = universal2axis(props.skew, props.skewX, props.skewY); let [translateX, translateY] = universal2axis( props.translate, - _.isNil(props.translateX) ? (props.x || 0): props.translateX, + _.isNil(props.translateX) ? (props.x || 0) : props.translateX, _.isNil(props.translateY) ? (props.y || 0) : props.translateY ); diff --git a/lib/extract/extractViewBox.js b/lib/extract/extractViewBox.js index 2730e89a..af2dbaab 100644 --- a/lib/extract/extractViewBox.js +++ b/lib/extract/extractViewBox.js @@ -1,8 +1,3 @@ - -import React, {Component, PropTypes} from 'react'; -import createReactNativeComponentClass from 'react-native/Libraries/Renderer/src/renderers/native/createReactNativeComponentClass'; -import {ViewBoxAttributes} from '../attributes'; - const meetOrSliceTypes = { meet: 0, slice: 1, @@ -47,7 +42,7 @@ export default function (props) { vbHeight: +params[3], align, meetOrSlice - } + }; } export {