Skip to content

Commit

Permalink
Merge pull request #4968 from camptocamp/greenkeeper/eslint-6.0.0
Browse files Browse the repository at this point in the history
Update eslint to the latest version 🚀
  • Loading branch information
sbrunner authored Jun 24, 2019
2 parents b3a8541 + d78bcdb commit eb1329c
Show file tree
Hide file tree
Showing 30 changed files with 140 additions and 90 deletions.
2 changes: 1 addition & 1 deletion contribs/gmf/examples/objecteditinghub.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function MainController($http, $q, $scope, gmfThemes, gmfXSDAttributes) {
const gmfLayerNodes = [];
for (i = 0, ii = groupNode.children.length; i < ii; i++) {
if (groupNode.children[i].metadata.identifierAttributeField) {
gmfLayerNodes.push(/** @type import('gmf/themes.js').GmfLayerWMS} */(groupNode.children[i]));
gmfLayerNodes.push(/** @type {import('gmf/themes.js').GmfLayerWMS} */(groupNode.children[i]));
}
}

Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/backgroundlayerselector/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function Controller($scope, ngeoBackgroundLayerMgr, gmfThemes) {
* @param {Event|import('ol/events/Event.js').default} event Event.
*/
(event) => {
this.bgLayer = /** @type{import('ngeo/map/BackgroundLayerMgr.js').BackgroundEvent} */
this.bgLayer = /** @type {import('ngeo/map/BackgroundLayerMgr.js').BackgroundEvent} */
(event).detail.current;
}));

Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/controllers/AbstractMobileController.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export class AbstractMobileController extends AbstractAppController {
openNavMenu(target) {
const navElements = document.getElementsByClassName('gmf-mobile-nav-button');
for (let i = 0; i < navElements.length; i++) {
const element = /** @type HTMLElement */ (navElements[i]);
const element = /** @type {HTMLElement} */(navElements[i]);
if (element.dataset && element.dataset.target === target) {
element.click();
}
Expand Down
10 changes: 5 additions & 5 deletions contribs/gmf/src/datasource/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export class DatasourceManager {

const dataSources = this.dataSources_.getArray();
for (const dataSource of dataSources) {
const gmfOGCDataSource = /** @type import('gmf/datasource/OGC').default */ (dataSource);
const gmfOGCDataSource = /** @type {import('gmf/datasource/OGC').default} */(dataSource);
if (gmfOGCDataSource.dimensionsFiltersConfig) {
for (const key in gmfOGCDataSource.dimensionsFiltersConfig) {
if (gmfOGCDataSource.dimensionsFiltersConfig[key].value === null) {
Expand Down Expand Up @@ -449,7 +449,7 @@ export class DatasourceManager {
}

// From there on, the node is a layer node.
const gmfLayer = /** @type import('gmf/themes.js').GmfLayer */ (node);
const gmfLayer = /** @type {import('gmf/themes.js').GmfLayer} */(node);

// (2) Skip layer node if a data source with the same id exists
const id = Number(olUtilGetUid(gmfLayer));
Expand Down Expand Up @@ -880,8 +880,8 @@ export class DatasourceManager {
if (dsLayer == undefined) {
continue;
}
const gmfOGCDataSource = /** @type import('gmf/datasource/OGC.js').default */ (dataSource);
const gmfLayerWMS = /** @type import('gmf/themes.js').GmfLayerWMS */ (gmfOGCDataSource.gmfLayer);
const gmfOGCDataSource = /** @type {import('gmf/datasource/OGC.js').default} */(dataSource);
const gmfLayerWMS = /** @type {import('gmf/themes.js').GmfLayerWMS} */(gmfOGCDataSource.gmfLayer);
if (olUtilGetUid(dsLayer) == olUtilGetUid(layer) &&
layer.get('querySourceIds').indexOf(String(dataSource.id)) >= 0 &&
gmfLayerWMS.layers.split(',').indexOf(wmsLayerName) >= 0) {
Expand Down Expand Up @@ -1005,7 +1005,7 @@ export class DatasourceManager {
* @hidden
*/
handleNgeoBackgroundLayerChange_(evt) {
const event = /** @type{import('ngeo/map/BackgroundLayerMgr.js').BackgroundEvent} */(evt);
const event = /** @type {import('ngeo/map/BackgroundLayerMgr.js').BackgroundEvent} */(evt);
const previousBackgroundLayer = event.detail.previous;
const currentBackgroundLayer = event.detail.current;
const cache = this.dataSourcesCache_;
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/drawing/drawFeatureComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ Controller.prototype.handleMapContextMenu_ = function(evt) {
* @private
*/
Controller.prototype.handleMenuActionClick_ = function(vertexInfo, evt) {
const action = /** @type{import('ngeo/filter/ruleComponent.js').MenuEvent} */(evt).detail.action;
const action = /** @type {import('ngeo/filter/ruleComponent.js').MenuEvent} */(evt).detail.action;
if (!this.selectedFeature) {
throw new Error('Missing selectedFeature');
}
Expand Down
14 changes: 7 additions & 7 deletions contribs/gmf/src/drawing/featureStyleComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Controller.prototype.handleColorSet_ = function(newColor) {
* @return {number} The angle of the feature.
*/
Controller.prototype.getSetAngle = function(value) {
return /** @type number */ (this.getSetProperty_(ngeoFormatFeatureProperties.ANGLE, value));
return /** @type {number} */(this.getSetProperty_(ngeoFormatFeatureProperties.ANGLE, value));
};


Expand All @@ -221,7 +221,7 @@ Controller.prototype.getSetAngle = function(value) {
* @return {string} The name of the feature.
*/
Controller.prototype.getSetName = function(value) {
return /** @type string */ (this.getSetProperty_(ngeoFormatFeatureProperties.NAME, value));
return /** @type {string} */(this.getSetProperty_(ngeoFormatFeatureProperties.NAME, value));
};

/**
Expand All @@ -230,15 +230,15 @@ Controller.prototype.getSetName = function(value) {
* @return {boolean} Whether to show the labels or not.
*/
Controller.prototype.getSetShowLabel = function(value) {
return /** @type boolean */ (this.getSetProperty_(ngeoFormatFeatureProperties.SHOW_LABEL, value));
return /** @type {boolean} */(this.getSetProperty_(ngeoFormatFeatureProperties.SHOW_LABEL, value));
};

/**
* @param {number|undefined} value A stroke value to set or undefined to get.
* @return {number} The stroke of the feature.
*/
Controller.prototype.getSetOpacity = function(value) {
return /** @type number */ (this.getSetProperty_(ngeoFormatFeatureProperties.OPACITY, value));
return /** @type {number} */(this.getSetProperty_(ngeoFormatFeatureProperties.OPACITY, value));
};


Expand All @@ -248,7 +248,7 @@ Controller.prototype.getSetOpacity = function(value) {
* @return {boolean} Whether to show the measurements or not.
*/
Controller.prototype.getSetShowMeasure = function(value) {
return /** @type boolean */ (this.getSetProperty_(ngeoFormatFeatureProperties.SHOW_MEASURE, value));
return /** @type {boolean} */(this.getSetProperty_(ngeoFormatFeatureProperties.SHOW_MEASURE, value));
};


Expand All @@ -257,7 +257,7 @@ Controller.prototype.getSetShowMeasure = function(value) {
* @return {number} The size of the feature.
*/
Controller.prototype.getSetSize = function(value) {
return /** @type number */ (this.getSetProperty_(ngeoFormatFeatureProperties.SIZE, value));
return /** @type {number} */(this.getSetProperty_(ngeoFormatFeatureProperties.SIZE, value));
};


Expand All @@ -266,7 +266,7 @@ Controller.prototype.getSetSize = function(value) {
* @return {number} The stroke of the feature.
*/
Controller.prototype.getSetStroke = function(value) {
return /** @type number */ (this.getSetProperty_(ngeoFormatFeatureProperties.STROKE, value));
return /** @type {number} */(this.getSetProperty_(ngeoFormatFeatureProperties.STROKE, value));
};


Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/editing/Snapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ EditingSnappingService.prototype.registerTreeCtrl_ = function(treeCtrl) {

// Skip any Layertree controller that has a node that is not a leaf
let node = /** @type {import('gmf/themes.js').GmfGroup|import('gmf/themes.js').GmfLayer} */ (treeCtrl.node);
const groupNode = /** @type import('gmf/themes.js').GmfGroup */ (node);
const groupNode = /** @type {import('gmf/themes.js').GmfGroup} */(node);
if (groupNode.children) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/filters/filterselectorComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class FilterSelectorController {
* @private
*/
this.gmfDataSources_ =
/** @type{import("ol/Collection.js").default<import("gmf/datasource/OGC.js").default>} */(
/** @type {import("ol/Collection.js").default<import("gmf/datasource/OGC.js").default>} */(
gmfDataSourcesHelper.collection
);

Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/import/importdatasourceComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class Controller {

// Register input[type=file] onchange event, use HTML5 File api
this.fileInput_.on('change', () => {
const fileInput = /** @type HTMLInputElement */ (this.fileInput_[0]);
const fileInput = /** @type {HTMLInputElement} */(this.fileInput_[0]);
const files = fileInput.files;
this.file = files && files[0] ? files[0] : null;
this.scope_.$apply();
Expand Down
12 changes: 6 additions & 6 deletions contribs/gmf/src/layertree/SyncLayertreeMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ SyncLayertreeMap.prototype.sync_ = function(treeCtrl) {
const gmfGroup = /** @type {import('gmf/themes.js').GmfGroup} */(treeCtrl.node);
if (treeCtrl.layer && !gmfGroup.mixed) {
this.updateLayerState_(
/** @type import("ol/layer/Image.js").default|import("ol/layer/Tile.js").default */ (treeCtrl.layer),
/** @type {import("ol/layer/Image.js").default|import("ol/layer/Tile.js").default} */(treeCtrl.layer),
treeCtrl
);
return LayertreeVisitorDecision.DESCEND;
Expand Down Expand Up @@ -245,10 +245,10 @@ SyncLayertreeMap.prototype.createLayerFromGroup_ = function(treeCtrl, mixed) {
let hasActiveChildren = false;
treeCtrl.traverseDepthFirst((ctrl) => {
// Update layer information and tree state.
this.updateLayerReferences_(/** @type import('gmf/themes.js').GmfLayer */ (ctrl.node), layer);
this.updateLayerReferences_(/** @type {import('gmf/themes.js').GmfLayer} */(ctrl.node), layer);
if (ctrl.node.metadata.isChecked) {
ctrl.setState('on', false);
this.updateLayerState_(/** @type {import("ol/layer/Image.js").default} */ (layer), ctrl);
this.updateLayerState_(/** @type {import("ol/layer/Image.js").default} */(layer), ctrl);
hasActiveChildren = true;
return LayertreeVisitorDecision.DESCEND;
}
Expand All @@ -268,16 +268,16 @@ SyncLayertreeMap.prototype.createLayerFromGroup_ = function(treeCtrl, mixed) {
* @private
*/
SyncLayertreeMap.prototype.createLeafInAMixedGroup_ = function(treeCtrl, map) {
const gmfLayer = /** @type {import('gmf/themes.js').GmfLayer} */ (treeCtrl.node);
const gmfLayer = /** @type {import('gmf/themes.js').GmfLayer} */(treeCtrl.node);
let layer;
// Make layer.
if (gmfLayer.type === 'WMTS') {
layer = this.createWMTSLayer_(/** @type {import('gmf/themes.js').GmfLayerWMTS} */ (gmfLayer));
layer = this.createWMTSLayer_(/** @type {import('gmf/themes.js').GmfLayerWMTS} */(gmfLayer));
} else {
if (!this.ogcServersObject_) {
throw new Error('Missing ogcServersObject');
}
const gmfLayerWMS = /** @type import('gmf/themes.js').GmfLayerWMS */ (gmfLayer);
const gmfLayerWMS = /** @type {import('gmf/themes.js').GmfLayerWMS} */(gmfLayer);
const timeParam = this.getTimeParam_(treeCtrl);
const ogcServer = this.ogcServersObject_[gmfLayerWMS.ogcServer];
console.assert(ogcServer);
Expand Down
17 changes: 10 additions & 7 deletions contribs/gmf/src/layertree/TreeManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ LayertreeTreeManager.prototype.addFirstLevelGroups = function(firstLevelGroups,
* @private
*/
LayertreeTreeManager.prototype.updateTreeGroupsState_ = function(groups) {
const treeGroupsParam = /** @type Object<string, string> */ ({});
/**
* @type {Object<string, string>}
*/
const treeGroupsParam = {};
treeGroupsParam[PermalinkParam.TREE_GROUPS] = groups.map(node => node.name).join(',');
this.ngeoStateManager_.updateState(treeGroupsParam);
if (this.$injector_.has('gmfPermalink')) {
Expand Down Expand Up @@ -294,11 +297,11 @@ LayertreeTreeManager.prototype.addFirstLevelGroup_ = function(group) {
* @private
*/
LayertreeTreeManager.prototype.manageExclusiveGroupSingleChecked_ = function(node, found) {
const groupNode = /** @type import('gmf/themes.js').GmfGroup */ (node);
const groupNode = /** @type {import('gmf/themes.js').GmfGroup} */(node);
const children = groupNode.children;
if (children) {
for (const child of children) {
const childGroup = /** @type import('gmf/themes.js').GmfGroup */ (child);
const childGroup = /** @type {import('gmf/themes.js').GmfGroup} */(child);
if (childGroup.children) {
found = this.manageExclusiveGroupSingleChecked_(childGroup, found);
} else {
Expand Down Expand Up @@ -431,12 +434,12 @@ LayertreeTreeManager.prototype.cloneGroupNode_ = function(group, names) {
* @private
*/
LayertreeTreeManager.prototype.toggleNodeCheck_ = function(node, names) {
const groupNode = /** @type import('gmf/themes.js').GmfGroup */ (node);
const groupNode = /** @type {import('gmf/themes.js').GmfGroup} */(node);
if (!groupNode.children) {
return;
}
groupNode.children.forEach((childNode) => {
const childGroupNode = /** @type import('gmf/themes.js').GmfGroup */ (
const childGroupNode = /** @type {import('gmf/themes.js').GmfGroup} */(
childNode);
if (childGroupNode.children) {
this.toggleNodeCheck_(childGroupNode, names);
Expand Down Expand Up @@ -579,7 +582,7 @@ LayertreeTreeManager.prototype.refreshFirstLevelGroups_ = function(themes) {
* @private
*/
LayertreeTreeManager.prototype.getFirstLevelGroupFullState_ = function(treeCtrl) {
const children = /** @type Object<string, TreeManagerFullState>} */ ({});
const children = /** @type {Object<string, TreeManagerFullState>} */({});
// Get the state of the treeCtrl children recursively.
treeCtrl.children.map((child) => {
children[child.node.name] = this.getFirstLevelGroupFullState_(child);
Expand Down Expand Up @@ -632,7 +635,7 @@ LayertreeTreeManager.prototype.setNodeMetadataFromFullState_ = function(node, fu
}

// Set the metadata of the node children recursively.
const groupNode = /** @type import('gmf/themes.js').GmfGroup */ (node);
const groupNode = /** @type {import('gmf/themes.js').GmfGroup} */(node);
if (groupNode.children) {
groupNode.children.map((child) => {
this.setNodeMetadataFromFullState_(child, fullState.children[child.name]);
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/layertree/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ Controller.prototype.getLegendIconURL = function(treeCtrl) {
Controller.prototype.getLegendsObject = function(treeCtrl) {
/** @type {Object<string, string>} */
const legendsObject = {};
if (/** @type import('gmf/themes.js').GmfGroup */ (treeCtrl.node).children !== undefined) {
if (/** @type {import('gmf/themes.js').GmfGroup} */(treeCtrl.node).children !== undefined) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/map/mousepositionComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function Controller($element, $filter, $scope, gettextCatalog) {
this.$filter_ = $filter;

/**
* @type {?import("ol/control/MousePosition.js").default}
* @type {?import("ol/control/MousePosition.js").default}
* @private
*/
this.control_ = null;
Expand Down
12 changes: 6 additions & 6 deletions contribs/gmf/src/permalink/Permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ export function PermalinkService(
* @param {import('ngeo/layertree/Controller.js').LayertreeController} ctrl
*/
(ctrl) => {
const groupNode = /** @type{import('gmf/themes.js').GmfGroup} */(treeCtrl.node);
const groupNode = /** @type {import('gmf/themes.js').GmfGroup} */(treeCtrl.node);
if (groupNode.children === undefined) {
const param = ParamPrefix.TREE_ENABLE + ctrl.node.name;
newState[param] = `${visible}`;
Expand All @@ -568,7 +568,7 @@ export function PermalinkService(
* @param {import('ngeo/layertree/Controller.js').LayertreeController} ctrl
*/
(ctrl) => {
const groupNode = /** @type{import('gmf/themes.js').GmfGroup} */(treeCtrl.node);
const groupNode = /** @type {import('gmf/themes.js').GmfGroup} */(treeCtrl.node);
if (groupNode.children === undefined && ctrl.getState() === 'on') {
gmfLayerNames.push(ctrl.node.name);
}
Expand Down Expand Up @@ -1089,7 +1089,7 @@ PermalinkService.prototype.refreshFirstLevelGroups = function() {
throw new Error('Missing gmfTreeManager_.rootCtrl');
}
// Get first-level-groups order
const groupNode = /** @type{import('gmf/themes.js').GmfGroup} */(this.gmfTreeManager_.rootCtrl.node);
const groupNode = /** @type {import('gmf/themes.js').GmfGroup} */(this.gmfTreeManager_.rootCtrl.node);
const groupNodes = groupNode.children;
const orderedNames = groupNodes ? groupNodes.map(node => node.name) : [];

Expand Down Expand Up @@ -1261,8 +1261,8 @@ PermalinkService.prototype.initLayers_ = function() {
if (treeCtrl.isRoot) {
return undefined;
}
const groupNode = /** @type{import('gmf/themes.js').GmfGroup} */(treeCtrl.node);
const parentGroupNode = /** @type{import('gmf/themes.js').GmfGroup} */(treeCtrl.parent.node);
const groupNode = /** @type {import('gmf/themes.js').GmfGroup} */(treeCtrl.node);
const parentGroupNode = /** @type {import('gmf/themes.js').GmfGroup} */(treeCtrl.parent.node);

const opacity = this.ngeoStateManager_.getInitialNumberValue((
parentGroupNode.mixed ?
Expand Down Expand Up @@ -1294,7 +1294,7 @@ PermalinkService.prototype.initLayers_ = function() {
* @return {LayertreeVisitorDecision|undefined} the result
*/
const visitor = (treeCtrl) => {
const groupNode = /** @type{import('gmf/themes.js').GmfGroup} */(treeCtrl.node);
const groupNode = /** @type {import('gmf/themes.js').GmfGroup} */(treeCtrl.node);
if (groupNode.children === undefined) {
const enable = groupLayersArray.includes(treeCtrl.node.name);
if (enable) {
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/src/theme/Themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class ThemesService extends olEventsEventTarget {
*/
const layerLayerCreationFn = function(ogcServers, gmfLayer) {
if (gmfLayer.type === 'WMTS') {
const gmfLayerWMTS = /** @type import('gmf/themes.js').GmfLayerWMTS */ (gmfLayer);
const gmfLayerWMTS = /** @type {import('gmf/themes.js').GmfLayerWMTS} */(gmfLayer);
if (!gmfLayerWMTS.url) {
throw 'Layer URL is required';
}
Expand All @@ -178,7 +178,7 @@ export class ThemesService extends olEventsEventTarget {
});
return /** @type {angular.IPromise<import("ol/layer/Base.js").default>} */(layer);
} else if (gmfLayer.type === 'WMS') {
const gmfLayerWMS = /** @type import('gmf/themes.js').GmfLayerWMS */ (gmfLayer);
const gmfLayerWMS = /** @type {import('gmf/themes.js').GmfLayerWMS} */(gmfLayer);
console.assert(gmfLayerWMS.ogcServer, 'An OGC server is required');
const server = ogcServers[gmfLayerWMS.ogcServer];
console.assert(server, 'The OGC server was not found');
Expand Down
8 changes: 4 additions & 4 deletions examples/elevationProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ function MainController($http, $scope) {
};


/** @type function(Object<string, number>): number */
/** @type {function(Object<string, number>): number} */
const sort = typedFunctionsFactory(types.number, 'sort');
/** @type function(Object<string, string>): string */
/** @type {function(Object<string, string>): string} */
const id = typedFunctionsFactory(types.string, 'id');
/** @type function(Object<string, number>): number */
/** @type {function(Object<string, number>): number} */
const dist = typedFunctionsFactory(types.number, 'dist');
/** @type function(Object<string, string>): string */
/** @type {function(Object<string, string>): string} */
const title = typedFunctionsFactory(types.string, 'title');

/**
Expand Down
Loading

0 comments on commit eb1329c

Please sign in to comment.