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,43 +1,63 @@
import {calculateSourceResolution} from '../../../../src/ol/reproj.js';
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
describe('ol.reproj', function() {
describe('#calculateSourceResolution', function() {
describe('ol.reproj', function () {
describe('#calculateSourceResolution', function () {
const proj3857 = getProjection('EPSG:3857');
const proj4326 = getProjection('EPSG:4326');
const origin = [0, 0];
const point3857 = [50, 40];
const point4326 = transform(point3857, proj3857, proj4326);
it('is identity for identical projection', function() {
it('is identity for identical projection', function () {
let result;
const resolution = 500;
result = calculateSourceResolution(
proj3857, proj3857, origin, resolution);
proj3857,
proj3857,
origin,
resolution
);
expect(result).to.be(resolution);
result = calculateSourceResolution(
proj3857, proj3857, point3857, resolution);
proj3857,
proj3857,
point3857,
resolution
);
expect(result).to.be(resolution);
result = calculateSourceResolution(
proj4326, proj4326, point4326, resolution);
proj4326,
proj4326,
point4326,
resolution
);
expect(result).to.be(resolution);
});
it('calculates correctly', function() {
it('calculates correctly', function () {
const resolution4326 = 5;
const resolution3857 = calculateSourceResolution(
proj3857, proj4326, point4326, resolution4326);
proj3857,
proj4326,
point4326,
resolution4326
);
expect(resolution3857).not.to.be(resolution4326);
expect(resolution3857).to.roughlyEqual(
5 * proj4326.getMetersPerUnit(), 1e-4);
5 * proj4326.getMetersPerUnit(),
1e-4
);
const result = calculateSourceResolution(
proj4326, proj3857, point3857, resolution3857);
proj4326,
proj3857,
point3857,
resolution3857
);
expect(result).to.be(resolution4326);
});
});