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:
Tim Schaub
2020-04-06 12:25:12 -06:00
parent 53b48baf62
commit 054af09032
790 changed files with 46833 additions and 33765 deletions

View File

@@ -1,89 +1,94 @@
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import Fill from '../../../src/ol/style/Fill.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import Point from '../../../src/ol/geom/Point.js';
import RegularShape from '../../../src/ol/style/RegularShape.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import Style from '../../../src/ol/style/Style.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Fill from '../../../src/ol/style/Fill.js';
import RegularShape from '../../../src/ol/style/RegularShape.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import View from '../../../src/ol/View.js';
const vectorSource = new VectorSource();
function createFeatures(stroke, fill, offSet = [0, 0]) {
let feature;
feature = new Feature({
geometry: new Point([offSet[0], offSet[1]])
geometry: new Point([offSet[0], offSet[1]]),
});
// square with offset
feature.setStyle(new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 4,
radius: 10,
angle: Math.PI / 4,
displacement: [-15, 15]
feature.setStyle(
new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 4,
radius: 10,
angle: Math.PI / 4,
displacement: [-15, 15],
}),
})
}));
);
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([8 + offSet[0], 15 + offSet[1]])
geometry: new Point([8 + offSet[0], 15 + offSet[1]]),
});
// triangle
feature.setStyle(new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 3,
radius: 10,
rotation: Math.PI / 4,
angle: 0
feature.setStyle(
new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 3,
radius: 10,
rotation: Math.PI / 4,
angle: 0,
}),
})
}));
);
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-10 + offSet[0], -8 + offSet[1]])
geometry: new Point([-10 + offSet[0], -8 + offSet[1]]),
});
// star
feature.setStyle(new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 5,
radius: 10,
radius2: 4,
angle: 0
feature.setStyle(
new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 5,
radius: 10,
radius2: 4,
angle: 0,
}),
})
}));
);
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([12 + offSet[0], -8 + offSet[1]])
geometry: new Point([12 + offSet[0], -8 + offSet[1]]),
});
// cross
feature.setStyle(new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 4,
radius: 10,
radius2: 0,
angle: 0
feature.setStyle(
new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 4,
radius: 10,
radius2: 0,
angle: 0,
}),
})
}));
);
vectorSource.addFeature(feature);
}
createFeatures(
new Stroke({width: 2}),
new Fill({color: 'red'})
);
createFeatures(new Stroke({width: 2}), new Fill({color: 'red'}));
createFeatures(
new Stroke({
lineDash: [10, 5]
lineDash: [10, 5],
}),
null,
[50, 50]
@@ -91,7 +96,7 @@ createFeatures(
createFeatures(
new Stroke({
lineDash: [10, 5],
lineDashOffset: 5
lineDashOffset: 5,
}),
null,
[-50, -50]
@@ -100,7 +105,7 @@ createFeatures(
createFeatures(new Stroke(), new Fill(), [50, -50]);
const vectorLayer = new VectorLayer({
source: vectorSource
source: vectorSource,
});
new Map({
@@ -108,8 +113,8 @@ new Map({
layers: [vectorLayer],
view: new View({
center: [0, 0],
resolution: 1
})
resolution: 1,
}),
});
render();