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 XYZ from './XYZ.js';
|
||||
|
||||
|
||||
/**
|
||||
* The attribution containing a link to the OpenStreetMap Copyright and License
|
||||
* page.
|
||||
@@ -12,10 +11,10 @@ import XYZ from './XYZ.js';
|
||||
* @type {string}
|
||||
* @api
|
||||
*/
|
||||
export const ATTRIBUTION = '© ' +
|
||||
'<a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> ' +
|
||||
'contributors.';
|
||||
|
||||
export const ATTRIBUTION =
|
||||
'© ' +
|
||||
'<a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> ' +
|
||||
'contributors.';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
@@ -40,7 +39,6 @@ export const ATTRIBUTION = '© ' +
|
||||
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Layer source for the OpenStreetMap tile server.
|
||||
@@ -51,7 +49,6 @@ class OSM extends XYZ {
|
||||
* @param {Options=} [opt_options] Open Street Map options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
const options = opt_options || {};
|
||||
|
||||
let attributions;
|
||||
@@ -61,11 +58,13 @@ class OSM extends XYZ {
|
||||
attributions = [ATTRIBUTION];
|
||||
}
|
||||
|
||||
const crossOrigin = options.crossOrigin !== undefined ?
|
||||
options.crossOrigin : 'anonymous';
|
||||
const crossOrigin =
|
||||
options.crossOrigin !== undefined ? options.crossOrigin : 'anonymous';
|
||||
|
||||
const url = options.url !== undefined ?
|
||||
options.url : 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
const url =
|
||||
options.url !== undefined
|
||||
? options.url
|
||||
: 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
|
||||
super({
|
||||
attributions: attributions,
|
||||
@@ -78,11 +77,9 @@ class OSM extends XYZ {
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
url: url,
|
||||
wrapX: options.wrapX,
|
||||
attributionsCollapsible: false
|
||||
attributionsCollapsible: false,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default OSM;
|
||||
|
||||
Reference in New Issue
Block a user