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,15 +1,15 @@
|
||||
import {lineStringLength, linearRingLength} from '../../../../../src/ol/geom/flat/length.js';
|
||||
import {
|
||||
lineStringLength,
|
||||
linearRingLength,
|
||||
} from '../../../../../src/ol/geom/flat/length.js';
|
||||
|
||||
|
||||
describe('ol.geom.flat.length', function() {
|
||||
|
||||
describe('ol.geom.flat.length.lineStringLength', function() {
|
||||
|
||||
describe('stride = 2', function() {
|
||||
describe('ol.geom.flat.length', function () {
|
||||
describe('ol.geom.flat.length.lineStringLength', function () {
|
||||
describe('stride = 2', function () {
|
||||
const flatCoords = [0, 0, 1, 0, 1, 1, 0, 1];
|
||||
const stride = 2;
|
||||
|
||||
it('calculates the total length of a lineString', function() {
|
||||
it('calculates the total length of a lineString', function () {
|
||||
const offset = 0;
|
||||
const end = 8;
|
||||
const expected = 3;
|
||||
@@ -17,7 +17,7 @@ describe('ol.geom.flat.length', function() {
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
|
||||
it('calculates a partwise length of a lineString (offset)', function() {
|
||||
it('calculates a partwise length of a lineString (offset)', function () {
|
||||
const offset = 2;
|
||||
const end = 8;
|
||||
const expected = 2;
|
||||
@@ -25,21 +25,20 @@ describe('ol.geom.flat.length', function() {
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
|
||||
it('calculates a partwise length of a lineString (end)', function() {
|
||||
it('calculates a partwise length of a lineString (end)', function () {
|
||||
const offset = 0;
|
||||
const end = 4;
|
||||
const expected = 1;
|
||||
const got = lineStringLength(flatCoords, offset, end, stride);
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('stride = 3', function() {
|
||||
describe('stride = 3', function () {
|
||||
const flatCoords = [0, 0, 42, 1, 0, 42, 1, 1, 42, 0, 1, 42];
|
||||
const stride = 3;
|
||||
|
||||
it('calculates the total length of a lineString', function() {
|
||||
it('calculates the total length of a lineString', function () {
|
||||
const offset = 0;
|
||||
const end = 12;
|
||||
const expected = 3;
|
||||
@@ -47,7 +46,7 @@ describe('ol.geom.flat.length', function() {
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
|
||||
it('calculates a partwise length of a lineString (offset)', function() {
|
||||
it('calculates a partwise length of a lineString (offset)', function () {
|
||||
const offset = 3;
|
||||
const end = 12;
|
||||
const expected = 2;
|
||||
@@ -55,20 +54,18 @@ describe('ol.geom.flat.length', function() {
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
|
||||
it('calculates a partwise length of a lineString (end)', function() {
|
||||
it('calculates a partwise length of a lineString (end)', function () {
|
||||
const offset = 0;
|
||||
const end = 6;
|
||||
const expected = 1;
|
||||
const got = lineStringLength(flatCoords, offset, end, stride);
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
describe('ol.geom.flat.length.linearRingLength', function() {
|
||||
|
||||
it('calculates the total length of a simple linearRing', function() {
|
||||
describe('ol.geom.flat.length.linearRingLength', function () {
|
||||
it('calculates the total length of a simple linearRing', function () {
|
||||
const flatCoords = [0, 0, 1, 0, 1, 1, 0, 1];
|
||||
const stride = 2;
|
||||
const offset = 0;
|
||||
@@ -78,7 +75,7 @@ describe('ol.geom.flat.length', function() {
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
|
||||
it('calculates the total length of a figure-8 linearRing', function() {
|
||||
it('calculates the total length of a figure-8 linearRing', function () {
|
||||
const flatCoords = [0, 0, 1, 0, 1, 1, 0, 1, 0, -1, -1, -1, -1, 0];
|
||||
const stride = 2;
|
||||
const offset = 0;
|
||||
@@ -87,7 +84,5 @@ describe('ol.geom.flat.length', function() {
|
||||
const got = linearRingLength(flatCoords, offset, end, stride);
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user