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,12 +1,11 @@
/**
* @module ol/control/Control
*/
import {VOID} from '../functions.js';
import MapEventType from '../MapEventType.js';
import BaseObject from '../Object.js';
import {removeNode} from '../dom.js';
import MapEventType from '../MapEventType.js';
import {VOID} from '../functions.js';
import {listen, unlistenByKey} from '../events.js';
import {removeNode} from '../dom.js';
/**
* @typedef {Object} Options
@@ -20,7 +19,6 @@ import {listen, unlistenByKey} from '../events.js';
* the control to be rendered outside of the map's viewport.
*/
/**
* @classdesc
* A control is a visible widget with a DOM element in a fixed position on the
@@ -46,12 +44,10 @@ import {listen, unlistenByKey} from '../events.js';
* @api
*/
class Control extends BaseObject {
/**
* @param {Options} options Control options.
*/
constructor(options) {
super();
/**
@@ -87,7 +83,6 @@ class Control extends BaseObject {
if (options.target) {
this.setTarget(options.target);
}
}
/**
@@ -124,12 +119,14 @@ class Control extends BaseObject {
this.listenerKeys.length = 0;
this.map_ = map;
if (this.map_) {
const target = this.target_ ?
this.target_ : map.getOverlayContainerStopEvent();
const target = this.target_
? this.target_
: map.getOverlayContainerStopEvent();
target.appendChild(this.element);
if (this.render !== VOID) {
this.listenerKeys.push(listen(map,
MapEventType.POSTRENDER, this.render, this));
this.listenerKeys.push(
listen(map, MapEventType.POSTRENDER, this.render, this)
);
}
map.render();
}
@@ -155,11 +152,9 @@ class Control extends BaseObject {
* @api
*/
setTarget(target) {
this.target_ = typeof target === 'string' ?
document.getElementById(target) :
target;
this.target_ =
typeof target === 'string' ? document.getElementById(target) : target;
}
}
export default Control;