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,28 +1,26 @@
import {get as getProjection} from '../../../../src/ol/proj.js';
import Source from '../../../../src/ol/source/Source.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
describe('ol.source.Source', function() {
describe('constructor', function() {
it('returns a source', function() {
describe('ol.source.Source', function () {
describe('constructor', function () {
it('returns a source', function () {
const source = new Source({
projection: getProjection('EPSG:4326')
projection: getProjection('EPSG:4326'),
});
expect(source).to.be.a(Source);
});
});
describe('config option `attributions`', function() {
it('accepts undefined', function() {
describe('config option `attributions`', function () {
it('accepts undefined', function () {
const source = new Source({});
const attributions = source.getAttributions();
expect(attributions).to.be(null);
});
it('accepts a single string', function() {
it('accepts a single string', function () {
const source = new Source({
attributions: 'Humpty'
attributions: 'Humpty',
});
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
@@ -30,9 +28,9 @@ describe('ol.source.Source', function() {
expect(attributions()).to.eql(['Humpty']);
});
it('accepts an array of strings', function() {
it('accepts an array of strings', function () {
const source = new Source({
attributions: ['Humpty', 'Dumpty']
attributions: ['Humpty', 'Dumpty'],
});
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
@@ -40,11 +38,11 @@ describe('ol.source.Source', function() {
expect(attributions()).to.eql(['Humpty', 'Dumpty']);
});
it('accepts a function that returns a string', function() {
it('accepts a function that returns a string', function () {
const source = new Source({
attributions: function() {
attributions: function () {
return 'Humpty';
}
},
});
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
@@ -52,11 +50,11 @@ describe('ol.source.Source', function() {
expect(attributions()).to.be('Humpty');
});
it('accepts a function that returns an array of strings', function() {
it('accepts a function that returns an array of strings', function () {
const source = new Source({
attributions: function() {
attributions: function () {
return ['Humpty', 'Dumpty'];
}
},
});
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
@@ -65,10 +63,10 @@ describe('ol.source.Source', function() {
});
});
describe('#refresh()', function() {
it('dispatches the change event', function() {
describe('#refresh()', function () {
it('dispatches the change event', function () {
const source = new Source({
projection: getProjection('EPSG:4326')
projection: getProjection('EPSG:4326'),
});
const changedSpy = sinon.spy();
source.on('change', changedSpy);
@@ -77,26 +75,26 @@ describe('ol.source.Source', function() {
});
});
describe('#setAttributions()', function() {
describe('#setAttributions()', function () {
let source = null;
beforeEach(function() {
beforeEach(function () {
source = new Source({
attributions: 'before'
attributions: 'before',
});
});
afterEach(function() {
afterEach(function () {
source = null;
});
it('accepts undefined', function() {
it('accepts undefined', function () {
source.setAttributions();
const attributions = source.getAttributions();
expect(attributions).to.be(null);
});
it('accepts a single string', function() {
it('accepts a single string', function () {
source.setAttributions('Humpty');
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
@@ -104,7 +102,7 @@ describe('ol.source.Source', function() {
expect(attributions()).to.eql(['Humpty']);
});
it('accepts an array of strings', function() {
it('accepts an array of strings', function () {
source.setAttributions(['Humpty', 'Dumpty']);
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
@@ -112,8 +110,8 @@ describe('ol.source.Source', function() {
expect(attributions()).to.eql(['Humpty', 'Dumpty']);
});
it('accepts a function that returns a string', function() {
source.setAttributions(function() {
it('accepts a function that returns a string', function () {
source.setAttributions(function () {
return 'Humpty';
});
const attributions = source.getAttributions();
@@ -122,8 +120,8 @@ describe('ol.source.Source', function() {
expect(attributions()).to.eql('Humpty');
});
it('accepts a function that returns an array of strings', function() {
source.setAttributions(function() {
it('accepts a function that returns an array of strings', function () {
source.setAttributions(function () {
return ['Humpty', 'Dumpty'];
});
const attributions = source.getAttributions();
@@ -132,5 +130,4 @@ describe('ol.source.Source', function() {
expect(attributions()).to.eql(['Humpty', 'Dumpty']);
});
});
});