Skip to content

Commit 5e83184

Browse files
committed
Compile, Bump version, Update changelog and contributing guide to include eslint changes
1 parent b13c8c3 commit 5e83184

File tree

4 files changed

+35
-37
lines changed

4 files changed

+35
-37
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 0.2.4 Release
2+
- List eslint as an explicit devDependency
3+
- upgrade the eslint related packages
4+
- fix linting errors using current config
5+
- Add notes about maintaining absence of lint errors and warnings in Contributing guide
6+
- This should make it easier to ensure code quality as others contribute in the open
7+
- Also, drop unused jest and enzyme deps
8+
19
# 0.2.3 Release
210
- Missed Transpilation
311

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Before submitting a Pull Request please ensure you have completed the following
5656
2. Make sure your copy is up to date: `git pull upstream master`
5757
3. Run `npm run compile`, to compile your changes to the exported `/lib` code.
5858
4. Bump the version in `package.json` as appropriate, see `Versioning` in the section below.
59+
4. Run `npm run lint` to verify code style, all pull requests should have zero lint errors and warnings
5960
4. Commit your changes
6061
5. Push your changes to your fork: `your-username/react-leaflet-heatmap-layer`
6162
6. Open a pull request from your fork to the `upstream` fork (`OpenGov/react-leaflet-heatmap-layer`)

lib/HeatmapLayer.js

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,22 @@ var _lodash3 = require('lodash.reduce');
2020

2121
var _lodash4 = _interopRequireDefault(_lodash3);
2222

23-
var _lodash5 = require('lodash.foreach');
23+
var _lodash5 = require('lodash.filter');
2424

2525
var _lodash6 = _interopRequireDefault(_lodash5);
2626

27-
var _lodash7 = require('lodash.pluck');
27+
var _lodash7 = require('lodash.min');
2828

2929
var _lodash8 = _interopRequireDefault(_lodash7);
3030

31-
var _lodash9 = require('lodash.filter');
31+
var _lodash9 = require('lodash.max');
3232

3333
var _lodash10 = _interopRequireDefault(_lodash9);
3434

35-
var _lodash11 = require('lodash.min');
35+
var _lodash11 = require('lodash.isnumber');
3636

3737
var _lodash12 = _interopRequireDefault(_lodash11);
3838

39-
var _lodash13 = require('lodash.max');
40-
41-
var _lodash14 = _interopRequireDefault(_lodash13);
42-
43-
var _lodash15 = require('lodash.isnumber');
44-
45-
var _lodash16 = _interopRequireDefault(_lodash15);
46-
4739
var _leaflet = require('leaflet');
4840

4941
var _leaflet2 = _interopRequireDefault(_leaflet);
@@ -62,20 +54,20 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
6254

6355
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
6456

