Skip to content

Commit b101ff6

Browse files
author
Spike Brehm
authored
Merge pull request react-native-maps#515 from lelandrichardson/more-eslint
Fix all remaining ESLint violations
2 parents b50d658 + 6ed8ea4 commit b101ff6

35 files changed

+1625
-1875
lines changed

.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"rules": {
88
"prefer-object-spread/prefer-object-spread": 2,
99
"react/jsx-filename-extension": 0,
10+
"react/prefer-stateless-function": 0,
11+
"react/sort-comp": 0,
1012
"no-use-before-define": 0,
11-
"no-underscore-dangle": 0
13+
"no-underscore-dangle": 0,
14+
"import/no-unresolved": [2, { "ignore": ["react"] }]
1215
}
1316
}

components/AnimatedRegion.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable */
2+
13
class AnimatedRegion extends AnimatedWithChildren {
24
// latitude: AnimatedValue;
35
// longitude: AnimatedValue;

components/MapCallout.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ import {
55
StyleSheet,
66
} from 'react-native';
77

8-
// eslint-disable-next-line react/prefer-es6-class
9-
const MapCallout = React.createClass({
10-
propTypes: {
11-
...View.propTypes,
12-
tooltip: PropTypes.bool,
13-
onPress: PropTypes.func,
14-
},
8+
const propTypes = {
9+
...View.propTypes,
10+
tooltip: PropTypes.bool,
11+
onPress: PropTypes.func,
12+
};
1513

16-
getDefaultProps() {
17-
return {
18-
tooltip: false,
19-
};
20-
},
14+
const defaultProps = {
15+
tooltip: false,
16+
};
2117

18+
class MapCallout extends React.Component {
2219
render() {
2320
return <AIRMapCallout {...this.props} style={[styles.callout, this.props.style]} />;
24-
},
25-
});
21+
}
22+
}
23+
24+
MapCallout.propTypes = propTypes;
25+
MapCallout.defaultProps = defaultProps;
2626

