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:
@@ -4,7 +4,6 @@ import {WORKER_OFFSCREEN_CANVAS} from './has.js';
|
||||
* @module ol/dom
|
||||
*/
|
||||
|
||||
|
||||
//FIXME Move this function to the canvas module
|
||||
/**
|
||||
* Create an html canvas element and returns its 2d context.
|
||||
@@ -14,11 +13,12 @@ import {WORKER_OFFSCREEN_CANVAS} from './has.js';
|
||||
* @return {CanvasRenderingContext2D} The context.
|
||||
*/
|
||||
export function createCanvasContext2D(opt_width, opt_height, opt_canvasPool) {
|
||||
const canvas = opt_canvasPool && opt_canvasPool.length ?
|
||||
opt_canvasPool.shift() :
|
||||
WORKER_OFFSCREEN_CANVAS ?
|
||||
new OffscreenCanvas(opt_width || 300, opt_height || 300) :
|
||||
document.createElement('canvas');
|
||||
const canvas =
|
||||
opt_canvasPool && opt_canvasPool.length
|
||||
? opt_canvasPool.shift()
|
||||
: WORKER_OFFSCREEN_CANVAS
|
||||
? new OffscreenCanvas(opt_width || 300, opt_height || 300)
|
||||
: document.createElement('canvas');
|
||||
if (opt_width) {
|
||||
canvas.width = opt_width;
|
||||
}
|
||||
@@ -29,7 +29,6 @@ export function createCanvasContext2D(opt_width, opt_height, opt_canvasPool) {
|
||||
return /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the current computed width for the given element including margin,
|
||||
* padding and border.
|
||||
@@ -45,7 +44,6 @@ export function outerWidth(element) {
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the current computed height for the given element including margin,
|
||||
* padding and border.
|
||||
|
||||
Reference in New Issue
Block a user