65-
function isValidLatLngArray(arr) {
66-
return (0, _lodash10.default)(arr, isValid).length === arr.length;
57+
function isInvalid(num) {
58+
return !(0, _lodash12.default)(num) && !num;
6759
}
6860

69-
function isInvalidLatLngArray(arr) {
70-
return !isValidLatLngArray(arr);
61+
function isValid(num) {
62+
return !isInvalid(num);
7163
}
7264

73-
function isInvalid(num) {
74-
return !(0, _lodash16.default)(num) && !num;
65+
function isValidLatLngArray(arr) {
66+
return (0, _lodash6.default)(arr, isValid).length === arr.length;
7567
}
7668

77-
function isValid(num) {
78-
return !isInvalid(num);
69+
function isInvalidLatLngArray(arr) {
70+
return !isValidLatLngArray(arr);
7971
}
8072

8173
function shouldIgnoreLocation(loc) {
@@ -162,8 +154,8 @@ var HeatmapLayer = function (_MapLayer) {
162154
var points = this.props.points;
163155
var lngs = (0, _lodash2.default)(points, this.props.longitudeExtractor);
164156
var lats = (0, _lodash2.default)(points, this.props.latitudeExtractor);
165-
var ne = { lng: (0, _lodash14.default)(lngs), lat: (0, _lodash14.default)(lats) };
166-
var sw = { lng: (0, _lodash12.default)(lngs), lat: (0, _lodash12.default)(lats) };
157+
var ne = { lng: (0, _lodash10.default)(lngs), lat: (0, _lodash10.default)(lats) };
158+
var sw = { lng: (0, _lodash8.default)(lngs), lat: (0, _lodash8.default)(lats) };
167159

168160
if (shouldIgnoreLocation(ne) || shouldIgnoreLocation(sw)) {
169161
return;
@@ -187,15 +179,15 @@ var HeatmapLayer = function (_MapLayer) {
187179
HeatmapLayer.prototype.attachEvents = function attachEvents() {
188180
var _this2 = this;
189181

190-
var map = this.props.map;
191-
map.on('viewreset', function () {
182+
var leafletMap = this.props.map;
183+
leafletMap.on('viewreset', function () {
192184
return _this2.reset();
193185
});
194-
map.on('moveend', function () {
186+
leafletMap.on('moveend', function () {
195187
return _this2.reset();
196188
});
197-
if (map.options.zoomAnimation && _leaflet2.default.Browser.any3d) {
198-
map.on('zoomanim', this._animateZoom, this);
189+
if (leafletMap.options.zoomAnimation && _leaflet2.default.Browser.any3d) {
190+
leafletMap.on('zoomanim', this._animateZoom, this);
199191
}
200192
};
201193

@@ -241,7 +233,6 @@ var HeatmapLayer = function (_MapLayer) {
241233
var v = 1 / Math.pow(2, Math.max(0, Math.min(maxZoom - this.props.map.getZoom(), 12)));
242234

243235
var cellSize = r / 2;
244-
var grid = [];
245236
var panePos = this.props.map._getMapPanePos();
246237
var offsetX = panePos.x % cellSize;
247238
var offsetY = panePos.y % cellSize;
@@ -253,15 +244,15 @@ var HeatmapLayer = function (_MapLayer) {
253244
return bounds.contains(p);
254245
};
255246

256-
var filterUndefined = function filterUndefined(r) {
257-
return (0, _lodash10.default)(r, function (c) {
247+
var filterUndefined = function filterUndefined(row) {
248+
return (0, _lodash6.default)(row, function (c) {
258249
return c !== undefined;
259250
});
260251
};
261252

262253
var roundResults = function roundResults(results) {
263254
return (0, _lodash4.default)(results, function (result, row) {
264-
return (0, _lodash2.default)(filterUndefined(row), function (cell, key, row) {
255+
return (0, _lodash2.default)(filterUndefined(row), function (cell) {
265256
return [Math.round(cell[0]), Math.round(cell[1]), Math.min(cell[2], maxIntensity), cell[3]];
266257
}).concat(result);
267258
}, []);
@@ -303,7 +294,7 @@ var HeatmapLayer = function (_MapLayer) {
303294
}, []);
304295
};
305296

306-
var getBounds = function getBounds(leafletMap) {
297+
var getBounds = function getBounds() {
307298
return new _leaflet2.default.Bounds(_leaflet2.default.point([-r, -r]), size.add([r, r]));
308299
};
309300

@@ -318,13 +309,11 @@ var HeatmapLayer = function (_MapLayer) {
318309
this._frame = null;
319310

320311
if (this.props.onStatsUpdate && this.props.points && this.props.points.length > 0) {
321-
var stats = _.reduce(data, function (stats, point) {
312+
this.props.onStatsUpdate((0, _lodash4.default)(data, function (stats, point) {
322313
stats.max = point[3] > stats.max ? point[3] : stats.max;
323314
stats.min = point[3] < stats.min ? point[3] : stats.min;
324315
return stats;
325-
}, { min: Infinity, max: -Infinity });
326-
327-
this.props.onStatsUpdate(stats);
316+
}, { min: Infinity, max: -Infinity }));
328317
}
329318
};
330319

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-leaflet-heatmap-layer",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "A custom layer for heatmaps in react-leaflet",
55
"main": "lib/HeatmapLayer.js",
66
"scripts": {

0 commit comments

Comments
 (0)