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,9 +1,9 @@
import Feature from '../src/ol/Feature.js';
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import LineString from '../src/ol/geom/LineString.js';
import Map from '../src/ol/Map.js';
import VectorLayer from '../src/ol/layer/Vector.js';
import VectorSource from '../src/ol/source/Vector.js';
import View from '../src/ol/View.js';
const radius = 10e6;
const cos30 = Math.cos(Math.PI / 6);
@@ -12,15 +12,18 @@ const rise = radius * sin30;
const run = radius * cos30;
const triangle = new LineString([
[0, radius], [run, -rise], [-run, -rise], [0, radius]
[0, radius],
[run, -rise],
[-run, -rise],
[0, radius],
]);
const feature = new Feature(triangle);
const layer = new VectorLayer({
source: new VectorSource({
features: [feature]
})
features: [feature],
}),
});
const map = new Map({
@@ -28,8 +31,8 @@ const map = new Map({
target: 'map',
view: new View({
center: [0, 0],
zoom: 1
})
zoom: 1,
}),
});
function makeFractal(depth) {
@@ -59,19 +62,19 @@ function injectNodes(startNode) {
// first point at 1/3 along the segment
const firstNode = {
point: [start[0] + dx / 3, start[1] + dy / 3]
point: [start[0] + dx / 3, start[1] + dy / 3],
};
// second point at peak of _/\_
const r = Math.sqrt(dx * dx + dy * dy) / (2 * cos30);
const a = Math.atan2(dy, dx) + Math.PI / 6;
const secondNode = {
point: [start[0] + r * Math.cos(a), start[1] + r * Math.sin(a)]
point: [start[0] + r * Math.cos(a), start[1] + r * Math.sin(a)],
};
// third point at 2/3 along the segment
const thirdNode = {
point: [end[0] - dx / 3, end[1] - dy / 3]
point: [end[0] - dx / 3, end[1] - dy / 3],
};
startNode.next = firstNode;
@@ -80,15 +83,14 @@ function injectNodes(startNode) {
thirdNode.next = endNode;
}
function coordsToGraph(coordinates) {
const graph = {
point: coordinates[0]
point: coordinates[0],
};
const length = coordinates.length;
for (let level = 0, node = graph; level < length - 1; ++level) {
node.next = {
point: coordinates[level + 1]
point: coordinates[level + 1],
};
node = node.next;
}
@@ -111,12 +113,11 @@ function update() {
let updateTimer;
/**
* Regenerate fractal on depth change. Change events are debounced so updates
* only occur every 200ms.
*/
depthInput.onchange = function() {
depthInput.onchange = function () {
window.clearTimeout(updateTimer);
updateTimer = window.setTimeout(update, 200);
};