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:
@@ -3,8 +3,10 @@
|
||||
*/
|
||||
import Layer from './Layer.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {createDefaultStyle, toFunction as toStyleFunction} from '../style/Style.js';
|
||||
|
||||
import {
|
||||
createDefaultStyle,
|
||||
toFunction as toStyleFunction,
|
||||
} from '../style/Style.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
@@ -51,16 +53,14 @@ import {createDefaultStyle, toFunction as toStyleFunction} from '../style/Style.
|
||||
* be recreated during interactions. See also `updateWhileAnimating`.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @private
|
||||
*/
|
||||
const Property = {
|
||||
RENDER_ORDER: 'renderOrder'
|
||||
RENDER_ORDER: 'renderOrder',
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Vector data that is rendered client-side.
|
||||
@@ -91,14 +91,15 @@ class BaseVectorLayer extends Layer {
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.declutter_ = options.declutter !== undefined ? options.declutter : false;
|
||||
this.declutter_ =
|
||||
options.declutter !== undefined ? options.declutter : false;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.renderBuffer_ = options.renderBuffer !== undefined ?
|
||||
options.renderBuffer : 100;
|
||||
this.renderBuffer_ =
|
||||
options.renderBuffer !== undefined ? options.renderBuffer : 100;
|
||||
|
||||
/**
|
||||
* User provided style.
|
||||
@@ -120,16 +121,19 @@ class BaseVectorLayer extends Layer {
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.updateWhileAnimating_ = options.updateWhileAnimating !== undefined ?
|
||||
options.updateWhileAnimating : false;
|
||||
this.updateWhileAnimating_ =
|
||||
options.updateWhileAnimating !== undefined
|
||||
? options.updateWhileAnimating
|
||||
: false;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.updateWhileInteracting_ = options.updateWhileInteracting !== undefined ?
|
||||
options.updateWhileInteracting : false;
|
||||
|
||||
this.updateWhileInteracting_ =
|
||||
options.updateWhileInteracting !== undefined
|
||||
? options.updateWhileInteracting
|
||||
: false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,9 +173,9 @@ class BaseVectorLayer extends Layer {
|
||||
* order.
|
||||
*/
|
||||
getRenderOrder() {
|
||||
return (
|
||||
/** @type {import("../render.js").OrderFunction|null|undefined} */ (this.get(Property.RENDER_ORDER))
|
||||
);
|
||||
return /** @type {import("../render.js").OrderFunction|null|undefined} */ (this.get(
|
||||
Property.RENDER_ORDER
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,12 +234,10 @@ class BaseVectorLayer extends Layer {
|
||||
*/
|
||||
setStyle(style) {
|
||||
this.style_ = style !== undefined ? style : createDefaultStyle;
|
||||
this.styleFunction_ = style === null ?
|
||||
undefined : toStyleFunction(this.style_);
|
||||
this.styleFunction_ =
|
||||
style === null ? undefined : toStyleFunction(this.style_);
|
||||
this.changed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export default BaseVectorLayer;
|
||||
|
||||
Reference in New Issue
Block a user