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
+14 -21
View File
@@ -4,7 +4,6 @@
import {getAllTextContent, getDocument} from '../xml.js';
import {padNumber} from '../string.js';
/**
* @param {Node} node Node.
* @return {boolean|undefined} Boolean.
@@ -14,7 +13,6 @@ export function readBoolean(node) {
return readBooleanString(s);
}
/**
* @param {string} string String.
* @return {boolean|undefined} Boolean.
@@ -28,7 +26,6 @@ export function readBooleanString(string) {
}
}
/**
* @param {Node} node Node.
* @return {number|undefined} DateTime in seconds.
@@ -39,7 +36,6 @@ export function readDateTime(node) {
return isNaN(dateTime) ? undefined : dateTime / 1000;
}
/**
* @param {Node} node Node.
* @return {number|undefined} Decimal.
@@ -49,7 +45,6 @@ export function readDecimal(node) {
return readDecimalString(s);
}
/**
* @param {string} string String.
* @return {number|undefined} Decimal.
@@ -64,7 +59,6 @@ export function readDecimalString(string) {
}
}
/**
* @param {Node} node Node.
* @return {number|undefined} Non negative integer.
@@ -74,7 +68,6 @@ export function readNonNegativeInteger(node) {
return readNonNegativeIntegerString(s);
}
/**
* @param {string} string String.
* @return {number|undefined} Non negative integer.
@@ -88,7 +81,6 @@ export function readNonNegativeIntegerString(string) {
}
}
/**
* @param {Node} node Node.
* @return {string|undefined} String.
@@ -97,16 +89,14 @@ export function readString(node) {
return getAllTextContent(node, false).trim();
}
/**
* @param {Node} node Node to append a TextNode with the boolean to.
* @param {boolean} bool Boolean.
*/
export function writeBooleanTextNode(node, bool) {
writeStringTextNode(node, (bool) ? '1' : '0');
writeStringTextNode(node, bool ? '1' : '0');
}
/**
* @param {Node} node Node to append a CDATA Section with the string to.
* @param {string} string String.
@@ -115,23 +105,28 @@ export function writeCDATASection(node, string) {
node.appendChild(getDocument().createCDATASection(string));
}
/**
* @param {Node} node Node to append a TextNode with the dateTime to.
* @param {number} dateTime DateTime in seconds.
*/
export function writeDateTimeTextNode(node, dateTime) {
const date = new Date(dateTime * 1000);
const string = date.getUTCFullYear() + '-' +
padNumber(date.getUTCMonth() + 1, 2) + '-' +
padNumber(date.getUTCDate(), 2) + 'T' +
padNumber(date.getUTCHours(), 2) + ':' +
padNumber(date.getUTCMinutes(), 2) + ':' +
padNumber(date.getUTCSeconds(), 2) + 'Z';
const string =
date.getUTCFullYear() +
'-' +
padNumber(date.getUTCMonth() + 1, 2) +
'-' +
padNumber(date.getUTCDate(), 2) +
'T' +
padNumber(date.getUTCHours(), 2) +
':' +
padNumber(date.getUTCMinutes(), 2) +
':' +
padNumber(date.getUTCSeconds(), 2) +
'Z';
node.appendChild(getDocument().createTextNode(string));
}
/**
* @param {Node} node Node to append a TextNode with the decimal to.
* @param {number} decimal Decimal.
@@ -141,7 +136,6 @@ export function writeDecimalTextNode(node, decimal) {
node.appendChild(getDocument().createTextNode(string));
}
/**
* @param {Node} node Node to append a TextNode with the decimal to.
* @param {number} nonNegativeInteger Non negative integer.
@@ -151,7 +145,6 @@ export function writeNonNegativeIntegerTextNode(node, nonNegativeInteger) {
node.appendChild(getDocument().createTextNode(string));
}
/**
* @param {Node} node Node to append a TextNode with the string to.
* @param {string} string String.