From c298df9ed0130b133fc67a3964a27341fcffa77b Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" <23040076+greenkeeper[bot]@users.noreply.github.com> Date: Sat, 22 Jun 2019 03:58:53 +0000 Subject: [PATCH 1/3] chore(package): update eslint to version 6.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1bd84fbf9866..c32694101c4a 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "css-loader": "^3.0.0", "d3": "^5.9.2", "ejs-loader": "^0.3.3", - "eslint": "^5.16.0", + "eslint": "^6.0.0", "eslint-config-openlayers": "^12.0.0", "eslint-plugin-googshift": "^0.9.3", "eslint-plugin-import": "^2.17.3", From 2ec336ac19a50ab123c2843f9d0e420c681e7699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 24 Jun 2019 14:18:16 +0200 Subject: [PATCH 2/3] Fix eslint issues --- src/misc/php-date-formatter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/misc/php-date-formatter.js b/src/misc/php-date-formatter.js index 7045e1f0dd5f..5869463e30c7 100644 --- a/src/misc/php-date-formatter.js +++ b/src/misc/php-date-formatter.js @@ -17,7 +17,6 @@ /* eslint max-len: 0 */ -/* eslint @openlayers/valid-tsdoc: 0 */ /* eslint valid-jsdoc: 0 */ /* eslint quotes: 0 */ /* eslint indent: 0 */ From d78bcdbcb90bd93b7ce1f81dab537980efc90dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Mon, 24 Jun 2019 15:26:54 +0200 Subject: [PATCH 3/3] Fix typecheck errors --- contribs/gmf/examples/objecteditinghub.js | 2 +- .../src/backgroundlayerselector/component.js | 2 +- .../controllers/AbstractMobileController.js | 2 +- contribs/gmf/src/datasource/Manager.js | 10 ++-- .../gmf/src/drawing/drawFeatureComponent.js | 2 +- .../gmf/src/drawing/featureStyleComponent.js | 14 ++--- contribs/gmf/src/editing/Snapping.js | 2 +- .../src/filters/filterselectorComponent.js | 2 +- .../src/import/importdatasourceComponent.js | 2 +- .../gmf/src/layertree/SyncLayertreeMap.js | 12 ++--- contribs/gmf/src/layertree/TreeManager.js | 17 +++--- contribs/gmf/src/layertree/component.js | 2 +- .../gmf/src/map/mousepositionComponent.js | 2 +- contribs/gmf/src/permalink/Permalink.js | 12 ++--- contribs/gmf/src/theme/Themes.js | 4 +- examples/elevationProfile.js | 8 +-- npm-debug.log | 45 ++++++++++++++++ src/Menu.js | 2 +- src/filter/ruleComponent.js | 2 +- src/misc/swipe.js | 2 +- src/offline/Downloader.js | 4 +- src/offline/SerializerDeserializer.js | 52 +++++++++---------- src/offline/TilesDownloader.js | 2 +- src/profile/d3Elevation.js | 4 +- src/query/Querent.js | 6 +-- src/routing/RoutingComponent.js | 6 +-- src/routing/RoutingFeatureComponent.js | 4 +- tslint.json | 3 ++ 28 files changed, 139 insertions(+), 88 deletions(-) create mode 100644 npm-debug.log create mode 100644 tslint.json diff --git a/contribs/gmf/examples/objecteditinghub.js b/contribs/gmf/examples/objecteditinghub.js index 9cd5a35cada8..afe6db8e8281 100644 --- a/contribs/gmf/examples/objecteditinghub.js +++ b/contribs/gmf/examples/objecteditinghub.js @@ -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])); } } diff --git a/contribs/gmf/src/backgroundlayerselector/component.js b/contribs/gmf/src/backgroundlayerselector/component.js index 65c911dc9030..d12a9d40b617 100644 --- a/contribs/gmf/src/backgroundlayerselector/component.js +++ b/contribs/gmf/src/backgroundlayerselector/component.js @@ -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; })); diff --git a/contribs/gmf/src/controllers/AbstractMobileController.js b/contribs/gmf/src/controllers/AbstractMobileController.js index dee1ddaa68a2..f3d467dd39b8 100644 --- a/contribs/gmf/src/controllers/AbstractMobileController.js +++ b/contribs/gmf/src/controllers/AbstractMobileController.js @@ -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(); } diff --git a/contribs/gmf/src/datasource/Manager.js b/contribs/gmf/src/datasource/Manager.js index bd6407dcd1d1..a39760be057d 100644 --- a/contribs/gmf/src/datasource/Manager.js +++ b/contribs/gmf/src/datasource/Manager.js @@ -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) { @@ -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)); @@ -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) { @@ -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_; diff --git a/contribs/gmf/src/drawing/drawFeatureComponent.js b/contribs/gmf/src/drawing/drawFeatureComponent.js index b92c1bb6511e..5f0be71785cb 100644 --- a/contribs/gmf/src/drawing/drawFeatureComponent.js +++ b/contribs/gmf/src/drawing/drawFeatureComponent.js @@ -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'); } diff --git a/contribs/gmf/src/drawing/featureStyleComponent.js b/contribs/gmf/src/drawing/featureStyleComponent.js index 05bf1a920ec5..28fdfa4cb7ba 100644 --- a/contribs/gmf/src/drawing/featureStyleComponent.js +++ b/contribs/gmf/src/drawing/featureStyleComponent.js @@ -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)); }; @@ -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)); }; /** @@ -230,7 +230,7 @@ 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)); }; /** @@ -238,7 +238,7 @@ Controller.prototype.getSetShowLabel = function(value) { * @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)); }; @@ -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)); }; @@ -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)); }; @@ -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)); }; diff --git a/contribs/gmf/src/editing/Snapping.js b/contribs/gmf/src/editing/Snapping.js index f142ec36020e..371d3c53ff56 100644 --- a/contribs/gmf/src/editing/Snapping.js +++ b/contribs/gmf/src/editing/Snapping.js @@ -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; } diff --git a/contribs/gmf/src/filters/filterselectorComponent.js b/contribs/gmf/src/filters/filterselectorComponent.js index aabb16482758..084cb1704b6e 100644 --- a/contribs/gmf/src/filters/filterselectorComponent.js +++ b/contribs/gmf/src/filters/filterselectorComponent.js @@ -252,7 +252,7 @@ class FilterSelectorController { * @private */ this.gmfDataSources_ = - /** @type{import("ol/Collection.js").default} */( + /** @type {import("ol/Collection.js").default} */( gmfDataSourcesHelper.collection ); diff --git a/contribs/gmf/src/import/importdatasourceComponent.js b/contribs/gmf/src/import/importdatasourceComponent.js index 1aa095669caf..4fb57a74543a 100644 --- a/contribs/gmf/src/import/importdatasourceComponent.js +++ b/contribs/gmf/src/import/importdatasourceComponent.js @@ -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(); diff --git a/contribs/gmf/src/layertree/SyncLayertreeMap.js b/contribs/gmf/src/layertree/SyncLayertreeMap.js index 56eb987941b2..f1b8dfc32823 100644 --- a/contribs/gmf/src/layertree/SyncLayertreeMap.js +++ b/contribs/gmf/src/layertree/SyncLayertreeMap.js @@ -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; @@ -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; } @@ -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); diff --git a/contribs/gmf/src/layertree/TreeManager.js b/contribs/gmf/src/layertree/TreeManager.js index 8fdb35ee9545..03ee88bbf39f 100644 --- a/contribs/gmf/src/layertree/TreeManager.js +++ b/contribs/gmf/src/layertree/TreeManager.js @@ -204,7 +204,10 @@ LayertreeTreeManager.prototype.addFirstLevelGroups = function(firstLevelGroups, * @private */ LayertreeTreeManager.prototype.updateTreeGroupsState_ = function(groups) { - const treeGroupsParam = /** @type Object */ ({}); + /** + * @type {Object} + */ + const treeGroupsParam = {}; treeGroupsParam[PermalinkParam.TREE_GROUPS] = groups.map(node => node.name).join(','); this.ngeoStateManager_.updateState(treeGroupsParam); if (this.$injector_.has('gmfPermalink')) { @@ -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 { @@ -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); @@ -579,7 +582,7 @@ LayertreeTreeManager.prototype.refreshFirstLevelGroups_ = function(themes) { * @private */ LayertreeTreeManager.prototype.getFirstLevelGroupFullState_ = function(treeCtrl) { - const children = /** @type Object} */ ({}); + const children = /** @type {Object} */({}); // Get the state of the treeCtrl children recursively. treeCtrl.children.map((child) => { children[child.node.name] = this.getFirstLevelGroupFullState_(child); @@ -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]); diff --git a/contribs/gmf/src/layertree/component.js b/contribs/gmf/src/layertree/component.js index 5b1bdf17ea78..5638a0d27e1b 100644 --- a/contribs/gmf/src/layertree/component.js +++ b/contribs/gmf/src/layertree/component.js @@ -569,7 +569,7 @@ Controller.prototype.getLegendIconURL = function(treeCtrl) { Controller.prototype.getLegendsObject = function(treeCtrl) { /** @type {Object} */ 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; } diff --git a/contribs/gmf/src/map/mousepositionComponent.js b/contribs/gmf/src/map/mousepositionComponent.js index 9992801400c0..540112f1e6a5 100644 --- a/contribs/gmf/src/map/mousepositionComponent.js +++ b/contribs/gmf/src/map/mousepositionComponent.js @@ -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; diff --git a/contribs/gmf/src/permalink/Permalink.js b/contribs/gmf/src/permalink/Permalink.js index 685292178a8e..7e2c18d08c0e 100644 --- a/contribs/gmf/src/permalink/Permalink.js +++ b/contribs/gmf/src/permalink/Permalink.js @@ -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}`; @@ -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); } @@ -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) : []; @@ -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 ? @@ -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) { diff --git a/contribs/gmf/src/theme/Themes.js b/contribs/gmf/src/theme/Themes.js index 8ff1d6841891..faf451d876e8 100644 --- a/contribs/gmf/src/theme/Themes.js +++ b/contribs/gmf/src/theme/Themes.js @@ -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'; } @@ -178,7 +178,7 @@ export class ThemesService extends olEventsEventTarget { }); return /** @type {angular.IPromise} */(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'); diff --git a/examples/elevationProfile.js b/examples/elevationProfile.js index 3c6ae4f77cc8..c36313c4443f 100644 --- a/examples/elevationProfile.js +++ b/examples/elevationProfile.js @@ -172,13 +172,13 @@ function MainController($http, $scope) { }; - /** @type function(Object): number */ + /** @type {function(Object): number} */ const sort = typedFunctionsFactory(types.number, 'sort'); - /** @type function(Object): string */ + /** @type {function(Object): string} */ const id = typedFunctionsFactory(types.string, 'id'); - /** @type function(Object): number */ + /** @type {function(Object): number} */ const dist = typedFunctionsFactory(types.number, 'dist'); - /** @type function(Object): string */ + /** @type {function(Object): string} */ const title = typedFunctionsFactory(types.string, 'title'); /** diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 000000000000..f29bd1a0cfc2 --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,45 @@ +0 info it worked if it ends with ok +1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'typecheck' ] +2 info using npm@3.5.2 +3 info using node@v8.10.0 +4 verbose run-script [ 'pretypecheck', 'typecheck', 'posttypecheck' ] +5 info lifecycle ngeo@2.5.0~pretypecheck: ngeo@2.5.0 +6 silly lifecycle ngeo@2.5.0~pretypecheck: no script for pretypecheck, continuing +7 info lifecycle ngeo@2.5.0~typecheck: ngeo@2.5.0 +8 verbose lifecycle ngeo@2.5.0~typecheck: unsafe-perm in lifecycle true +9 verbose lifecycle ngeo@2.5.0~typecheck: PATH: /usr/share/npm/bin/node-gyp-bin:/home/external/workspace/ngeo/node_modules/.bin:/home/sbrunner/.local/bin:/home/sbrunner/bin:/home/sbrunner/.local/bin:/home/sbrunner/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin:/usr/sbin/:/sbin:/home/sbrunner/bin/:/home/sbrunner/.local/bin/:/home/sbrunner/.gem/bin/:/home/sbrunner/bin/openshift-origin-server-v3.11.0-0cbc58b-linux-64bit:/usr/sbin/:/sbin:/home/sbrunner/bin/:/home/sbrunner/.local/bin/:/home/sbrunner/.gem/bin/:/home/sbrunner/bin/openshift-origin-server-v3.11.0-0cbc58b-linux-64bit:/home/linuxbrew/.linuxbrew/bin +10 verbose lifecycle ngeo@2.5.0~typecheck: CWD: /home/external/workspace/ngeo +11 silly lifecycle ngeo@2.5.0~typecheck: Args: [ '-c', 'tsc' ] +12 silly lifecycle ngeo@2.5.0~typecheck: Returned: code: 1 signal: null +13 info lifecycle ngeo@2.5.0~typecheck: Failed to exec typecheck script +14 verbose stack Error: ngeo@2.5.0 typecheck: `tsc` +14 verbose stack Exit status 1 +14 verbose stack at EventEmitter. (/usr/share/npm/lib/utils/lifecycle.js:232:16) +14 verbose stack at emitTwo (events.js:126:13) +14 verbose stack at EventEmitter.emit (events.js:214:7) +14 verbose stack at ChildProcess. (/usr/share/npm/lib/utils/spawn.js:24:14) +14 verbose stack at emitTwo (events.js:126:13) +14 verbose stack at ChildProcess.emit (events.js:214:7) +14 verbose stack at maybeClose (internal/child_process.js:925:16) +14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) +15 verbose pkgid ngeo@2.5.0 +16 verbose cwd /home/external/workspace/ngeo +17 error Linux 4.15.0-52-generic +18 error argv "/usr/bin/node" "/usr/bin/npm" "run" "typecheck" +19 error node v8.10.0 +20 error npm v3.5.2 +21 error code ELIFECYCLE +22 error ngeo@2.5.0 typecheck: `tsc` +22 error Exit status 1 +23 error Failed at the ngeo@2.5.0 typecheck script 'tsc'. +23 error Make sure you have the latest version of node.js and npm installed. +23 error If you do, this is most likely a problem with the ngeo package, +23 error not with npm itself. +23 error Tell the author that this fails on your system: +23 error tsc +23 error You can get information on how to open an issue for this project with: +23 error npm bugs ngeo +23 error Or if that isn't available, you can get their info via: +23 error npm owner ls ngeo +23 error There is likely additional logging output above. +24 verbose exit [ 1, true ] diff --git a/src/Menu.js b/src/Menu.js index 2c42b95640a7..f44649dcf255 100644 --- a/src/Menu.js +++ b/src/Menu.js @@ -215,7 +215,7 @@ export default class extends olOverlay { * @private */ handleMapPointerMove_(evt) { - const myEvent = /** @type{import("ol/MapBrowserEvent.js").default} */(evt); + const myEvent = /** @type {import("ol/MapBrowserEvent.js").default} */(evt); const target = myEvent.originalEvent.target; const element = this.getElement(); if (target instanceof Element && element instanceof Element && element.contains(target)) { diff --git a/src/filter/ruleComponent.js b/src/filter/ruleComponent.js index 2d2411c7f7e9..a0754f7ed6fa 100644 --- a/src/filter/ruleComponent.js +++ b/src/filter/ruleComponent.js @@ -1033,7 +1033,7 @@ class RuleController { * @private */ handleMenuActionClick_(evt) { - const action = /** @type{MenuEvent} */(evt).detail.action; + const action = /** @type {MenuEvent} */(evt).detail.action; switch (action) { case 'move': diff --git a/src/misc/swipe.js b/src/misc/swipe.js index 4a7f3915dc73..983ce1406549 100644 --- a/src/misc/swipe.js +++ b/src/misc/swipe.js @@ -39,7 +39,7 @@ module.factory('$verticalSwipe', [function() { // The total distance in any direction before we make the call on swipe vs. scroll. const MOVE_BUFFER_RADIUS = 10; - /** @type Object> */ + /** @type {Object>} */ const POINTER_EVENTS = { mouse: { start: 'mousedown', diff --git a/src/offline/Downloader.js b/src/offline/Downloader.js index 6fea951260b2..e00b131f97f8 100644 --- a/src/offline/Downloader.js +++ b/src/offline/Downloader.js @@ -71,11 +71,11 @@ const Downloader = class { */ const queueByZ = []; /** - * @type number + * @type {number} */ let minX; /** - * @type number + * @type {number} */ let minY, maxX, maxY; tileGrid.forEachTileCoord(extent, z, (coord) => { diff --git a/src/offline/SerializerDeserializer.js b/src/offline/SerializerDeserializer.js index 87aca78d75b3..e044f424e2d5 100644 --- a/src/offline/SerializerDeserializer.js +++ b/src/offline/SerializerDeserializer.js @@ -47,11 +47,11 @@ const SerDes = class { * @type {Object} */ const obj = {}; - obj['extent'] = tilegrid.getExtent(); - obj['minZoom'] = tilegrid.getMinZoom(); - obj['origin'] = tilegrid.getOrigin(0); // hack - obj['resolutions'] = tilegrid.getResolutions(); - obj['tileSize'] = tilegrid.getTileSize(tilegrid.getMinZoom()); + obj.extent = tilegrid.getExtent(); + obj.minZoom = tilegrid.getMinZoom(); + obj.origin = tilegrid.getOrigin(0); // hack + obj.resolutions = tilegrid.getResolutions(); + obj.tileSize = tilegrid.getTileSize(tilegrid.getMinZoom()); return JSON.stringify(obj); } @@ -60,7 +60,7 @@ const SerDes = class { * @return {OlTilegridTileGrid} tilegrid */ deserializeTilegrid(serialization) { - const options = /** @type {import ("ol/tilegrid/WMTS").Options} */ (JSON.parse(serialization)); + const options = /** @type {import ("ol/tilegrid/WMTS").Options} */(JSON.parse(serialization)); return new OlTilegridTileGrid(options); } @@ -77,14 +77,14 @@ const SerDes = class { */ const obj = {}; const resolutions = tilegrid.getResolutions(); - obj['extent'] = tilegrid.getExtent(); - obj['minZoom'] = tilegrid.getMinZoom(); - obj['matrixIds'] = tilegrid.getMatrixIds(); - obj['resolutions'] = resolutions; + obj.extent = tilegrid.getExtent(); + obj.minZoom = tilegrid.getMinZoom(); + obj.matrixIds = tilegrid.getMatrixIds(); + obj.resolutions = resolutions; - obj['origins'] = []; + obj.origins = []; for (let z = 0; z < resolutions.length; ++z) { - obj['origins'].push(tilegrid.getOrigin(z)); + obj.origins.push(tilegrid.getOrigin(z)); } return JSON.stringify(obj); } @@ -94,7 +94,7 @@ const SerDes = class { * @return {OlTilegridWMTS} tilegrid . */ deserializeTilegridWMTS(serialization) { - const options = /** @type {import ("ol/tilegrid/WMTS").Options} */ (JSON.parse(serialization)); + const options = /** @type {import ("ol/tilegrid/WMTS").Options} */(JSON.parse(serialization)); return new OlTilegridWMTS(options); } @@ -105,12 +105,12 @@ const SerDes = class { */ serializeSourceTileWMS(source) { const obj = this.createBaseObject_(source); - obj['params'] = source.getParams(); - obj['urls'] = source.getUrls(); - obj['tileGrid'] = this.serializeTilegrid(source.getTileGrid()); + obj.params = source.getParams(); + obj.urls = source.getUrls(); + obj.tileGrid = this.serializeTilegrid(source.getTileGrid()); const projection = source.getProjection(); if (projection) { - obj['projection'] = olProj.get(source.getProjection()).getCode(); + obj.projection = olProj.get(source.getProjection()).getCode(); } return JSON.stringify(obj); @@ -122,11 +122,11 @@ const SerDes = class { * @return {OlSourceTileWMS} source . */ deserializeSourceTileWMS(serialization, tileLoadFunction) { - const options = /** @type {import ("ol/source/TileWMS").Options} */ (JSON.parse(serialization)); + const options = /** @type {import ("ol/source/TileWMS").Options} */(JSON.parse(serialization)); // @ts-ignore options.tileLoadFunction = tileLoadFunction; if (options.tileGrid) { - options.tileGrid = this.deserializeTilegrid(/** @type{any} */ (options).tileGrid); + options.tileGrid = this.deserializeTilegrid(/** @type {any} */(options).tileGrid); } options.gutter = this.gutter_; return new OlSourceTileWMS(options); @@ -146,7 +146,7 @@ const SerDes = class { obj.style = source.getStyle(); obj.matrixSet = source.getMatrixSet(); // The OL getTileGrid method is expected to return a WMTS tilegrid so it is OK to cast here. - const tileGridWMTS = /** @type {OlTilegridWMTS} */ (source.getTileGrid()); + const tileGridWMTS = /** @type {OlTilegridWMTS} */(source.getTileGrid()); obj.tileGrid = this.serializeTilegridWMTS(tileGridWMTS); obj.requestEncoding = source.getRequestEncoding(); const projection = source.getProjection(); @@ -163,11 +163,11 @@ const SerDes = class { * @return {OlSourceWMTS} . */ deserializeSourceWMTS(serialization, tileLoadFunction) { - const options = /** @type {import("ol/source/WMTS").Options} */ (JSON.parse(serialization)); + const options = /** @type {import("ol/source/WMTS").Options} */(JSON.parse(serialization)); // @ts-ignore options.tileLoadFunction = tileLoadFunction; if (options.tileGrid) { - options.tileGrid = this.deserializeTilegridWMTS(/** @type{any} */(options).tileGrid); + options.tileGrid = this.deserializeTilegridWMTS(/** @type {any} */(options).tileGrid); } return new OlSourceWMTS(options); } @@ -213,13 +213,13 @@ const SerDes = class { * @return {!import("ol/layer/Tile.js").default} . */ deserializeTileLayer(serialization, tileLoadFunction) { - const options = /** @type import("ol/layer/Tile").Options */ (JSON.parse(serialization)); + const options = /** @type {import('ol/layer/BaseTile.js').Options} */(JSON.parse(serialization)); // @ts-ignore - const sourceType = options['sourceType']; + const sourceType = options.sourceType; if (sourceType === 'tileWMS') { - options.source = this.deserializeSourceTileWMS(/** @type any */ (options).source, tileLoadFunction); + options.source = this.deserializeSourceTileWMS(/** @type {any} */(options).source, tileLoadFunction); } else if (sourceType === 'WMTS') { - options.source = this.deserializeSourceWMTS(/** @type any */ (options).source, tileLoadFunction); + options.source = this.deserializeSourceWMTS(/** @type {any} */(options).source, tileLoadFunction); } return new OlLayerTile(options); } diff --git a/src/offline/TilesDownloader.js b/src/offline/TilesDownloader.js index 3c412746fe9a..f7b64e2d30ba 100644 --- a/src/offline/TilesDownloader.js +++ b/src/offline/TilesDownloader.js @@ -6,7 +6,7 @@ function blobToDataUrl(blob) { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.onload = function() { - resolve(/** @type String */ (reader.result)); + resolve(/** @type {String} */(reader.result)); }; reader.onerror = reject; reader.readAsDataURL(blob); diff --git a/src/profile/d3Elevation.js b/src/profile/d3Elevation.js index a5d98d77b908..06445c024e3d 100644 --- a/src/profile/d3Elevation.js +++ b/src/profile/d3Elevation.js @@ -357,7 +357,7 @@ function d3Elevation(options) { .attr('transform', `translate(${margin.left},${ margin.top})`); - xDomain = /** @type{[number, number]} */(d3extent(data, d => distanceExtractor(d))); + xDomain = /** @type {[number, number]} */(d3extent(data, d => distanceExtractor(d))); x.domain(xDomain); // Return an array with the min and max value of the min/max values of @@ -368,7 +368,7 @@ function d3Elevation(options) { // Get min/max values (extent) of each lines. for (const name in linesConfiguration) { /** @type {[number, number]} */ - const extent = /** @type{[number, number]} */( + const extent = /** @type {[number, number]} */( d3extent(data, d => linesConfiguration[name].zExtractor(d))); // only include defined extent if (extent.every(Number.isFinite)) { diff --git a/src/query/Querent.js b/src/query/Querent.js index c5b516b1069e..7a4836803ce1 100644 --- a/src/query/Querent.js +++ b/src/query/Querent.js @@ -219,8 +219,8 @@ export class Querent { getQueryableDataSources(dataSources, map) { const queryableDataSources = { - wfs: /** @type{ngeoDatasourceOGC[]} */([]), - wms: /** @type{ngeoDatasourceOGC[]} */([]), + wfs: /** @type {ngeoDatasourceOGC[]} */([]), + wms: /** @type {ngeoDatasourceOGC[]} */([]), }; const resolution = map.getView().getResolution(); if (resolution === undefined) { @@ -564,7 +564,7 @@ export class Querent { for (const dataSources of combinedDataSources) { /** @type {?import('ol/format/WFS.js').WriteGetFeatureOptions} */ let getFeatureCommonOptions = null; - /** @type{string[]} */ + /** @type {string[]} */ let featureTypes = []; /** @type {?string} */ let url = null; diff --git a/src/routing/RoutingComponent.js b/src/routing/RoutingComponent.js index 4011ab5dc193..61cf9e0b33ea 100644 --- a/src/routing/RoutingComponent.js +++ b/src/routing/RoutingComponent.js @@ -338,7 +338,7 @@ class Controller { const vias = this.viaArray.filter(via => via.feature !== null).map( via => this.getLonLatFromPoint_(via.feature) ); - const route = /** @type Array */([coordFrom].concat(vias, [coordTo])); + const route = /** @type {Array} */([coordFrom].concat(vias, [coordTo])); /** * @param {angular.IHttpResponse} resp @@ -361,10 +361,10 @@ class Controller { this.routeDuration = resp.data.routes[0].duration; // get first and last coordinate of route - const startRoute = /** @type{import("ol/geom/LineString.js").default} */( + const startRoute = /** @type {import("ol/geom/LineString.js").default} */( features[0].getGeometry() ).getCoordinateAt(0); - const endRoute = /** @type{import("ol/geom/LineString.js").default} */( + const endRoute = /** @type {import("ol/geom/LineString.js").default} */( features[features.length - 1].getGeometry() ).getCoordinateAt(1); diff --git a/src/routing/RoutingFeatureComponent.js b/src/routing/RoutingFeatureComponent.js index 577eae6f5f7e..bde48ab4abdf 100644 --- a/src/routing/RoutingFeatureComponent.js +++ b/src/routing/RoutingFeatureComponent.js @@ -303,7 +303,7 @@ class Controller { return; } // Update label - this.featureLabel = /** @type{string} */(this.feature.get('name') || ''); + this.featureLabel = /** @type {string} */(this.feature.get('name') || ''); // Update vector source this.vectorSource_.clear(); @@ -330,7 +330,7 @@ class Controller { const coordinate = selected.coordinate.map(parseFloat); const label = selected.label; this.setFeature_(coordinate, label); - const newCoordinates = /** @type{import("ol/geom/Point.js").default} */(this.feature.getGeometry()) + const newCoordinates = /** @type {import("ol/geom/Point.js").default} */(this.feature.getGeometry()) .getCoordinates(); this.map.getView().setCenter(newCoordinates); } diff --git a/tslint.json b/tslint.json new file mode 100644 index 000000000000..3016a27a85cc --- /dev/null +++ b/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "@sentry/typescript/tslint" +}