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,64 +1,64 @@
|
||||
import LinkedList from '../../../../src/ol/structs/LinkedList.js';
|
||||
|
||||
describe('ol.structs.LinkedList', function() {
|
||||
describe('ol.structs.LinkedList', function () {
|
||||
let ll;
|
||||
const item = {};
|
||||
const item2 = {};
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
ll = new LinkedList();
|
||||
});
|
||||
|
||||
it('defaults to circular', function() {
|
||||
it('defaults to circular', function () {
|
||||
expect(ll.circular_).to.be(true);
|
||||
});
|
||||
|
||||
it('creates an empty list', function() {
|
||||
it('creates an empty list', function () {
|
||||
expect(ll.length_).to.be(0);
|
||||
expect(ll.first_).to.be(undefined);
|
||||
expect(ll.last_).to.be(undefined);
|
||||
expect(ll.head_).to.be(undefined);
|
||||
});
|
||||
|
||||
describe('#insertItem', function() {
|
||||
beforeEach(function() {
|
||||
describe('#insertItem', function () {
|
||||
beforeEach(function () {
|
||||
ll.insertItem(item);
|
||||
});
|
||||
|
||||
it('inserts an item into the list', function() {
|
||||
it('inserts an item into the list', function () {
|
||||
expect(ll.length_).to.be(1);
|
||||
});
|
||||
|
||||
it('sets the cursor to the inserted item', function() {
|
||||
it('sets the cursor to the inserted item', function () {
|
||||
expect(ll.head_.data).to.be(item);
|
||||
});
|
||||
|
||||
it('links the previous item to the new one', function() {
|
||||
it('links the previous item to the new one', function () {
|
||||
ll.insertItem(item2);
|
||||
expect(ll.head_.prev.data).to.be(item);
|
||||
expect(ll.head_.prev.next.data).to.be(item2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#removeItem', function() {
|
||||
describe('#removeItem', function () {
|
||||
const item3 = {};
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
ll.insertItem(item3);
|
||||
});
|
||||
|
||||
it('removes the current item', function() {
|
||||
it('removes the current item', function () {
|
||||
ll.removeItem();
|
||||
expect(ll.length_).to.be(2);
|
||||
expect(ll.head_.data).not.to.be(item3);
|
||||
});
|
||||
|
||||
it('sets the cursor to the next item if possible', function() {
|
||||
it('sets the cursor to the next item if possible', function () {
|
||||
ll.removeItem();
|
||||
expect(ll.head_.data).to.be(item);
|
||||
});
|
||||
|
||||
it('otherwise sets the cursor to the previous item', function() {
|
||||
it('otherwise sets the cursor to the previous item', function () {
|
||||
ll = new LinkedList(false);
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
@@ -67,7 +67,7 @@ describe('ol.structs.LinkedList', function() {
|
||||
expect(ll.head_.data).to.be(item2);
|
||||
});
|
||||
|
||||
it('empties a list with only one item', function() {
|
||||
it('empties a list with only one item', function () {
|
||||
ll = new LinkedList();
|
||||
ll.insertItem(item);
|
||||
ll.removeItem();
|
||||
@@ -78,8 +78,8 @@ describe('ol.structs.LinkedList', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#firstItem', function() {
|
||||
it('sets the cursor to the first item and returns its data', function() {
|
||||
describe('#firstItem', function () {
|
||||
it('sets the cursor to the first item and returns its data', function () {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
const i = ll.firstItem();
|
||||
@@ -87,14 +87,14 @@ describe('ol.structs.LinkedList', function() {
|
||||
expect(ll.head_.data).to.be(item);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
it('returns undefined on empty list', function () {
|
||||
const i = ll.firstItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#lastItem', function() {
|
||||
it('sets the cursor to the last item and returns its data', function() {
|
||||
describe('#lastItem', function () {
|
||||
it('sets the cursor to the last item and returns its data', function () {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
ll.firstItem();
|
||||
@@ -103,14 +103,14 @@ describe('ol.structs.LinkedList', function() {
|
||||
expect(ll.head_.data).to.be(item2);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
it('returns undefined on empty list', function () {
|
||||
const i = ll.lastItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#nextItem', function() {
|
||||
it('sets the cursor to the next item and returns its data', function() {
|
||||
describe('#nextItem', function () {
|
||||
it('sets the cursor to the next item and returns its data', function () {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
ll.firstItem();
|
||||
@@ -119,14 +119,14 @@ describe('ol.structs.LinkedList', function() {
|
||||
expect(ll.head_.data).to.be(item2);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
it('returns undefined on empty list', function () {
|
||||
const i = ll.nextItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#prevItem', function() {
|
||||
it('sets the cursor to the previous item and returns its data', function() {
|
||||
describe('#prevItem', function () {
|
||||
it('sets the cursor to the previous item and returns its data', function () {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
const i = ll.prevItem();
|
||||
@@ -134,14 +134,14 @@ describe('ol.structs.LinkedList', function() {
|
||||
expect(ll.head_.data).to.be(item);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
it('returns undefined on empty list', function () {
|
||||
const i = ll.prevItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getNextItem', function() {
|
||||
it('returns the data of the next item without stepping the cursor', function() {
|
||||
describe('#getNextItem', function () {
|
||||
it('returns the data of the next item without stepping the cursor', function () {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
ll.firstItem();
|
||||
@@ -150,14 +150,14 @@ describe('ol.structs.LinkedList', function() {
|
||||
expect(ll.head_.data).to.be(item);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
it('returns undefined on empty list', function () {
|
||||
const i = ll.getNextItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getPrevItem', function() {
|
||||
it('returns the data of the previous item without stepping the cursor', function() {
|
||||
describe('#getPrevItem', function () {
|
||||
it('returns the data of the previous item without stepping the cursor', function () {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
const i = ll.getPrevItem();
|
||||
@@ -165,14 +165,14 @@ describe('ol.structs.LinkedList', function() {
|
||||
expect(ll.head_.data).to.be(item2);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
it('returns undefined on empty list', function () {
|
||||
const i = ll.getPrevItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getCurrItem', function() {
|
||||
it('returns the data of the current item', function() {
|
||||
describe('#getCurrItem', function () {
|
||||
it('returns the data of the current item', function () {
|
||||
const item3 = {};
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
@@ -183,14 +183,14 @@ describe('ol.structs.LinkedList', function() {
|
||||
expect(ll.head_.data).to.be(item2);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
it('returns undefined on empty list', function () {
|
||||
const i = ll.getCurrItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getLength', function() {
|
||||
it('returns the length of the list', function() {
|
||||
describe('#getLength', function () {
|
||||
it('returns the length of the list', function () {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
const l = ll.getLength();
|
||||
@@ -198,9 +198,9 @@ describe('ol.structs.LinkedList', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#concat', function() {
|
||||
describe('#concat', function () {
|
||||
let ll2, item3;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
item3 = {};
|
||||
ll2 = new LinkedList();
|
||||
ll2.insertItem(item);
|
||||
@@ -208,7 +208,7 @@ describe('ol.structs.LinkedList', function() {
|
||||
ll2.insertItem(item3);
|
||||
});
|
||||
|
||||
it('concatenates a second list with the current one', function() {
|
||||
it('concatenates a second list with the current one', function () {
|
||||
const item4 = {};
|
||||
const item5 = {};
|
||||
const item6 = {};
|
||||
@@ -223,7 +223,7 @@ describe('ol.structs.LinkedList', function() {
|
||||
expect(ll.head_.next.next.next.next.data).to.be(item6);
|
||||
});
|
||||
|
||||
it('receives the second list if the current one is empty', function() {
|
||||
it('receives the second list if the current one is empty', function () {
|
||||
ll.concat(ll2);
|
||||
expect(ll.length_).to.be(3);
|
||||
expect(ll.first_.data).to.be(item);
|
||||
@@ -231,7 +231,7 @@ describe('ol.structs.LinkedList', function() {
|
||||
expect(ll.head_.data).to.be(item3);
|
||||
});
|
||||
|
||||
it('destroys the second list', function() {
|
||||
it('destroys the second list', function () {
|
||||
ll.concat(ll2);
|
||||
expect(ll2.length_).to.be(0);
|
||||
expect(ll2.first_).to.be(undefined);
|
||||
@@ -240,21 +240,21 @@ describe('ol.structs.LinkedList', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('when circular', function() {
|
||||
beforeEach(function() {
|
||||
describe('when circular', function () {
|
||||
beforeEach(function () {
|
||||
ll = new LinkedList();
|
||||
ll.insertItem(item);
|
||||
});
|
||||
|
||||
describe('#insertItem', function() {
|
||||
it('initializes the list in a circular way', function() {
|
||||
describe('#insertItem', function () {
|
||||
it('initializes the list in a circular way', function () {
|
||||
expect(ll.head_.prev.data).to.be(item);
|
||||
expect(ll.head_.next.data).to.be(item);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#setFirstItem', function() {
|
||||
it('resets the first item to the current one', function() {
|
||||
describe('#setFirstItem', function () {
|
||||
it('resets the first item to the current one', function () {
|
||||
ll.insertItem(item2);
|
||||
ll.setFirstItem();
|
||||
expect(ll.first_.data).to.be(item2);
|
||||
|
||||
Reference in New Issue
Block a user