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,114 +1,135 @@
|
||||
import {coordinates as reverseCoordinates} from '../../../../../src/ol/geom/flat/reverse.js';
|
||||
|
||||
|
||||
describe('ol.geom.flat.reverse', function() {
|
||||
|
||||
describe('ol.geom.flat.reverse.coordinates', function() {
|
||||
|
||||
describe('with a stride of 2', function() {
|
||||
|
||||
it('can reverse empty flat coordinates', function() {
|
||||
describe('ol.geom.flat.reverse', function () {
|
||||
describe('ol.geom.flat.reverse.coordinates', function () {
|
||||
describe('with a stride of 2', function () {
|
||||
it('can reverse empty flat coordinates', function () {
|
||||
const flatCoordinates = [];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 2);
|
||||
expect(flatCoordinates).to.be.empty();
|
||||
});
|
||||
|
||||
it('can reverse one flat coordinates', function() {
|
||||
it('can reverse one flat coordinates', function () {
|
||||
const flatCoordinates = [1, 2];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 2);
|
||||
expect(flatCoordinates).to.eql([1, 2]);
|
||||
});
|
||||
|
||||
it('can reverse two flat coordinates', function() {
|
||||
it('can reverse two flat coordinates', function () {
|
||||
const flatCoordinates = [1, 2, 3, 4];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 2);
|
||||
expect(flatCoordinates).to.eql([3, 4, 1, 2]);
|
||||
});
|
||||
|
||||
it('can reverse three flat coordinates', function() {
|
||||
it('can reverse three flat coordinates', function () {
|
||||
const flatCoordinates = [1, 2, 3, 4, 5, 6];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 2);
|
||||
expect(flatCoordinates).to.eql([5, 6, 3, 4, 1, 2]);
|
||||
});
|
||||
|
||||
it('can reverse four flat coordinates', function() {
|
||||
it('can reverse four flat coordinates', function () {
|
||||
const flatCoordinates = [1, 2, 3, 4, 5, 6, 7, 8];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 2);
|
||||
expect(flatCoordinates).to.eql([7, 8, 5, 6, 3, 4, 1, 2]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('with a stride of 3', function() {
|
||||
|
||||
it('can reverse empty flat coordinates', function() {
|
||||
describe('with a stride of 3', function () {
|
||||
it('can reverse empty flat coordinates', function () {
|
||||
const flatCoordinates = [];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 3);
|
||||
expect(flatCoordinates).to.be.empty();
|
||||
});
|
||||
|
||||
it('can reverse one flat coordinates', function() {
|
||||
it('can reverse one flat coordinates', function () {
|
||||
const flatCoordinates = [1, 2, 3];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 3);
|
||||
expect(flatCoordinates).to.eql([1, 2, 3]);
|
||||
});
|
||||
|
||||
it('can reverse two flat coordinates', function() {
|
||||
it('can reverse two flat coordinates', function () {
|
||||
const flatCoordinates = [1, 2, 3, 4, 5, 6];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 3);
|
||||
expect(flatCoordinates).to.eql([4, 5, 6, 1, 2, 3]);
|
||||
});
|
||||
|
||||
it('can reverse three flat coordinates', function() {
|
||||
it('can reverse three flat coordinates', function () {
|
||||
const flatCoordinates = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 3);
|
||||
expect(flatCoordinates).to.eql([7, 8, 9, 4, 5, 6, 1, 2, 3]);
|
||||
});
|
||||
|
||||
it('can reverse four flat coordinates', function() {
|
||||
it('can reverse four flat coordinates', function () {
|
||||
const flatCoordinates = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 3);
|
||||
expect(flatCoordinates).to.eql([10, 11, 12, 7, 8, 9, 4, 5, 6, 1, 2, 3]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('with a stride of 4', function() {
|
||||
|
||||
it('can reverse empty flat coordinates', function() {
|
||||
describe('with a stride of 4', function () {
|
||||
it('can reverse empty flat coordinates', function () {
|
||||
const flatCoordinates = [];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 4);
|
||||
expect(flatCoordinates).to.be.empty();
|
||||
});
|
||||
|
||||
it('can reverse one flat coordinates', function() {
|
||||
it('can reverse one flat coordinates', function () {
|
||||
const flatCoordinates = [1, 2, 3, 4];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 4);
|
||||
expect(flatCoordinates).to.eql([1, 2, 3, 4]);
|
||||
});
|
||||
|
||||
it('can reverse two flat coordinates', function() {
|
||||
it('can reverse two flat coordinates', function () {
|
||||
const flatCoordinates = [1, 2, 3, 4, 5, 6, 7, 8];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 4);
|
||||
expect(flatCoordinates).to.eql([5, 6, 7, 8, 1, 2, 3, 4]);
|
||||
});
|
||||
|
||||
it('can reverse three flat coordinates', function() {
|
||||
it('can reverse three flat coordinates', function () {
|
||||
const flatCoordinates = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 4);
|
||||
expect(flatCoordinates).to.eql([9, 10, 11, 12, 5, 6, 7, 8, 1, 2, 3, 4]);
|
||||
});
|
||||
|
||||
it('can reverse four flat coordinates', function() {
|
||||
const flatCoordinates =
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
|
||||
it('can reverse four flat coordinates', function () {
|
||||
const flatCoordinates = [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
];
|
||||
reverseCoordinates(flatCoordinates, 0, flatCoordinates.length, 4);
|
||||
expect(flatCoordinates).to.eql(
|
||||
[13, 14, 15, 16, 9, 10, 11, 12, 5, 6, 7, 8, 1, 2, 3, 4]);
|
||||
expect(flatCoordinates).to.eql([
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user