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:
+19
-25
@@ -1,28 +1,28 @@
|
||||
import {hasArea, toSize, buffer as bufferSize, scale as scaleSize} from '../../../src/ol/size.js';
|
||||
import {
|
||||
buffer as bufferSize,
|
||||
hasArea,
|
||||
scale as scaleSize,
|
||||
toSize,
|
||||
} from '../../../src/ol/size.js';
|
||||
|
||||
|
||||
describe('ol.size', function() {
|
||||
|
||||
describe('buffer()', function() {
|
||||
|
||||
it('buffers a size', function() {
|
||||
describe('ol.size', function () {
|
||||
describe('buffer()', function () {
|
||||
it('buffers a size', function () {
|
||||
const size = [50, 75];
|
||||
const bufferedSize = bufferSize(size, 20);
|
||||
expect(bufferedSize).to.eql([90, 115]);
|
||||
});
|
||||
|
||||
it('reuses an existing array', function() {
|
||||
it('reuses an existing array', function () {
|
||||
const reuse = [0, 0];
|
||||
const size = [50, 50];
|
||||
const bufferedSize = bufferSize(size, 20, reuse);
|
||||
expect(bufferedSize).to.equal(reuse);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('hasArea()', function() {
|
||||
|
||||
it('determines if a size has a positive area', function() {
|
||||
describe('hasArea()', function () {
|
||||
it('determines if a size has a positive area', function () {
|
||||
expect(hasArea([50, 75])).to.equal(true);
|
||||
expect(hasArea([0, 75])).to.equal(false);
|
||||
expect(hasArea([50, 0])).to.equal(false);
|
||||
@@ -31,47 +31,41 @@ describe('ol.size', function() {
|
||||
expect(hasArea([50, -1])).to.equal(false);
|
||||
expect(hasArea([-1, -1])).to.equal(false);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('scale()', function() {
|
||||
|
||||
it('scales a size and rounds the result', function() {
|
||||
describe('scale()', function () {
|
||||
it('scales a size and rounds the result', function () {
|
||||
const size = [50, 75];
|
||||
const scaledSize = scaleSize(size, 1.75);
|
||||
expect(scaledSize).to.eql([88, 131]);
|
||||
});
|
||||
|
||||
it('reuses an existing array', function() {
|
||||
it('reuses an existing array', function () {
|
||||
const reuse = [0, 0];
|
||||
const size = [50, 50];
|
||||
const scaledSize = scaleSize(size, 1.75, reuse);
|
||||
expect(scaledSize).to.equal(reuse);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('toSize()', function() {
|
||||
|
||||
it('creates a size array from a number', function() {
|
||||
describe('toSize()', function () {
|
||||
it('creates a size array from a number', function () {
|
||||
const size = toSize(512);
|
||||
expect(size).to.eql([512, 512]);
|
||||
});
|
||||
|
||||
it('reuses an existing array', function() {
|
||||
it('reuses an existing array', function () {
|
||||
const sizeArray = [0, 0];
|
||||
const size = toSize(512, sizeArray);
|
||||
expect(size).to.equal(sizeArray);
|
||||
});
|
||||
|
||||
it('returns a size array unaltered', function() {
|
||||
it('returns a size array unaltered', function () {
|
||||
const sizeArray = [512, 256];
|
||||
let size = toSize(sizeArray);
|
||||
expect(size).to.equal(sizeArray);
|
||||
size = toSize(sizeArray, [0, 0]);
|
||||
expect(size).to.equal(sizeArray);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user