Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix check warnings #9523

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions api/src/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,31 @@

/**
* @typedef {Object} MarkerOptions
* @property {[number, number]} [position]
* @property {string} [icon]
* @property {[number, number]} [position] coordinates of the marker.
* @property {string} [icon] image path for the marker.
*/

/**
* @typedef {Object} MapOptions
* @property {string} div
* @property {import('ol/coordinate').Coordinate} center
* @property {number} [zoom=10]
* @property {boolean} [showCoords=true]
* @property {boolean} [addMiniMap=false]
* @property {boolean} [miniMapExpanded=true]
* @property {boolean} [addLayerSwitcher=false]
* @property {boolean} [searchDiv]
* @property {string[]} [layers]
* @property {string[]} [backgroundLayers]
* @property {string} div target to render the map into.
* @property {import('ol/coordinate').Coordinate} center coordinater of the map's center.
* @property {number} [zoom=10] initial zoom.
* @property {boolean} [showCoords=true] show coordinates or not.
* @property {boolean} [addMiniMap=false] with mini map or not.
* @property {boolean} [miniMapExpanded=true] allow mini map expand or not.
* @property {boolean} [addLayerSwitcher=false] with or without layer switcher.
* @property {boolean} [searchDiv] div containing the search element.
* @property {string[]} [layers] layers on the map.
* @property {string[]} [backgroundLayers] backgrounds on the map.
*/

/**
* Attr is ['title', 'description'] by default

Check warning on line 83 in api/src/Map.js

View workflow job for this annotation

GitHub Actions / Continuous integration

Expected only 0 line after block description
*
* @typedef {Object} CustomLayer
* @property {string[]} [attr]
* @property {function(): void} [success]
* @property {function(): void} [error]
* @property {string[]} [attr] attributes of the layer.
* @property {function(): void} [success] success callback.
* @property {function(): void} [error] error callback.
*/

/**
Expand All @@ -95,13 +95,13 @@

/**
* @private
* @hidden

Check warning on line 98 in api/src/Map.js

View workflow job for this annotation

GitHub Actions / Continuous integration

Invalid JSDoc tag name "hidden"
*/
class Map {
/**
* @param {MapOptions} options API options.
*/
constructor(options) {

Check warning on line 104 in api/src/Map.js

View workflow job for this annotation

GitHub Actions / Continuous integration

Argument 'options' should be typed
const request = new XMLHttpRequest();
request.open('GET', dynamicUrl.dynamicUrl, false);
request.send(null);
Expand All @@ -110,7 +110,7 @@
throw new Error('Error on getting the dynamic configuration');
}

Object.assign(constants, JSON.parse(request.responseText)['constants']);

Check warning on line 113 in api/src/Map.js

View workflow job for this annotation

GitHub Actions / Continuous integration

Unsafe member access ['constants'] on an `any` value
createProjections(constants.projections);

/** @type {import('ol/View').ViewOptions} */
Expand Down Expand Up @@ -189,11 +189,11 @@
if (!resolutions) {
throw new Error('Missing resolutions');
}
themes.getBackgroundLayers().then((layers) => {

Check warning on line 192 in api/src/Map.js

View workflow job for this annotation

GitHub Actions / Continuous integration

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
// The options is an array for backward compatibility reason.
const backgroundLayer = options.backgroundLayers || [constants.backgroundLayer];
for (const layer of layers) {
if (backgroundLayer.includes(layer.get('config.name'))) {

Check warning on line 196 in api/src/Map.js

View workflow job for this annotation

GitHub Actions / Continuous integration

Unsafe argument of type error typed assigned to a parameter of type `string`

Check warning on line 196 in api/src/Map.js

View workflow job for this annotation

GitHub Actions / Continuous integration

Unsafe call of a(n) `error` type typed value

Check warning on line 196 in api/src/Map.js

View workflow job for this annotation

GitHub Actions / Continuous integration

Unsafe member access .get on an `error` typed value
this.map_.addControl(
new OverviewMap({
collapsed: !options.miniMapExpanded,
Expand All @@ -215,11 +215,11 @@
}

// Get background layer first...
themes.getBackgroundLayers().then((layers) => {

Check warning on line 218 in api/src/Map.js

View workflow job for this annotation

GitHub Actions / Continuous integration

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
// The options is an array for backward compatibility reason.
const backgroundLayer = options.backgroundLayers || [constants.backgroundLayer];
for (const layer of layers) {
if (backgroundLayer.includes(layer.get('config.name'))) {

Check warning on line 222 in api/src/Map.js

View workflow job for this annotation

GitHub Actions / Continuous integration

Unsafe argument of type error typed assigned to a parameter of type `string`
// we don't want the background layer in the layerswitch so we remove the title.
layer.set('title', undefined);
this.map_.addLayer(layer);
Expand Down
Loading