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,27 +1,26 @@
|
||||
import WebGLArrayBuffer, {getArrayClassForType} from '../../../../src/ol/webgl/Buffer.js';
|
||||
import WebGLArrayBuffer, {
|
||||
getArrayClassForType,
|
||||
} from '../../../../src/ol/webgl/Buffer.js';
|
||||
import {
|
||||
ARRAY_BUFFER,
|
||||
ELEMENT_ARRAY_BUFFER,
|
||||
STATIC_DRAW,
|
||||
STREAM_DRAW
|
||||
STREAM_DRAW,
|
||||
} from '../../../../src/ol/webgl.js';
|
||||
|
||||
|
||||
describe('ol.webgl.Buffer', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('sets the default usage when not specified', function() {
|
||||
describe('ol.webgl.Buffer', function () {
|
||||
describe('constructor', function () {
|
||||
it('sets the default usage when not specified', function () {
|
||||
const b = new WebGLArrayBuffer(ARRAY_BUFFER);
|
||||
expect(b.getUsage()).to.be(STATIC_DRAW);
|
||||
});
|
||||
|
||||
it('sets the given usage when specified', function() {
|
||||
it('sets the given usage when specified', function () {
|
||||
const b = new WebGLArrayBuffer(ARRAY_BUFFER, STREAM_DRAW);
|
||||
expect(b.getUsage()).to.be(STREAM_DRAW);
|
||||
});
|
||||
|
||||
it('raises an error if an incorrect type is used', function(done) {
|
||||
it('raises an error if an incorrect type is used', function (done) {
|
||||
try {
|
||||
new WebGLArrayBuffer(1234);
|
||||
} catch (e) {
|
||||
@@ -31,28 +30,27 @@ describe('ol.webgl.Buffer', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getArrayClassForType', function() {
|
||||
it('returns the correct typed array constructor', function() {
|
||||
describe('#getArrayClassForType', function () {
|
||||
it('returns the correct typed array constructor', function () {
|
||||
expect(getArrayClassForType(ARRAY_BUFFER)).to.be(Float32Array);
|
||||
expect(getArrayClassForType(ELEMENT_ARRAY_BUFFER)).to.be(Uint32Array);
|
||||
});
|
||||
});
|
||||
|
||||
describe('populate methods', function() {
|
||||
|
||||
describe('populate methods', function () {
|
||||
let b;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
b = new WebGLArrayBuffer(ARRAY_BUFFER);
|
||||
});
|
||||
|
||||
it('initializes the array using a size', function() {
|
||||
it('initializes the array using a size', function () {
|
||||
b.ofSize(12);
|
||||
expect(b.getArray().length).to.be(12);
|
||||
expect(b.getArray()[0]).to.be(0);
|
||||
expect(b.getArray()[11]).to.be(0);
|
||||
});
|
||||
|
||||
it('initializes the array using an array', function() {
|
||||
it('initializes the array using an array', function () {
|
||||
b.fromArray([1, 2, 3, 4, 5]);
|
||||
expect(b.getArray().length).to.be(5);
|
||||
expect(b.getArray()[0]).to.be(1);
|
||||
@@ -62,7 +60,7 @@ describe('ol.webgl.Buffer', function() {
|
||||
expect(b.getArray()[4]).to.be(5);
|
||||
});
|
||||
|
||||
it('initializes the array using a size', function() {
|
||||
it('initializes the array using a size', function () {
|
||||
const a = Float32Array.of(1, 2, 3, 4, 5);
|
||||
b.fromArrayBuffer(a.buffer);
|
||||
expect(b.getArray().length).to.be(5);
|
||||
@@ -72,24 +70,21 @@ describe('ol.webgl.Buffer', function() {
|
||||
expect(b.getArray()[3]).to.be(4);
|
||||
expect(b.getArray()[4]).to.be(5);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#getSize', function() {
|
||||
describe('#getSize', function () {
|
||||
let b;
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
b = new WebGLArrayBuffer(ARRAY_BUFFER);
|
||||
});
|
||||
|
||||
it('returns 0 when the buffer array is not initialized', function() {
|
||||
it('returns 0 when the buffer array is not initialized', function () {
|
||||
expect(b.getSize()).to.be(0);
|
||||
});
|
||||
|
||||
it('returns the size of the array otherwise', function() {
|
||||
it('returns the size of the array otherwise', function () {
|
||||
b.ofSize(12);
|
||||
expect(b.getSize()).to.be(12);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user