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:
Tim Schaub
2020-04-06 12:25:12 -06:00
parent 53b48baf62
commit 054af09032
790 changed files with 46833 additions and 33765 deletions

View File

@@ -1,11 +1,14 @@
/**
* @module ol/interaction/DragRotate
*/
import {disable} from '../rotationconstraint.js';
import {altShiftKeysOnly, mouseOnly, mouseActionButton} from '../events/condition.js';
import {FALSE} from '../functions.js';
import PointerInteraction from './Pointer.js';
import {FALSE} from '../functions.js';
import {
altShiftKeysOnly,
mouseActionButton,
mouseOnly,
} from '../events/condition.js';
import {disable} from '../rotationconstraint.js';
/**
* @typedef {Object} Options
@@ -16,7 +19,6 @@ import PointerInteraction from './Pointer.js';
* @property {number} [duration=250] Animation duration in milliseconds.
*/
/**
* @classdesc
* Allows the user to rotate the map by clicking and dragging on the map,
@@ -27,16 +29,14 @@ import PointerInteraction from './Pointer.js';
* @api
*/
class DragRotate extends PointerInteraction {
/**
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
super({
stopDown: FALSE
stopDown: FALSE,
});
/**
@@ -56,7 +56,6 @@ class DragRotate extends PointerInteraction {
* @type {number}
*/
this.duration_ = options.duration !== undefined ? options.duration : 250;
}
/**
@@ -75,8 +74,7 @@ class DragRotate extends PointerInteraction {
}
const size = map.getSize();
const offset = mapBrowserEvent.pixel;
const theta =
Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);
const theta = Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);
if (this.lastAngle_ !== undefined) {
const delta = theta - this.lastAngle_;
view.adjustRotationInternal(-delta);
@@ -84,7 +82,6 @@ class DragRotate extends PointerInteraction {
this.lastAngle_ = theta;
}
/**
* Handle pointer up events.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
@@ -101,7 +98,6 @@ class DragRotate extends PointerInteraction {
return false;
}
/**
* Handle pointer down events.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
@@ -112,7 +108,10 @@ class DragRotate extends PointerInteraction {
return false;
}
if (mouseActionButton(mapBrowserEvent) && this.condition_(mapBrowserEvent)) {
if (
mouseActionButton(mapBrowserEvent) &&
this.condition_(mapBrowserEvent)
) {
const map = mapBrowserEvent.map;
map.getView().beginInteraction();
this.lastAngle_ = undefined;