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,64 +1,59 @@
import {Map, View} from '../../../../src/ol/index.js';
import EventTarget from '../../../../src/ol/events/Target.js';
import Interaction, {zoomByDelta} from '../../../../src/ol/interaction/Interaction.js';
import Interaction, {
zoomByDelta,
} from '../../../../src/ol/interaction/Interaction.js';
import {FALSE} from '../../../../src/ol/functions.js';
import {useGeographic, clearUserProjection} from '../../../../src/ol/proj.js';
import {Map, View} from '../../../../src/ol/index.js';
import {clearUserProjection, useGeographic} from '../../../../src/ol/proj.js';
describe('ol.interaction.Interaction', function() {
describe('constructor', function() {
describe('ol.interaction.Interaction', function () {
describe('constructor', function () {
let interaction;
beforeEach(function() {
beforeEach(function () {
interaction = new Interaction({});
});
it('creates a new interaction', function() {
it('creates a new interaction', function () {
expect(interaction).to.be.a(Interaction);
expect(interaction).to.be.a(EventTarget);
});
it('creates an active interaction', function() {
it('creates an active interaction', function () {
expect(interaction.getActive()).to.be(true);
});
});
describe('#getMap()', function() {
it('retrieves the associated map', function() {
describe('#getMap()', function () {
it('retrieves the associated map', function () {
const map = new Map({});
const interaction = new Interaction({});
interaction.setMap(map);
expect(interaction.getMap()).to.be(map);
});
it('returns null if no map', function() {
it('returns null if no map', function () {
const interaction = new Interaction({});
expect(interaction.getMap()).to.be(null);
});
});
describe('#setMap()', function() {
it('allows a map to be set', function() {
describe('#setMap()', function () {
it('allows a map to be set', function () {
const map = new Map({});
const interaction = new Interaction({});
interaction.setMap(map);
expect(interaction.getMap()).to.be(map);
});
it('accepts null', function() {
it('accepts null', function () {
const interaction = new Interaction({});
interaction.setMap(null);
expect(interaction.getMap()).to.be(null);
});
});
describe('#handleEvent()', function() {
describe('#handleEvent()', function () {
class MockInteraction extends Interaction {
constructor() {
super(...arguments);
@@ -68,25 +63,23 @@ describe('ol.interaction.Interaction', function() {
}
}
it('has a default event handler', function() {
it('has a default event handler', function () {
const interaction = new Interaction({});
expect(interaction.handleEvent()).to.be(true);
});
it('allows event handler overrides via options', function() {
it('allows event handler overrides via options', function () {
const interaction = new Interaction({
handleEvent: FALSE
handleEvent: FALSE,
});
expect(interaction.handleEvent()).to.be(false);
});
it('allows event handler overrides via class extension', function() {
it('allows event handler overrides via class extension', function () {
const interaction = new MockInteraction({});
expect(interaction.handleEvent()).to.be(false);
});
});
});
describe('zoomByDelta - useGeographic', () => {
@@ -96,7 +89,7 @@ describe('zoomByDelta - useGeographic', () => {
it('works with a user projection set', () => {
const view = new View({
center: [0, 0],
zoom: 0
zoom: 0,
});
const spy = sinon.spy(view, 'animate');