2727
const styles = StyleSheet.create({
2828
callout: {

components/MapCircle.js

Lines changed: 121 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -4,142 +4,133 @@ import {
44
requireNativeComponent,
55
} from 'react-native';
66

7-
// eslint-disable-next-line react/prefer-es6-class
8-
const MapCircle = React.createClass({
9-
propTypes: {
10-
...View.propTypes,
7+
const propTypes = {
8+
...View.propTypes,
119

10+
/**
11+
* The coordinate of the center of the circle
12+
*/
13+
center: PropTypes.shape({
1214
/**
13-
* The coordinate of the center of the circle
15+
* Coordinates for the center of the circle.
1416
*/
15-
center: PropTypes.shape({
16-
/**
17-
* Coordinates for the center of the circle.
18-
*/
19-
latitude: PropTypes.number.isRequired,
20-
longitude: PropTypes.number.isRequired,
21-
}).isRequired,
22-
23-
/**
24-
* The radius of the circle to be drawn (in meters)
25-
*/
26-
radius: PropTypes.number.isRequired,
27-
28-
/**
29-
* Callback that is called when the user presses on the circle
30-
*/
31-
onPress: PropTypes.func,
32-
33-
/**
34-
* The stroke width to use for the path.
35-
*/
36-
strokeWidth: PropTypes.number,
37-
38-
/**
39-
* The stroke color to use for the path.
40-
*/
41-
strokeColor: PropTypes.string,
42-
43-
/**
44-
* The fill color to use for the path.
45-
*/
46-
fillColor: PropTypes.string,
47-
48-
/**
49-
* The order in which this tile overlay is drawn with respect to other overlays. An overlay
50-
* with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
51-
* with the same z-index is arbitrary. The default zIndex is 0.
52-
*
53-
* @platform android
54-
*/
55-
zIndex: PropTypes.number,
56-
57-
/**
58-
* The line cap style to apply to the open ends of the path.
59-
* The default style is `round`.
60-
*
61-
* @platform ios
62-
*/
63-
lineCap: PropTypes.oneOf([
64-
'butt',
65-
'round',
66-
'square',
67-
]),
68-
69-
/**
70-
* The line join style to apply to corners of the path.
71-
* The default style is `round`.
72-
*
73-
* @platform ios
74-
*/
75-
lineJoin: PropTypes.oneOf([
76-
'miter',
77-
'round',
78-
'bevel',
79-
]),
80-
81-
/**
82-
* The limiting value that helps avoid spikes at junctions between connected line segments.
83-
* The miter limit helps you avoid spikes in paths that use the `miter` `lineJoin` style. If
84-
* the ratio of the miter length—that is, the diagonal length of the miter join—to the line
85-
* thickness exceeds the miter limit, the joint is converted to a bevel join. The default
86-
* miter limit is 10, which results in the conversion of miters whose angle at the joint
87-
* is less than 11 degrees.
88-
*
89-
* @platform ios
90-
*/
91-
miterLimit: PropTypes.number,
92-
93-
/**
94-
* The offset (in points) at which to start drawing the dash pattern.
95-
*
96-
* Use this property to start drawing a dashed line partway through a segment or gap. For
97-
* example, a phase value of 6 for the patter 5-2-3-2 would cause drawing to begin in the
98-
* middle of the first gap.
99-
*
100-
* The default value of this property is 0.
101-
*
102-
* @platform ios
103-
*/
104-
lineDashPhase: PropTypes.number,
105-
106-
/**
107-
* An array of numbers specifying the dash pattern to use for the path.
108-
*
109-
* The array contains one or more numbers that indicate the lengths (measured in points) of the
110-
* line segments and gaps in the pattern. The values in the array alternate, starting with the
111-
* first line segment length, followed by the first gap length, followed by the second line
112-
* segment length, and so on.
113-
*
114-
* This property is set to `null` by default, which indicates no line dash pattern.
115-
*
116-
* @platform ios
117-
*/
118-
lineDashPattern: PropTypes.arrayOf(PropTypes.number),
119-
},
120-
121-
getDefaultProps() {
122-
return {
123-
strokeColor: '#000',
124-
strokeWidth: 1,
125-
};
126-
},
127-
128-
_onPress(e) {
129-
if (this.props.onPress) {
130-
this.props.onPress(e);
131-
}
132-
},
133-
17+
latitude: PropTypes.number.isRequired,
18+
longitude: PropTypes.number.isRequired,
19+
}).isRequired,
20+
21+
/**
22+
* The radius of the circle to be drawn (in meters)
23+
*/
24+
radius: PropTypes.number.isRequired,
25+
26+
/**
27+
* Callback that is called when the user presses on the circle
28+
*/
29+
onPress: PropTypes.func,
30+
31+
/**
32+
* The stroke width to use for the path.
33+
*/
34+
strokeWidth: PropTypes.number,
35+
36+
/**
37+
* The stroke color to use for the path.
38+
*/
39+
strokeColor: PropTypes.string,
40+
41+
/**
42+
* The fill color to use for the path.
43+
*/
44+
fillColor: PropTypes.string,
45+
46+
/**
47+
* The order in which this tile overlay is drawn with respect to other overlays. An overlay
48+
* with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
49+
* with the same z-index is arbitrary. The default zIndex is 0.
50+
*
51+
* @platform android
52+
*/
53+
zIndex: PropTypes.number,
54+
55+
/**
56+
* The line cap style to apply to the open ends of the path.
57+
* The default style is `round`.
58+
*
59+
* @platform ios
60+
*/
61+
lineCap: PropTypes.oneOf([
62+
'butt',
63+
'round',
64+
'square',
65+
]),
66+
67+
/**
68+
* The line join style to apply to corners of the path.
69+
* The default style is `round`.
70+
*
71+
* @platform ios
72+
*/
73+
lineJoin: PropTypes.oneOf([
74+
'miter',
75+
'round',
76+
'bevel',
77+
]),
78+
79+
/**
80+
* The limiting value that helps avoid spikes at junctions between connected line segments.
81+
* The miter limit helps you avoid spikes in paths that use the `miter` `lineJoin` style. If
82+
* the ratio of the miter length—that is, the diagonal length of the miter join—to the line
83+
* thickness exceeds the miter limit, the joint is converted to a bevel join. The default
84+
* miter limit is 10, which results in the conversion of miters whose angle at the joint
85+
* is less than 11 degrees.
86+
*
87+
* @platform ios
88+
*/
89+
miterLimit: PropTypes.number,
90+
91+
/**
92+
* The offset (in points) at which to start drawing the dash pattern.
93+
*
94+
* Use this property to start drawing a dashed line partway through a segment or gap. For
95+
* example, a phase value of 6 for the patter 5-2-3-2 would cause drawing to begin in the
96+
* middle of the first gap.
97+
*
98+
* The default value of this property is 0.
99+
*
100+
* @platform ios
101+
*/
102+
lineDashPhase: PropTypes.number,
103+
104+
/**
105+
* An array of numbers specifying the dash pattern to use for the path.
106+
*
107+
* The array contains one or more numbers that indicate the lengths (measured in points) of the
108+
* line segments and gaps in the pattern. The values in the array alternate, starting with the
109+
* first line segment length, followed by the first gap length, followed by the second line
110+
* segment length, and so on.
111+
*
112+
* This property is set to `null` by default, which indicates no line dash pattern.
113+
*
114+
* @platform ios
115+
*/
116+
lineDashPattern: PropTypes.arrayOf(PropTypes.number),
117+
};
118+
119+
const defaultProps = {
120+
strokeColor: '#000',
121+
strokeWidth: 1,
122+
};
123+
124+
class MapCircle extends React.Component {
134125
render() {
135126
return (
136-
<AIRMapCircle
137-
{...this.props}
138-
onPress={this._onPress}
139-
/>
127+
<AIRMapCircle {...this.props} />
140128
);
141-
},
142-
});
129+
}
130+
}
131+
132+
MapCircle.propTypes = propTypes;
133+
MapCircle.defaultProps = defaultProps;
143134

144135
const AIRMapCircle = requireNativeComponent('AIRMapCircle', MapCircle);
145136

0 commit comments

Comments
 (0)