Make code prettier
This updates ESLint and our shared eslint-config-openlayers to use Prettier. Most formatting changes were automatically applied with this:
npm run lint -- --fix
A few manual changes were required:
* In `examples/offscreen-canvas.js`, the `//eslint-disable-line` comment needed to be moved to the appropriate line to disable the error about the `'worker-loader!./offscreen-canvas.worker.js'` import.
* In `examples/webpack/exapmle-builder.js`, spaces could not be added after a couple `function`s for some reason. While editing this, I reworked `ExampleBuilder` to be a class.
* In `src/ol/format/WMSGetFeatureInfo.js`, the `// @ts-ignore` comment needed to be moved down one line so it applied to the `parsersNS` argument.
This commit is contained in:
+5
-11
@@ -14,7 +14,6 @@ export function clamp(value, min, max) {
|
||||
return Math.min(Math.max(value, min), max);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the hyperbolic cosine of a given number. The method will use the
|
||||
* native `Math.cosh` function if it is available, otherwise the hyperbolic
|
||||
@@ -24,7 +23,7 @@ export function clamp(value, min, max) {
|
||||
* @param {number} x X.
|
||||
* @return {number} Hyperbolic cosine of x.
|
||||
*/
|
||||
export const cosh = (function() {
|
||||
export const cosh = (function () {
|
||||
// Wrapped in a iife, to save the overhead of checking for the native
|
||||
// implementation on every invocation.
|
||||
let cosh;
|
||||
@@ -33,14 +32,13 @@ export const cosh = (function() {
|
||||
cosh = Math.cosh;
|
||||
} else {
|
||||
// … else, use the reference implementation of MDN:
|
||||
cosh = function(x) {
|
||||
cosh = function (x) {
|
||||
const y = /** @type {Math} */ (Math).exp(x);
|
||||
return (y + 1 / y) / 2;
|
||||
};
|
||||
}
|
||||
return cosh;
|
||||
}());
|
||||
|
||||
})();
|
||||
|
||||
/**
|
||||
* Returns the square of the closest distance between the point (x, y) and the
|
||||
@@ -69,7 +67,6 @@ export function squaredSegmentDistance(x, y, x1, y1, x2, y2) {
|
||||
return squaredDistance(x, y, x1, y1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the square of the distance between the points (x1, y1) and (x2, y2).
|
||||
* @param {number} x1 X1.
|
||||
@@ -84,7 +81,6 @@ export function squaredDistance(x1, y1, x2, y2) {
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Solves system of linear equations using Gaussian elimination method.
|
||||
*
|
||||
@@ -140,7 +136,6 @@ export function solveLinearSystem(mat) {
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts radians to to degrees.
|
||||
*
|
||||
@@ -148,10 +143,9 @@ export function solveLinearSystem(mat) {
|
||||
* @return {number} Angle in degrees.
|
||||
*/
|
||||
export function toDegrees(angleInRadians) {
|
||||
return angleInRadians * 180 / Math.PI;
|
||||
return (angleInRadians * 180) / Math.PI;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts degrees to radians.
|
||||
*
|
||||
@@ -159,7 +153,7 @@ export function toDegrees(angleInRadians) {
|
||||
* @return {number} Angle in radians.
|
||||
*/
|
||||
export function toRadians(angleInDegrees) {
|
||||
return angleInDegrees * Math.PI / 180;
|
||||
return (angleInDegrees * Math.PI) / 180;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user