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
+32 -33
View File
@@ -2,9 +2,8 @@
* @module ol/source/Stamen
*/
import {ATTRIBUTION as OSM_ATTRIBUTION} from './OSM.js';
import XYZ from './XYZ.js';
import {ATTRIBUTION as OSM_ATTRIBUTION} from './OSM.js';
/**
* @const
@@ -12,82 +11,79 @@ import XYZ from './XYZ.js';
*/
const ATTRIBUTIONS = [
'Map tiles by <a href="https://stamen.com/" target="_blank">Stamen Design</a>, ' +
'under <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC BY' +
' 3.0</a>.',
OSM_ATTRIBUTION
'under <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC BY' +
' 3.0</a>.',
OSM_ATTRIBUTION,
];
/**
* @type {Object<string, {extension: string, opaque: boolean}>}
*/
const LayerConfig = {
'terrain': {
extension: 'jpg',
opaque: true
opaque: true,
},
'terrain-background': {
extension: 'jpg',
opaque: true
opaque: true,
},
'terrain-labels': {
extension: 'png',
opaque: false
opaque: false,
},
'terrain-lines': {
extension: 'png',
opaque: false
opaque: false,
},
'toner-background': {
extension: 'png',
opaque: true
opaque: true,
},
'toner': {
extension: 'png',
opaque: true
opaque: true,
},
'toner-hybrid': {
extension: 'png',
opaque: false
opaque: false,
},
'toner-labels': {
extension: 'png',
opaque: false
opaque: false,
},
'toner-lines': {
extension: 'png',
opaque: false
opaque: false,
},
'toner-lite': {
extension: 'png',
opaque: true
opaque: true,
},
'watercolor': {
extension: 'jpg',
opaque: true
}
opaque: true,
},
};
/**
* @type {Object<string, {minZoom: number, maxZoom: number}>}
*/
const ProviderConfig = {
'terrain': {
minZoom: 0,
maxZoom: 18
maxZoom: 18,
},
'toner': {
minZoom: 0,
maxZoom: 20
maxZoom: 20,
},
'watercolor': {
minZoom: 0,
maxZoom: 18
}
maxZoom: 18,
},
};
/**
* @typedef {Object} Options
* @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
@@ -110,7 +106,6 @@ const ProviderConfig = {
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
*/
/**
* @classdesc
* Layer source for the Stamen tile server.
@@ -127,27 +122,31 @@ class Stamen extends XYZ {
const layerConfig = LayerConfig[options.layer];
const url = options.url !== undefined ? options.url :
'https://stamen-tiles-{a-d}.a.ssl.fastly.net/' + options.layer +
'/{z}/{x}/{y}.' + layerConfig.extension;
const url =
options.url !== undefined
? options.url
: 'https://stamen-tiles-{a-d}.a.ssl.fastly.net/' +
options.layer +
'/{z}/{x}/{y}.' +
layerConfig.extension;
super({
attributions: ATTRIBUTIONS,
cacheSize: options.cacheSize,
crossOrigin: 'anonymous',
imageSmoothing: options.imageSmoothing,
maxZoom: options.maxZoom != undefined ? options.maxZoom : providerConfig.maxZoom,
minZoom: options.minZoom != undefined ? options.minZoom : providerConfig.minZoom,
maxZoom:
options.maxZoom != undefined ? options.maxZoom : providerConfig.maxZoom,
minZoom:
options.minZoom != undefined ? options.minZoom : providerConfig.minZoom,
opaque: layerConfig.opaque,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileLoadFunction: options.tileLoadFunction,
transition: options.transition,
url: url,
wrapX: options.wrapX
wrapX: options.wrapX,
});
}
}
export default Stamen;