Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix or bypass `no-restricted-properties` errors

Jason Kentc1a6a0dd9f90
diff --git a/.eslintrc b/.eslintrc
index d8ba7d77b..e4872f2cf 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -84,7 +84,6 @@
"class-methods-use-this": "off",
"max-len": "off",
- "no-restricted-properties": "off",
"no-restricted-globals": "off",
"no-multi-assign": "off",
"consistent-return": "off",
@@ -117,7 +116,6 @@
// React rules overrides
"react/jsx-props-no-spreading": "warn",
"react/jsx-filename-extension": "off",
- // "react/prefer-stateless-function": "warn", // 20 errors, consider fixing
"react/sort-comp": "off",
"react/no-unused-state": "warn", // 38 errors
"react/no-unused-prop-types": "warn", // 66 errors
diff --git a/web/js/map/data/map.js b/web/js/map/data/map.js
index 111992d9f..d89ef2a37 100644
--- a/web/js/map/data/map.js
+++ b/web/js/map/data/map.js
@@ -382,7 +382,7 @@ export function dataMap(store, maps, dataUi, ui) {
// Minimum size of the button is 15 pixels
const base = 12;
// Double the size for each zoom level
- const add = Math.pow(2, zoom);
+ const add = 2 ** zoom;
// Apply size adjustment to the button if specified by TagButtonScale
const buttonScale = feature.granule.buttonScale || 1;
let size = (base + add) * buttonScale;
diff --git a/web/js/map/map.js b/web/js/map/map.js
index aa85e1d33..a27c4e1d8 100644
--- a/web/js/map/map.js
+++ b/web/js/map/map.js
@@ -223,8 +223,8 @@ export function mapAdjustAntiMeridian(polygon, adjustSign) {
*
*/
export function mapDistance2D(p1, p2) {
- return Math.sqrt(Math.pow(p1[0] - p2[0], 2)
- + Math.pow(p1[1] - p2[1], 2));
+ // eslint-disable-next-line no-restricted-properties
+ return Math.sqrt(Math.pow(p1[0] - p2[0], 2) + Math.pow(p1[1] - p2[1], 2));
}
/**
diff --git a/web/js/map/natural-events/track.js b/web/js/map/natural-events/track.js
index 2d8933539..a460f5700 100644
--- a/web/js/map/natural-events/track.js
+++ b/web/js/map/natural-events/track.js
@@ -466,7 +466,7 @@ const createArrows = function(lineSegmentCoords, map) {
const dx = pixel2[0] - pixel1[0];
const dy = pixel2[1] - pixel1[1];
const pixelMidPoint = [0.5 * dx + pixel1[0], 0.5 * dy + pixel1[1]];
- const distanceInPixels = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
+ const distanceInPixels = Math.sqrt((dx ** 2) + (dy ** 2));
const angleRadians = Math.atan2(dyCoord, dxCoord) - currentRotation;
const angleDegrees = -angleRadians * (180 / Math.PI);
const lengthOfArrowDiv = distanceInPixels - clusterPadding;
diff --git a/web/js/util/util.js b/web/js/util/util.js
index 716dc49b7..562b52230 100644
--- a/web/js/util/util.js
+++ b/web/js/util/util.js
@@ -825,6 +825,7 @@ export default (function(self) {
const g2 = parseInt(hex2.substring(2, 4), 16);
const b2 = parseInt(hex2.substring(4, 6), 16);
// calculate differences in 3D Space
+ // eslint-disable-next-line no-restricted-properties
return Math.sqrt(Math.pow(r1 - r2, 2) + Math.pow(g1 - g2, 2) + Math.pow(b1 - b2, 2));
};
self.fetch = function(url, mimeType) {