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:
@@ -1,72 +1,76 @@
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import Point from '../src/ol/geom/Point.js';
|
||||
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
||||
import {fromLonLat} from '../src/ol/proj.js';
|
||||
import TileJSON from '../src/ol/source/TileJSON.js';
|
||||
import VectorSource from '../src/ol/source/Vector.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import {Icon, Style} from '../src/ol/style.js';
|
||||
|
||||
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
||||
import {fromLonLat} from '../src/ol/proj.js';
|
||||
|
||||
const rome = new Feature({
|
||||
geometry: new Point(fromLonLat([12.5, 41.9]))
|
||||
geometry: new Point(fromLonLat([12.5, 41.9])),
|
||||
});
|
||||
|
||||
const london = new Feature({
|
||||
geometry: new Point(fromLonLat([-0.12755, 51.507222]))
|
||||
geometry: new Point(fromLonLat([-0.12755, 51.507222])),
|
||||
});
|
||||
|
||||
const madrid = new Feature({
|
||||
geometry: new Point(fromLonLat([-3.683333, 40.4]))
|
||||
geometry: new Point(fromLonLat([-3.683333, 40.4])),
|
||||
});
|
||||
|
||||
rome.setStyle(new Style({
|
||||
image: new Icon({
|
||||
color: '#8959A8',
|
||||
crossOrigin: 'anonymous',
|
||||
imgSize: [20, 20],
|
||||
src: 'data/square.svg'
|
||||
rome.setStyle(
|
||||
new Style({
|
||||
image: new Icon({
|
||||
color: '#8959A8',
|
||||
crossOrigin: 'anonymous',
|
||||
imgSize: [20, 20],
|
||||
src: 'data/square.svg',
|
||||
}),
|
||||
})
|
||||
}));
|
||||
);
|
||||
|
||||
london.setStyle(new Style({
|
||||
image: new Icon({
|
||||
color: '#4271AE',
|
||||
crossOrigin: 'anonymous',
|
||||
src: 'data/dot.png'
|
||||
london.setStyle(
|
||||
new Style({
|
||||
image: new Icon({
|
||||
color: '#4271AE',
|
||||
crossOrigin: 'anonymous',
|
||||
src: 'data/dot.png',
|
||||
}),
|
||||
})
|
||||
}));
|
||||
);
|
||||
|
||||
madrid.setStyle(new Style({
|
||||
image: new Icon({
|
||||
color: [113, 140, 0],
|
||||
crossOrigin: 'anonymous',
|
||||
src: 'data/dot.png'
|
||||
madrid.setStyle(
|
||||
new Style({
|
||||
image: new Icon({
|
||||
color: [113, 140, 0],
|
||||
crossOrigin: 'anonymous',
|
||||
src: 'data/dot.png',
|
||||
}),
|
||||
})
|
||||
}));
|
||||
|
||||
);
|
||||
|
||||
const vectorSource = new VectorSource({
|
||||
features: [rome, london, madrid]
|
||||
features: [rome, london, madrid],
|
||||
});
|
||||
|
||||
const vectorLayer = new VectorLayer({
|
||||
source: vectorSource
|
||||
source: vectorSource,
|
||||
});
|
||||
|
||||
const rasterLayer = new TileLayer({
|
||||
source: new TileJSON({
|
||||
url: 'https://a.tiles.mapbox.com/v3/aj.1x1-degrees.json',
|
||||
crossOrigin: ''
|
||||
})
|
||||
crossOrigin: '',
|
||||
}),
|
||||
});
|
||||
|
||||
const map = new Map({
|
||||
layers: [rasterLayer, vectorLayer],
|
||||
target: document.getElementById('map'),
|
||||
view: new View({
|
||||
center: fromLonLat([2.896372, 44.60240]),
|
||||
zoom: 3
|
||||
})
|
||||
center: fromLonLat([2.896372, 44.6024]),
|
||||
zoom: 3,
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user