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,33 +1,36 @@
import Static from '../../../../src/ol/source/ImageStatic.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
describe('ol.source.ImageStatic', function() {
describe('ol.source.ImageStatic', function () {
let extent, pixelRatio, projection, resolution;
beforeEach(function() {
beforeEach(function () {
extent = [
-13637278.73946974, 4543799.13271362,
-13617443.330629736, 4553927.038961405];
-13637278.73946974,
4543799.13271362,
-13617443.330629736,
4553927.038961405,
];
pixelRatio = 1;
projection = getProjection('EPSG:3857');
resolution = 38;
});
describe('#getImage', function() {
it('scales image to fit imageExtent', function(done) {
describe('#getImage', function () {
it('scales image to fit imageExtent', function (done) {
const source = new Static({
url: 'spec/ol/source/images/12-655-1583.png',
imageExtent: [
-13629027.891360067, 4539747.983913189,
-13619243.951739565, 4559315.863154193],
projection: projection
-13629027.891360067,
4539747.983913189,
-13619243.951739565,
4559315.863154193,
],
projection: projection,
});
const image = source.getImage(extent, resolution, pixelRatio, projection);
source.on('imageloadend', function(event) {
source.on('imageloadend', function (event) {
expect(image.getImage().width).to.be(128);
expect(image.getImage().height).to.be(256);
done();
@@ -36,19 +39,22 @@ describe('ol.source.ImageStatic', function() {
image.load();
});
it('respects imageSize', function(done) {
it('respects imageSize', function (done) {
const source = new Static({
url: 'spec/ol/source/images/12-655-1583.png',
imageExtent: [
-13629027.891360067, 4539747.983913189,
-13619243.951739565, 4559315.863154193],
-13629027.891360067,
4539747.983913189,
-13619243.951739565,
4559315.863154193,
],
imageSize: [254, 254],
projection: projection
projection: projection,
});
const image = source.getImage(extent, resolution, pixelRatio, projection);
source.on('imageloadend', function(event) {
source.on('imageloadend', function (event) {
expect(image.getImage().width).to.be(127);
expect(image.getImage().height).to.be(254);
done();
@@ -57,13 +63,16 @@ describe('ol.source.ImageStatic', function() {
image.load();
});
it('triggers image load events', function(done) {
it('triggers image load events', function (done) {
const source = new Static({
url: 'spec/ol/source/images/12-655-1583.png',
imageExtent: [
-13629027.891360067, 4539747.983913189,
-13619243.951739565, 4549531.923533691],
projection: projection
-13629027.891360067,
4539747.983913189,
-13619243.951739565,
4549531.923533691,
],
projection: projection,
});
const imageloadstart = sinon.spy();
@@ -71,7 +80,7 @@ describe('ol.source.ImageStatic', function() {
source.on('imageloadstart', imageloadstart);
source.on('imageloaderror', imageloaderror);
source.on('imageloadend', function(event) {
source.on('imageloadend', function (event) {
expect(imageloadstart.callCount).to.be(1);
expect(imageloaderror.callCount).to.be(0);
done();