Skip to content

Commit 3017a84

Browse files
committed
fix eslint errors
1 parent ce3c4b5 commit 3017a84

File tree

4 files changed

+47
-48
lines changed

4 files changed

+47
-48
lines changed

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
2+
package-lock.json
23
.vscode
3-
.idea/
4+
.idea/

Diff for: Exemples/App.js

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
import React, { Component } from "react";
2-
import Swiper from "react-native-deck-swiper";
3-
import { StyleSheet, View, Text, Image, Button } from "react-native";
1+
import React, { Component } from 'react'
2+
import Swiper from 'react-native-deck-swiper'
3+
import { StyleSheet, View, Text, Button } from 'react-native'
44

55
export default class Exemple extends Component {
6-
constructor(props) {
7-
super(props);
6+
constructor (props) {
7+
super(props)
88
this.state = {
9-
cards: ["1", "2", "3"],
9+
cards: ['1', '2', '3'],
1010
swipedAllCards: false,
11-
swipeDirection: "",
11+
swipeDirection: '',
1212
isSwipingBack: false,
1313
cardIndex: 0
14-
};
14+
}
1515
}
1616

1717
renderCard = card => {
1818
return (
1919
<View style={styles.card}>
2020
<Text style={styles.text}>{card}</Text>
2121
</View>
22-
);
22+
)
2323
};
2424

2525
onSwipedAllCards = () => {
2626
this.setState({
2727
swipedAllCards: true
28-
});
28+
})
2929
};
3030

3131
swipeBack = () => {
3232
if (!this.state.isSwipingBack) {
3333
this.setIsSwipingBack(true, () => {
3434
this.swiper.swipeBack(() => {
35-
this.setIsSwipingBack(false);
36-
});
37-
});
35+
this.setIsSwipingBack(false)
36+
})
37+
})
3838
}
3939
};
4040

@@ -44,19 +44,19 @@ export default class Exemple extends Component {
4444
isSwipingBack: isSwipingBack
4545
},
4646
cb
47-
);
47+
)
4848
};
4949

5050
jumpTo = () => {
51-
this.swiper.jumpToCardIndex(2);
51+
this.swiper.jumpToCardIndex(2)
5252
};
5353

54-
render() {
54+
render () {
5555
return (
5656
<View style={styles.container}>
5757
<Swiper
5858
ref={swiper => {
59-
this.swiper = swiper;
59+
this.swiper = swiper
6060
}}
6161
onSwiped={this.onSwiped}
6262
cards={this.state.cards}
@@ -94,11 +94,11 @@ export default class Exemple extends Component {
9494
animateOverlayLabelsOpacity
9595
animateCardOpacity
9696
>
97-
<Button onPress={this.swipeBack} title="Swipe Back" />
98-
<Button onPress={this.jumpTo} title="Jump to last index" />
97+
<Button onPress={this.swipeBack} title='Swipe Back' />
98+
<Button onPress={this.jumpTo} title='Jump to last index' />
9999
</Swiper>
100-
</View >
101-
);
100+
</View>
101+
)
102102
}
103103
}
104104

@@ -108,25 +108,25 @@ const styles = StyleSheet.create({
108108
},
109109
container: {
110110
flex: 1,
111-
backgroundColor: "#F5FCFF"
111+
backgroundColor: '#F5FCFF'
112112
},
113113
card: {
114114
flex: 1,
115115
borderRadius: 4,
116116
borderWidth: 2,
117-
borderColor: "#E8E8E8",
118-
justifyContent: "center",
119-
backgroundColor: "white"
117+
borderColor: '#E8E8E8',
118+
justifyContent: 'center',
119+
backgroundColor: 'white'
120120
},
121121
text: {
122-
textAlign: "center",
122+
textAlign: 'center',
123123
fontSize: 50,
124-
backgroundColor: "transparent"
124+
backgroundColor: 'transparent'
125125
},
126126
done: {
127-
textAlign: "center",
127+
textAlign: 'center',
128128
fontSize: 30,
129-
color: "white",
130-
backgroundColor: "transparent"
129+
color: 'white',
130+
backgroundColor: 'transparent'
131131
}
132-
});
132+
})

Diff for: Swiper.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const LABEL_TYPES = {
1313
}
1414

