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

@@ -2,13 +2,13 @@
* @module ol/interaction
*/
import Collection from './Collection.js';
import Kinetic from './Kinetic.js';
import DoubleClickZoom from './interaction/DoubleClickZoom.js';
import DragPan from './interaction/DragPan.js';
import DragRotate from './interaction/DragRotate.js';
import DragZoom from './interaction/DragZoom.js';
import KeyboardPan from './interaction/KeyboardPan.js';
import KeyboardZoom from './interaction/KeyboardZoom.js';
import Kinetic from './Kinetic.js';
import MouseWheelZoom from './interaction/MouseWheelZoom.js';
import PinchRotate from './interaction/PinchRotate.js';
import PinchZoom from './interaction/PinchZoom.js';
@@ -35,7 +35,6 @@ export {default as Select} from './interaction/Select.js';
export {default as Snap} from './interaction/Snap.js';
export {default as Translate} from './interaction/Translate.js';
/**
* @typedef {Object} DefaultsOptions
* @property {boolean} [altShiftDragRotate=true] Whether Alt-Shift-drag rotate is
@@ -57,7 +56,6 @@ export {default as Translate} from './interaction/Translate.js';
* milliseconds.
*/
/**
* Set of interactions included in maps by default. Specific interactions can be
* excluded by setting the appropriate option to false in the constructor
@@ -85,75 +83,87 @@ export {default as Translate} from './interaction/Translate.js';
* @api
*/
export function defaults(opt_options) {
const options = opt_options ? opt_options : {};
const interactions = new Collection();
const kinetic = new Kinetic(-0.005, 0.05, 100);
const altShiftDragRotate = options.altShiftDragRotate !== undefined ?
options.altShiftDragRotate : true;
const altShiftDragRotate =
options.altShiftDragRotate !== undefined
? options.altShiftDragRotate
: true;
if (altShiftDragRotate) {
interactions.push(new DragRotate());
}
const doubleClickZoom = options.doubleClickZoom !== undefined ?
options.doubleClickZoom : true;
const doubleClickZoom =
options.doubleClickZoom !== undefined ? options.doubleClickZoom : true;
if (doubleClickZoom) {
interactions.push(new DoubleClickZoom({
delta: options.zoomDelta,
duration: options.zoomDuration
}));
interactions.push(
new DoubleClickZoom({
delta: options.zoomDelta,
duration: options.zoomDuration,
})
);
}
const dragPan = options.dragPan !== undefined ? options.dragPan : true;
if (dragPan) {
interactions.push(new DragPan({
condition: options.onFocusOnly ? focus : undefined,
kinetic: kinetic
}));
interactions.push(
new DragPan({
condition: options.onFocusOnly ? focus : undefined,
kinetic: kinetic,
})
);
}
const pinchRotate = options.pinchRotate !== undefined ? options.pinchRotate :
true;
const pinchRotate =
options.pinchRotate !== undefined ? options.pinchRotate : true;
if (pinchRotate) {
interactions.push(new PinchRotate());
}
const pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;
if (pinchZoom) {
interactions.push(new PinchZoom({
duration: options.zoomDuration
}));
interactions.push(
new PinchZoom({
duration: options.zoomDuration,
})
);
}
const keyboard = options.keyboard !== undefined ? options.keyboard : true;
if (keyboard) {
interactions.push(new KeyboardPan());
interactions.push(new KeyboardZoom({
delta: options.zoomDelta,
duration: options.zoomDuration
}));
interactions.push(
new KeyboardZoom({
delta: options.zoomDelta,
duration: options.zoomDuration,
})
);
}
const mouseWheelZoom = options.mouseWheelZoom !== undefined ?
options.mouseWheelZoom : true;
const mouseWheelZoom =
options.mouseWheelZoom !== undefined ? options.mouseWheelZoom : true;
if (mouseWheelZoom) {
interactions.push(new MouseWheelZoom({
condition: options.onFocusOnly ? focus : undefined,
duration: options.zoomDuration
}));
interactions.push(
new MouseWheelZoom({
condition: options.onFocusOnly ? focus : undefined,
duration: options.zoomDuration,
})
);
}
const shiftDragZoom = options.shiftDragZoom !== undefined ?
options.shiftDragZoom : true;
const shiftDragZoom =
options.shiftDragZoom !== undefined ? options.shiftDragZoom : true;
if (shiftDragZoom) {
interactions.push(new DragZoom({
duration: options.zoomDuration
}));
interactions.push(
new DragZoom({
duration: options.zoomDuration,
})
);
}
return interactions;
}