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,43 +1,44 @@
|
||||
import {defaultLoadFunction} from '../../../src/ol/source/VectorTile.js';
|
||||
import VectorTile from '../../../src/ol/VectorTile.js';
|
||||
import {listen} from '../../../src/ol/events.js';
|
||||
import GeoJSON from '../../../src/ol/format/GeoJSON.js';
|
||||
import MVT from '../../../src/ol/format/MVT.js';
|
||||
import {get as getProjection} from '../../../src/ol/proj.js';
|
||||
import VectorTile from '../../../src/ol/VectorTile.js';
|
||||
import {createXYZ} from '../../../src/ol/tilegrid.js';
|
||||
import {defaultLoadFunction} from '../../../src/ol/source/VectorTile.js';
|
||||
import {get as getProjection} from '../../../src/ol/proj.js';
|
||||
import {listen} from '../../../src/ol/events.js';
|
||||
|
||||
|
||||
describe('ol.VectorTile', function() {
|
||||
|
||||
it('loader reprojects GeoJSON features', function(done) {
|
||||
describe('ol.VectorTile', function () {
|
||||
it('loader reprojects GeoJSON features', function (done) {
|
||||
const format = new GeoJSON();
|
||||
const tile = new VectorTile([0, 0, 0], null, null, format);
|
||||
const url = 'spec/ol/data/point.json';
|
||||
defaultLoadFunction(tile, url);
|
||||
const loader = tile.loader_;
|
||||
listen(tile, 'change', function(e) {
|
||||
expect(tile.getFeatures()[0].getGeometry().getFlatCoordinates()).to.eql([-9724792.346778862, 4164041.638405114]);
|
||||
listen(tile, 'change', function (e) {
|
||||
expect(tile.getFeatures()[0].getGeometry().getFlatCoordinates()).to.eql([
|
||||
-9724792.346778862,
|
||||
4164041.638405114,
|
||||
]);
|
||||
done();
|
||||
});
|
||||
loader.call(tile, [], 1, getProjection('EPSG:3857'));
|
||||
});
|
||||
|
||||
it('loader reprojects MVT features', function(done) {
|
||||
it('loader reprojects MVT features', function (done) {
|
||||
const format = new MVT();
|
||||
const tileGrid = createXYZ({
|
||||
tileSize: 512
|
||||
tileSize: 512,
|
||||
});
|
||||
const tile = new VectorTile([14, 8938, 5680], null, null, format);
|
||||
const url = 'spec/ol/data/14-8938-5680.vector.pbf';
|
||||
defaultLoadFunction(tile, url);
|
||||
const loader = tile.loader_;
|
||||
listen(tile, 'change', function(e) {
|
||||
expect(tile.getFeatures()[1246].getGeometry().getFlatCoordinates()).to.eql([1827804.0218549764, 6144812.116688028]);
|
||||
listen(tile, 'change', function (e) {
|
||||
expect(
|
||||
tile.getFeatures()[1246].getGeometry().getFlatCoordinates()
|
||||
).to.eql([1827804.0218549764, 6144812.116688028]);
|
||||
done();
|
||||
});
|
||||
const extent = tileGrid.getTileCoordExtent(tile.tileCoord);
|
||||
loader.call(tile, extent, 1, getProjection('EPSG:3857'));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user