1515
class Swiper extends React.Component {
16-
componentWillReceiveProps(newProps) {
16+
componentWillReceiveProps (newProps) {
1717
this.setState({
1818
firstCardIndex: newProps.cardIndex || 0,
1919
cards: newProps.cards,
@@ -27,7 +27,7 @@ class Swiper extends React.Component {
2727
})
2828
}
2929

30-
constructor(props) {
30+
constructor (props) {
3131
super(props)
3232

3333
this.state = {
@@ -66,7 +66,7 @@ class Swiper extends React.Component {
6666
return atFirstIndex ? this.state.cards.length - 1 : firstCardIndex - 1
6767
}
6868

69-
componentWillMount() {
69+
componentWillMount () {
7070
this._animatedValueX = 0
7171
this._animatedValueY = 0
7272

@@ -77,7 +77,7 @@ class Swiper extends React.Component {
7777
this.initializePanResponder()
7878
}
7979

80-
componentWillUnmount() {
80+
componentWillUnmount () {
8181
this.state.pan.x.removeAllListeners()
8282
this.state.pan.y.removeAllListeners()
8383
}
@@ -254,7 +254,7 @@ class Swiper extends React.Component {
254254
}
255255
}
256256

257-
mustDecrementCardIndex(animatedValueX, animatedValueY) {
257+
mustDecrementCardIndex (animatedValueX, animatedValueY) {
258258
const {
259259
isSwipingLeft,
260260
isSwipingRight,
@@ -270,7 +270,7 @@ class Swiper extends React.Component {
270270
)
271271
}
272272

273-
getSwipeDirection(animatedValueX, animatedValueY) {
273+
getSwipeDirection (animatedValueX, animatedValueY) {
274274
const isSwipingLeft = animatedValueX < -this.props.horizontalThreshold
275275
const isSwipingRight = animatedValueX > this.props.horizontalThreshold
276276
const isSwipingTop = animatedValueY < -this.props.verticalThreshold
@@ -309,7 +309,6 @@ class Swiper extends React.Component {
309309
0,
310310
mustDecrementCardIndex
311311
)
312-
313312
}
314313

315314
swipeRight = (mustDecrementCardIndex = false) => {
@@ -321,7 +320,6 @@ class Swiper extends React.Component {
321320
0,
322321
mustDecrementCardIndex
323322
)
324-
325323
}
326324

327325
swipeTop = (mustDecrementCardIndex = false) => {
@@ -605,7 +603,7 @@ class Swiper extends React.Component {
605603
outputRange: this.props.outputRotationRange
606604
})
607605

608-
render() {
606+
render () {
609607
return (
610608
<View
611609
style={[
@@ -625,7 +623,7 @@ class Swiper extends React.Component {
625623
)
626624
}
627625

628-
renderChildren() {
626+
renderChildren = () => {
629627
const { childrenOnTop, children } = this.props
630628

631629
let zIndex = 1
@@ -861,4 +859,4 @@ Swiper.defaultProps = {
861859
goBackToPreviousCardOnSwipeBottom: false
862860
}
863861

864-
export default Swiper
862+
export default Swiper

Diff for: package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@
3939
"react-native": "0.41.2"
4040
},
4141
"devDependencies": {
42-
"babel-eslint": "^7.1.1",
43-
"eslint": "^4.4.1",
42+
"babel-eslint": "^7.2.3",
43+
"babel-jest": "18.0.0",
44+
"babel-preset-react-native": "1.9.1",
45+
"eslint": "^3.19.0",
4446
"eslint-config-standard": "^10.2.1",
4547
"eslint-config-standard-react": "^5.0.0",
4648
"eslint-plugin-import": "^2.7.0",
@@ -49,12 +51,10 @@
4951
"eslint-plugin-promise": "^3.5.0",
5052
"eslint-plugin-react": "^7.2.1",
5153
"eslint-plugin-standard": "^3.0.1",
54+
"jest": "18.1.0",
5255
"jest-cli": "^18.1.0",
5356
"prettier-eslint": "^6.4.2",
5457
"prettier-eslint-cli": "^4.1.1",
55-
"babel-jest": "18.0.0",
56-
"babel-preset-react-native": "1.9.1",
57-
"jest": "18.1.0",
5858
"react-test-renderer": "15.4.2"
5959
},
6060
"jest": {

0 commit comments

Comments
 (0)