chore(lint): fix lint to make ci work

This commit is contained in:
Sibelius Seraphini 2018-04-15 08:19:02 -03:00
parent ce387059e4
commit 919d07b162
5 changed files with 40 additions and 13 deletions

View File

@ -16,6 +16,7 @@
"plugins": [
"react",
"react-native",
"flowtype"
],
"extends": [
"eslint:recommended",
@ -34,7 +35,9 @@
"no-class-assign": 1,
"no-console": 1,
"object-curly-spacing": [1, "always"],
"no-unused-vars": ["error", { "ignoreRestSiblings": true }]
"no-unused-vars": ["error", { "ignoreRestSiblings": true }],
"flowtype/define-flow-type": 1,
"flowtype/use-flow-type": 1
},
"globals": {
"__DEV__": true,

12
.flowconfig Normal file
View File

@ -0,0 +1,12 @@
[ignore]
.*/node_modules/.*
[include]
[libs]
[lints]
[options]
[strict]

View File

@ -17,6 +17,7 @@
"@commitlint/config-conventional": "^6.1.0",
"babel-eslint": "^8.0.2",
"eslint": "^4.12.0",
"eslint-plugin-flowtype": "^2.46.2",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-react": "^7.3.0",
"eslint-plugin-react-native": "^3.2.0",

View File

@ -1,3 +1,4 @@
// @flow
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
@ -9,7 +10,6 @@ import {
findNodeHandle,
requireNativeComponent,
ViewPropTypes,
PermissionsAndroid,
ActivityIndicator,
View,
Text,
@ -194,7 +194,12 @@ export default class Camera extends Component {
let hasVideoAndAudio =
this.props.captureAudio && captureMode === Camera.constants.CaptureMode.video;
const isAuthorized = await requestPermissions(hasVideoAndAudio, Camera, this.props.permissionDialogTitle, this.props.permissionDialogMessage);
const isAuthorized = await requestPermissions(
hasVideoAndAudio,
Camera,
this.props.permissionDialogTitle,
this.props.permissionDialogMessage,
);
this.setState({ isAuthorized, isAuthorizationChecked: true });
}
@ -208,15 +213,15 @@ export default class Camera extends Component {
}
componentWillReceiveProps(newProps) {
const { onBarCodeRead, onFocusChanged, onZoomChanged } = this.props
const { onBarCodeRead, onFocusChanged, onZoomChanged } = this.props;
if (onBarCodeRead !== newProps.onBarCodeRead) {
this._addOnBarCodeReadListener(newProps);
}
if (onFocusChanged !== !newProps.onFocusChanged) {
this._addOnFocusChanged(newProps)
this._addOnFocusChanged(newProps);
}
if (onZoomChanged !== !newProps.onZoomChanged) {
this._addOnZoomChanged(newProps)
this._addOnZoomChanged(newProps);
}
}
@ -233,14 +238,14 @@ export default class Camera extends Component {
_addOnFocusChanged(props) {
if (Platform.OS === 'ios') {
const { onFocusChanged } = props || this.props;
this.focusListener = NativeAppEventEmitter.addListener('focusChanged', onFocusChanged)
this.focusListener = NativeAppEventEmitter.addListener('focusChanged', onFocusChanged);
}
}
_addOnZoomChanged(props) {
if (Platform.OS === 'ios') {
const { onZoomChanged } = props || this.props;
this.zoomListener = NativeAppEventEmitter.addListener('zoomChanged', onZoomChanged)
this.zoomListener = NativeAppEventEmitter.addListener('zoomChanged', onZoomChanged);
}
}
_removeOnBarCodeReadListener() {
@ -250,15 +255,15 @@ export default class Camera extends Component {
}
}
_removeOnFocusChanged() {
const listener = this.focusListener
const listener = this.focusListener;
if (listener) {
listener.remove()
listener.remove();
}
}
_removeOnZoomChanged() {
const listener = this.zoomListener
const listener = this.zoomListener;
if (listener) {
listener.remove()
listener.remove();
}
}

View File

@ -2115,6 +2115,12 @@ eslint-module-utils@^2.1.1:
debug "^2.6.8"
pkg-dir "^1.0.0"
eslint-plugin-flowtype@^2.46.2:
version "2.46.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.46.2.tgz#8749fddda6f6c30d0672011151bea726765b5753"
dependencies:
lodash "^4.15.0"
eslint-plugin-import@^2.7.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz#fa1b6ef31fcb3c501c09859c1b86f1fc5b986894"
@ -3674,7 +3680,7 @@ lodash@^3.5.0:
version "3.10.1"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
lodash@^4.14.0, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.6.1:
lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.6.1:
version "4.17.5"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"