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,77 +1,126 @@
|
||||
import CircleStyle from '../../../src/ol/style/Circle.js';
|
||||
import Fill from '../../../src/ol/style/Fill.js';
|
||||
import LineString from '../../../src/ol/geom/LineString.js';
|
||||
import Point from '../../../src/ol/geom/Point.js';
|
||||
import Polygon from '../../../src/ol/geom/Polygon.js';
|
||||
import {toContext} from '../../../src/ol/render.js';
|
||||
import CircleStyle from '../../../src/ol/style/Circle.js';
|
||||
import Fill from '../../../src/ol/style/Fill.js';
|
||||
import Stroke from '../../../src/ol/style/Stroke.js';
|
||||
import Style from '../../../src/ol/style/Style.js';
|
||||
import {toContext} from '../../../src/ol/render.js';
|
||||
|
||||
const canvas = document.getElementById('canvas');
|
||||
const vectorContext = toContext(canvas.getContext('2d'), {
|
||||
pixelRatio: 1,
|
||||
size: [200, 200]
|
||||
size: [200, 200],
|
||||
});
|
||||
|
||||
vectorContext.setStyle(new Style({
|
||||
image: new CircleStyle({
|
||||
fill: new Fill({
|
||||
color: 'green'
|
||||
vectorContext.setStyle(
|
||||
new Style({
|
||||
image: new CircleStyle({
|
||||
fill: new Fill({
|
||||
color: 'green',
|
||||
}),
|
||||
radius: 10,
|
||||
}),
|
||||
radius: 10
|
||||
})
|
||||
}));
|
||||
);
|
||||
vectorContext.drawGeometry(new Point([100, 100]));
|
||||
|
||||
vectorContext.setStyle(new Style({
|
||||
stroke: new Stroke({
|
||||
lineCap: 'butt',
|
||||
color: 'red',
|
||||
width: 14
|
||||
vectorContext.setStyle(
|
||||
new Style({
|
||||
stroke: new Stroke({
|
||||
lineCap: 'butt',
|
||||
color: 'red',
|
||||
width: 14,
|
||||
}),
|
||||
})
|
||||
}));
|
||||
vectorContext.drawGeometry(new LineString([
|
||||
[10, 60], [30, 40], [50, 60], [70, 40], [90, 60]
|
||||
]));
|
||||
);
|
||||
vectorContext.drawGeometry(
|
||||
new LineString([
|
||||
[10, 60],
|
||||
[30, 40],
|
||||
[50, 60],
|
||||
[70, 40],
|
||||
[90, 60],
|
||||
])
|
||||
);
|
||||
|
||||
vectorContext.setStyle(new Style({
|
||||
stroke: new Stroke({
|
||||
lineJoin: 'bevel',
|
||||
lineCap: 'butt',
|
||||
color: '#111',
|
||||
width: 14
|
||||
vectorContext.setStyle(
|
||||
new Style({
|
||||
stroke: new Stroke({
|
||||
lineJoin: 'bevel',
|
||||
lineCap: 'butt',
|
||||
color: '#111',
|
||||
width: 14,
|
||||
}),
|
||||
})
|
||||
}));
|
||||
vectorContext.drawGeometry(new LineString([
|
||||
[10, 140], [30, 120], [50, 140], [70, 120], [90, 140]
|
||||
]));
|
||||
);
|
||||
vectorContext.drawGeometry(
|
||||
new LineString([
|
||||
[10, 140],
|
||||
[30, 120],
|
||||
[50, 140],
|
||||
[70, 120],
|
||||
[90, 140],
|
||||
])
|
||||
);
|
||||
|
||||
|
||||
vectorContext.setStyle(new Style({
|
||||
stroke: new Stroke({
|
||||
color: 'blue',
|
||||
width: 6
|
||||
}),
|
||||
fill: new Fill({
|
||||
color: 'rgba(0,0,255,0.5)'
|
||||
vectorContext.setStyle(
|
||||
new Style({
|
||||
stroke: new Stroke({
|
||||
color: 'blue',
|
||||
width: 6,
|
||||
}),
|
||||
fill: new Fill({
|
||||
color: 'rgba(0,0,255,0.5)',
|
||||
}),
|
||||
})
|
||||
}));
|
||||
);
|
||||
|
||||
vectorContext.drawGeometry(new Polygon([
|
||||
[[125, 25], [175, 25], [175, 75], [125, 75], [125, 25]],
|
||||
[[140, 40], [140, 60], [160, 60], [160, 40], [140, 40]]
|
||||
]));
|
||||
vectorContext.drawGeometry(
|
||||
new Polygon([
|
||||
[
|
||||
[125, 25],
|
||||
[175, 25],
|
||||
[175, 75],
|
||||
[125, 75],
|
||||
[125, 25],
|
||||
],
|
||||
[
|
||||
[140, 40],
|
||||
[140, 60],
|
||||
[160, 60],
|
||||
[160, 40],
|
||||
[140, 40],
|
||||
],
|
||||
])
|
||||
);
|
||||
|
||||
vectorContext.setStyle(new Style({
|
||||
stroke: new Stroke({
|
||||
lineDash: [10, 5],
|
||||
lineDashOffset: 5
|
||||
vectorContext.setStyle(
|
||||
new Style({
|
||||
stroke: new Stroke({
|
||||
lineDash: [10, 5],
|
||||
lineDashOffset: 5,
|
||||
}),
|
||||
})
|
||||
}));
|
||||
);
|
||||
|
||||
vectorContext.drawGeometry(new Polygon([
|
||||
[[125, 125], [175, 125], [175, 175], [125, 175], [125, 125]],
|
||||
[[140, 140], [140, 160], [160, 160], [160, 140], [140, 140]]
|
||||
]));
|
||||
vectorContext.drawGeometry(
|
||||
new Polygon([
|
||||
[
|
||||
[125, 125],
|
||||
[175, 125],
|
||||
[175, 175],
|
||||
[125, 175],
|
||||
[125, 125],
|
||||
],
|
||||
[
|
||||
[140, 140],
|
||||
[140, 160],
|
||||
[160, 160],
|
||||
[160, 140],
|
||||
[140, 140],
|
||||
],
|
||||
])
|
||||
);
|
||||
|
||||
render();
|
||||
|
||||
Reference in New Issue
Block a user