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

View File

@@ -1,11 +1,11 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import GeoJSON from '../src/ol/format/GeoJSON.js';
import Layer from '../src/ol/layer/Layer.js';
import {toLonLat, fromLonLat} from '../src/ol/proj.js';
import {Stroke, Style} from '../src/ol/style.js';
import Map from '../src/ol/Map.js';
import VectorLayer from '../src/ol/layer/Vector.js';
import VectorSource from '../src/ol/source/Vector.js';
import GeoJSON from '../src/ol/format/GeoJSON.js';
import View from '../src/ol/View.js';
import {Stroke, Style} from '../src/ol/style.js';
import {fromLonLat, toLonLat} from '../src/ol/proj.js';
const center = [-98.8, 37.9];
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
@@ -23,11 +23,11 @@ const mbMap = new mapboxgl.Map({
keyboard: false,
pitchWithRotate: false,
scrollZoom: false,
touchZoomRotate: false
touchZoomRotate: false,
});
const mbLayer = new Layer({
render: function(frameState) {
render: function (frameState) {
const canvas = mbMap.getCanvas();
const viewState = frameState.viewState;
@@ -40,14 +40,14 @@ const mbLayer = new Layer({
// adjust view parameters in mapbox
const rotation = viewState.rotation;
if (rotation) {
mbMap.rotateTo(-rotation * 180 / Math.PI, {
animate: false
mbMap.rotateTo((-rotation * 180) / Math.PI, {
animate: false,
});
}
mbMap.jumpTo({
center: toLonLat(viewState.center),
zoom: viewState.zoom - 1,
animate: false
animate: false,
});
// cancel the scheduled update & trigger synchronous redraw
@@ -60,29 +60,29 @@ const mbLayer = new Layer({
mbMap._render();
return canvas;
}
},
});
const style = new Style({
stroke: new Stroke({
color: '#319FD3',
width: 2
})
width: 2,
}),
});
const vectorLayer = new VectorLayer({
source: new VectorSource({
url: 'data/geojson/countries.geojson',
format: new GeoJSON()
format: new GeoJSON(),
}),
style: style
style: style,
});
const map = new Map({
target: 'map',
view: new View({
center: fromLonLat(center),
zoom: 4
zoom: 4,
}),
layers: [mbLayer, vectorLayer]
layers: [mbLayer, vectorLayer],
});