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,10 @@
/**
* @module ol/source/Source
*/
import {abstract} from '../util.js';
import BaseObject from '../Object.js';
import {get as getProjection} from '../proj.js';
import SourceState from './State.js';
import {abstract} from '../util.js';
import {get as getProjection} from '../proj.js';
/**
* A function that returns a string or an array of strings representing source
@@ -14,7 +13,6 @@ import SourceState from './State.js';
* @typedef {function(import("../PluggableMap.js").FrameState): (string|Array<string>)} Attribution
*/
/**
* A type that can be used to provide attribution information for data sources.
*
@@ -26,7 +24,6 @@ import SourceState from './State.js';
* @typedef {string|Array<string>|Attribution} AttributionLike
*/
/**
* @typedef {Object} Options
* @property {AttributionLike} [attributions]
@@ -36,7 +33,6 @@ import SourceState from './State.js';
* @property {boolean} [wrapX=false]
*/
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
@@ -52,7 +48,6 @@ class Source extends BaseObject {
* @param {Options} options Source options.
*/
constructor(options) {
super();
/**
@@ -71,8 +66,10 @@ class Source extends BaseObject {
* @private
* @type {boolean}
*/
this.attributionsCollapsible_ = options.attributionsCollapsible !== undefined ?
options.attributionsCollapsible : true;
this.attributionsCollapsible_ =
options.attributionsCollapsible !== undefined
? options.attributionsCollapsible
: true;
/**
* This source is currently loading data. Sources that defer loading to the
@@ -85,15 +82,14 @@ class Source extends BaseObject {
* @private
* @type {SourceState}
*/
this.state_ = options.state !== undefined ?
options.state : SourceState.READY;
this.state_ =
options.state !== undefined ? options.state : SourceState.READY;
/**
* @private
* @type {boolean}
*/
this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false;
}
/**
@@ -175,7 +171,6 @@ class Source extends BaseObject {
}
}
/**
* Turns the attributions option into an attributions function.
* @param {AttributionLike|undefined} attributionLike The attribution option.
@@ -186,7 +181,7 @@ function adaptAttributions(attributionLike) {
return null;
}
if (Array.isArray(attributionLike)) {
return function(frameState) {
return function (frameState) {
return attributionLike;
};
}
@@ -195,10 +190,9 @@ function adaptAttributions(attributionLike) {
return attributionLike;
}
return function(frameState) {
return function (frameState) {
return [attributionLike];
};
}
export default Source;