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,48 +1,51 @@
|
||||
import HeatmapLayer from '../../../../src/ol/layer/Heatmap.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import HeatmapLayer from '../../../../src/ol/layer/Heatmap.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import View from '../../../../src/ol/View.js';
|
||||
|
||||
describe('ol.layer.Heatmap', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
describe('ol.layer.Heatmap', function () {
|
||||
describe('constructor', function () {
|
||||
it('can be constructed without arguments', function () {
|
||||
const instance = new HeatmapLayer();
|
||||
expect(instance).to.be.an(HeatmapLayer);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('hit detection', function() {
|
||||
|
||||
it('hit detects two distinct features', function(done) {
|
||||
describe('hit detection', function () {
|
||||
it('hit detects two distinct features', function (done) {
|
||||
const target = document.createElement('div');
|
||||
target.style.width = '300px';
|
||||
target.style.height = '300px';
|
||||
document.body.appendChild(target);
|
||||
|
||||
const feature = new Feature({geometry: new Point([0, 0]), id: 1, weight: 10});
|
||||
const feature2 = new Feature({geometry: new Point([14, 14]), id: 2, weight: 10});
|
||||
const feature = new Feature({
|
||||
geometry: new Point([0, 0]),
|
||||
id: 1,
|
||||
weight: 10,
|
||||
});
|
||||
const feature2 = new Feature({
|
||||
geometry: new Point([14, 14]),
|
||||
id: 2,
|
||||
weight: 10,
|
||||
});
|
||||
|
||||
const source = new VectorSource({
|
||||
features: [feature, feature2]
|
||||
features: [feature, feature2],
|
||||
});
|
||||
const layer = new HeatmapLayer({
|
||||
source: source,
|
||||
blur: 10,
|
||||
radius: 10
|
||||
radius: 10,
|
||||
});
|
||||
const map = new Map({
|
||||
layers: [layer],
|
||||
view: new View({
|
||||
center: [0, 0],
|
||||
resolution: 0.1
|
||||
resolution: 0.1,
|
||||
}),
|
||||
target: target
|
||||
target: target,
|
||||
});
|
||||
map.render();
|
||||
|
||||
@@ -54,7 +57,7 @@ describe('ol.layer.Heatmap', function() {
|
||||
}
|
||||
|
||||
const renderer = layer.getRenderer();
|
||||
renderer.worker_.addEventListener('message', function(event) {
|
||||
renderer.worker_.addEventListener('message', function (event) {
|
||||
if (!renderer.hitRenderInstructions_) {
|
||||
return;
|
||||
}
|
||||
@@ -75,7 +78,5 @@ describe('ol.layer.Heatmap', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user