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
+21 -18
View File
@@ -1,33 +1,29 @@
/**
* @module ol/format/WMSGetFeatureInfo
*/
import {extend, includes} from '../array.js';
import GML2 from './GML2.js';
import XMLFeature from './XMLFeature.js';
import {assign} from '../obj.js';
import {extend, includes} from '../array.js';
import {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js';
/**
* @typedef {Object} Options
* @property {Array<string>} [layers] If set, only features of the given layers will be returned by the format when read.
*/
/**
* @const
* @type {string}
*/
const featureIdentifier = '_feature';
/**
* @const
* @type {string}
*/
const layerIdentifier = '_layer';
/**
* @classdesc
* Format for reading WMSGetFeatureInfo format. It uses
@@ -36,7 +32,6 @@ const layerIdentifier = '_layer';
* @api
*/
class WMSGetFeatureInfo extends XMLFeature {
/**
* @param {Options=} opt_options Options.
*/
@@ -51,14 +46,12 @@ class WMSGetFeatureInfo extends XMLFeature {
*/
this.featureNS_ = 'http://mapserver.gis.umn.edu/mapserver';
/**
* @private
* @type {GML2}
*/
this.gmlFormat_ = new GML2();
/**
* @private
* @type {Array<string>}
@@ -111,8 +104,7 @@ class WMSGetFeatureInfo extends XMLFeature {
continue;
}
const featureType = layerName +
featureIdentifier;
const featureType = layerName + featureIdentifier;
context['featureType'] = featureType;
context['featureNS'] = this.featureNS_;
@@ -120,22 +112,35 @@ class WMSGetFeatureInfo extends XMLFeature {
/** @type {Object<string, import("../xml.js").Parser>} */
const parsers = {};
parsers[featureType] = makeArrayPusher(
this.gmlFormat_.readFeatureElement, this.gmlFormat_);
this.gmlFormat_.readFeatureElement,
this.gmlFormat_
);
const parsersNS = makeStructureNS(
[context['featureNS'], null], parsers);
[context['featureNS'], null],
parsers
);
layerElement.setAttribute('namespaceURI', this.featureNS_);
const layerFeatures = pushParseAndPop(
[],
// @ts-ignore
[], parsersNS, layerElement, objectStack, this.gmlFormat_);
parsersNS,
layerElement,
objectStack,
this.gmlFormat_
);
if (layerFeatures) {
extend(features, layerFeatures);
}
}
}
if (localName == 'FeatureCollection') {
const gmlFeatures = pushParseAndPop([],
this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node,
[{}], this.gmlFormat_);
const gmlFeatures = pushParseAndPop(
[],
this.gmlFormat_.FEATURE_COLLECTION_PARSERS,
node,
[{}],
this.gmlFormat_
);
if (gmlFeatures) {
features = gmlFeatures;
}
@@ -156,8 +161,6 @@ class WMSGetFeatureInfo extends XMLFeature {
}
return this.readFeatures_(node, [options]);
}
}
export default WMSGetFeatureInfo;