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:
@@ -1,19 +1,17 @@
|
||||
/**
|
||||
* @module ol/Object
|
||||
*/
|
||||
import {getUid} from './util.js';
|
||||
import Event from './events/Event.js';
|
||||
import ObjectEventType from './ObjectEventType.js';
|
||||
import Observable from './Observable.js';
|
||||
import Event from './events/Event.js';
|
||||
import {assign} from './obj.js';
|
||||
|
||||
import {getUid} from './util.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.
|
||||
*/
|
||||
export class ObjectEvent extends Event {
|
||||
|
||||
/**
|
||||
* @param {string} type The event type.
|
||||
* @param {string} key The property name.
|
||||
@@ -36,12 +34,9 @@ export class ObjectEvent extends Event {
|
||||
* @api
|
||||
*/
|
||||
this.oldValue = oldValue;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Abstract base class; normally only used for creating subclasses and not
|
||||
@@ -86,7 +81,6 @@ export class ObjectEvent extends Event {
|
||||
* @api
|
||||
*/
|
||||
class BaseObject extends Observable {
|
||||
|
||||
/**
|
||||
* @param {Object<string, *>=} opt_values An object with key-value pairs.
|
||||
*/
|
||||
@@ -203,22 +197,19 @@ class BaseObject extends Observable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @type {Object<string, string>}
|
||||
*/
|
||||
const changeEventTypeCache = {};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} key Key name.
|
||||
* @return {string} Change name.
|
||||
*/
|
||||
export function getChangeEventType(key) {
|
||||
return changeEventTypeCache.hasOwnProperty(key) ?
|
||||
changeEventTypeCache[key] :
|
||||
(changeEventTypeCache[key] = 'change:' + key);
|
||||
return changeEventTypeCache.hasOwnProperty(key)
|
||||
? changeEventTypeCache[key]
|
||||
: (changeEventTypeCache[key] = 'change:' + key);
|
||||
}
|
||||
|
||||
|
||||
export default BaseObject;
|
||||
|
||||
Reference in New Issue
Block a user