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:
@@ -5,7 +5,6 @@ import {assert} from './asserts.js';
|
||||
import {modulo} from './math.js';
|
||||
import {hash as tileCoordHash} from './tilecoord.js';
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} template Template.
|
||||
* @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
|
||||
@@ -23,14 +22,15 @@ export function createFromTemplate(template, tileGrid) {
|
||||
* @param {import("./proj/Projection.js").default} projection Projection.
|
||||
* @return {string|undefined} Tile URL.
|
||||
*/
|
||||
function(tileCoord, pixelRatio, projection) {
|
||||
function (tileCoord, pixelRatio, projection) {
|
||||
if (!tileCoord) {
|
||||
return undefined;
|
||||
} else {
|
||||
return template.replace(zRegEx, tileCoord[0].toString())
|
||||
return template
|
||||
.replace(zRegEx, tileCoord[0].toString())
|
||||
.replace(xRegEx, tileCoord[1].toString())
|
||||
.replace(yRegEx, tileCoord[2].toString())
|
||||
.replace(dashYRegEx, function() {
|
||||
.replace(dashYRegEx, function () {
|
||||
const z = tileCoord[0];
|
||||
const range = tileGrid.getFullTileRange(z);
|
||||
assert(range, 55); // The {-y} placeholder requires a tile grid with extent
|
||||
@@ -42,7 +42,6 @@ export function createFromTemplate(template, tileGrid) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array<string>} templates Templates.
|
||||
* @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
|
||||
@@ -57,7 +56,6 @@ export function createFromTemplates(templates, tileGrid) {
|
||||
return createFromTileUrlFunctions(tileUrlFunctions);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array<import("./Tile.js").UrlFunction>} tileUrlFunctions Tile URL Functions.
|
||||
* @return {import("./Tile.js").UrlFunction} Tile URL function.
|
||||
@@ -73,7 +71,7 @@ export function createFromTileUrlFunctions(tileUrlFunctions) {
|
||||
* @param {import("./proj/Projection.js").default} projection Projection.
|
||||
* @return {string|undefined} Tile URL.
|
||||
*/
|
||||
function(tileCoord, pixelRatio, projection) {
|
||||
function (tileCoord, pixelRatio, projection) {
|
||||
if (!tileCoord) {
|
||||
return undefined;
|
||||
} else {
|
||||
@@ -85,7 +83,6 @@ export function createFromTileUrlFunctions(tileUrlFunctions) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
@@ -96,7 +93,6 @@ export function nullTileUrlFunction(tileCoord, pixelRatio, projection) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} url URL.
|
||||
* @return {Array<string>} Array of urls.
|
||||
|
||||
Reference in New Issue
Block a user