Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Commit

Permalink
chore(lint): fix lint to make ci work
Browse files Browse the repository at this point in the history
  • Loading branch information
sibelius committed Apr 15, 2018
1 parent ce38705 commit 919d07b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"plugins": [
"react",
"react-native",
"flowtype"
],
"extends": [
"eslint:recommended",
Expand All @@ -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,
Expand Down
12 changes: 12 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[ignore]
.*/node_modules/.*

[include]

[libs]

[lints]

[options]

[strict]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
27 changes: 16 additions & 11 deletions src/Camera.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
Expand All @@ -9,7 +10,6 @@ import {
findNodeHandle,
requireNativeComponent,
ViewPropTypes,
PermissionsAndroid,
ActivityIndicator,
View,
Text,
Expand Down Expand Up @@ -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 });
}

Expand All @@ -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);
}
}

Expand All @@ -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() {
Expand All @@ -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();
}
}

Expand Down
8 changes: 7 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"

Expand Down

0 comments on commit 919d07b

Please sign in to comment.