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
+24 -18
View File
@@ -2,13 +2,13 @@
* @module ol/source/TileArcGISRest
*/
import TileImage from './TileImage.js';
import {appendParams} from '../uri.js';
import {assign} from '../obj.js';
import {createEmpty} from '../extent.js';
import {modulo} from '../math.js';
import {assign} from '../obj.js';
import {toSize, scale as scaleSize} from '../size.js';
import TileImage from './TileImage.js';
import {scale as scaleSize, toSize} from '../size.js';
import {hash as tileCoordHash} from '../tilecoord.js';
import {appendParams} from '../uri.js';
/**
* @typedef {Object} Options
@@ -51,7 +51,6 @@ import {appendParams} from '../uri.js';
* Service supports multiple urls for export requests.
*/
/**
* @classdesc
* Layer source for tile data from ArcGIS Rest services. Map and Image
@@ -66,7 +65,6 @@ class TileArcGISRest extends TileImage {
* @param {Options=} opt_options Tile ArcGIS Rest options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
super({
@@ -82,7 +80,7 @@ class TileArcGISRest extends TileImage {
url: options.url,
urls: options.urls,
wrapX: options.wrapX !== undefined ? options.wrapX : true,
transition: options.transition
transition: options.transition,
});
/**
@@ -139,8 +137,14 @@ class TileArcGISRest extends TileImage {
* @return {string|undefined} Request URL.
* @private
*/
getRequestUrl_(tileCoord, tileSize, tileExtent, pixelRatio, projection, params) {
getRequestUrl_(
tileCoord,
tileSize,
tileExtent,
pixelRatio,
projection,
params
) {
const urls = this.urls;
if (!urls) {
return undefined;
@@ -199,7 +203,6 @@ class TileArcGISRest extends TileImage {
* @this {TileArcGISRest}
*/
function tileUrlFunction(tileCoord, pixelRatio, projection) {
let tileGrid = this.getTileGrid();
if (!tileGrid) {
tileGrid = this.getTileGridForProjection(projection);
@@ -213,10 +216,8 @@ function tileUrlFunction(tileCoord, pixelRatio, projection) {
pixelRatio = 1;
}
const tileExtent = tileGrid.getTileCoordExtent(
tileCoord, this.tmpExtent_);
let tileSize = toSize(
tileGrid.getTileSize(tileCoord[0]), this.tmpSize);
const tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent_);
let tileSize = toSize(tileGrid.getTileSize(tileCoord[0]), this.tmpSize);
if (pixelRatio != 1) {
tileSize = scaleSize(tileSize, pixelRatio, this.tmpSize);
@@ -226,13 +227,18 @@ function tileUrlFunction(tileCoord, pixelRatio, projection) {
const baseParams = {
'F': 'image',
'FORMAT': 'PNG32',
'TRANSPARENT': true
'TRANSPARENT': true,
};
assign(baseParams, this.params_);
return this.getRequestUrl_(tileCoord, tileSize, tileExtent,
pixelRatio, projection, baseParams);
return this.getRequestUrl_(
tileCoord,
tileSize,
tileExtent,
pixelRatio,
projection,
baseParams
);
}
export default TileArcGISRest;