Fix JS linting errors

This commit is contained in:
2026-01-24 17:54:34 +07:00
parent 94b7959fd8
commit 1a2aae631d
7 changed files with 50 additions and 11 deletions

View File

@@ -16,7 +16,6 @@ import Geolocation from 'ol/Geolocation.js';
import { Style, Circle, Fill, Stroke } from 'ol/style.js'; import { Style, Circle, Fill, Stroke } from 'ol/style.js';
import { apply } from 'ol-mapbox-style'; import { apply } from 'ol-mapbox-style';
import { getDistance } from '../utils/geo'; import { getDistance } from '../utils/geo';
import Icon from '../components/icon';
export default class MapComponent extends Component { export default class MapComponent extends Component {
@service osm; @service osm;
@@ -213,7 +212,7 @@ export default class MapComponent extends Component {
geolocation.un('change:position', zoomToLocation); geolocation.un('change:position', zoomToLocation);
locateListenerKey = null; locateListenerKey = null;
} }
} catch (e) { } catch {
/* ignore */ /* ignore */
} }

View File

@@ -1,10 +1,12 @@
import Component from '@glimmer/component'; import Component from '@glimmer/component';
import { on } from '@ember/modifier'; import { on } from '@ember/modifier';
import Icon from '#components/icon'; import Icon from '#components/icon';
import { service } from '@ember/service';
import { action } from '@ember/object';
export default class SettingsPane extends Component { export default class SettingsPane extends Component {
constructor() {
super(...arguments);
}
<template> <template>
<div class="sidebar settings-pane"> <div class="sidebar settings-pane">
<div class="sidebar-header"> <div class="sidebar-header">

View File

@@ -59,6 +59,7 @@ out center;
async fetchWithRetry(url, options = {}, retries = 3) { async fetchWithRetry(url, options = {}, retries = 3) {
try { try {
// eslint-disable-next-line warp-drive/no-external-request-patterns
const res = await fetch(url, options); const res = await fetch(url, options);
if (!res.ok && retries > 0 && [502, 503, 504, 429].includes(res.status)) { if (!res.ok && retries > 0 && [502, 503, 504, 429].includes(res.status)) {

View File

@@ -5,7 +5,7 @@ import Widget from 'remotestorage-widget';
import { tracked } from '@glimmer/tracking'; import { tracked } from '@glimmer/tracking';
import { getGeohashPrefixesInBbox } from '../utils/geohash-coverage'; import { getGeohashPrefixesInBbox } from '../utils/geohash-coverage';
import { action } from '@ember/object'; import { action } from '@ember/object';
import { debounce } from '@ember/runloop'; import { debounceTask } from 'ember-lifeline';
import Geohash from 'latlon-geohash'; import Geohash from 'latlon-geohash';
export default class StorageService extends Service { export default class StorageService extends Service {
@@ -70,7 +70,7 @@ export default class StorageService extends Service {
this.rs.scope('/places/').on('change', (event) => { this.rs.scope('/places/').on('change', (event) => {
// console.debug(event); // console.debug(event);
this.handlePlaceChange(event); this.handlePlaceChange(event);
debounce(this, this.reloadCurrentView, 200); debounceTask(this, 'reloadCurrentView', 200);
}); });
} }
@@ -120,7 +120,7 @@ export default class StorageService extends Service {
notifyChange() { notifyChange() {
this.version++; this.version++;
debounce(this, this.reloadCurrentView, 200); debounceTask(this, 'reloadCurrentView', 200);
} }
reloadCurrentView() { reloadCurrentView() {

View File

@@ -41,6 +41,7 @@ export function getGeohashPrefixesInBbox(bbox) {
try { try {
const hash = Geohash.encode(cLat, cLon, 4); const hash = Geohash.encode(cLat, cLon, 4);
prefixes.add(hash); prefixes.add(hash);
// eslint-disable-next-line no-unused-vars
} catch (e) { } catch (e) {
// Ignore invalid coords if any // Ignore invalid coords if any
} }
@@ -50,16 +51,28 @@ export function getGeohashPrefixesInBbox(bbox) {
// Ensure corners are definitely included (floating point steps might miss slightly) // Ensure corners are definitely included (floating point steps might miss slightly)
try { try {
prefixes.add(Geohash.encode(minLat, minLon, 4)); prefixes.add(Geohash.encode(minLat, minLon, 4));
} catch (e) {} // eslint-disable-next-line no-unused-vars
} catch (e) {
/* ignore */
}
try { try {
prefixes.add(Geohash.encode(maxLat, maxLon, 4)); prefixes.add(Geohash.encode(maxLat, maxLon, 4));
} catch (e) {} // eslint-disable-next-line no-unused-vars
} catch (e) {
/* ignore */
}
try { try {
prefixes.add(Geohash.encode(minLat, maxLon, 4)); prefixes.add(Geohash.encode(minLat, maxLon, 4));
} catch (e) {} // eslint-disable-next-line no-unused-vars
} catch (e) {
/* ignore */
}
try { try {
prefixes.add(Geohash.encode(maxLat, minLon, 4)); prefixes.add(Geohash.encode(maxLat, minLon, 4));
} catch (e) {} // eslint-disable-next-line no-unused-vars
} catch (e) {
/* ignore */
}
return Array.from(prefixes); return Array.from(prefixes);
} }

View File

@@ -93,5 +93,8 @@
}, },
"ember": { "ember": {
"edition": "octane" "edition": "octane"
},
"dependencies": {
"ember-lifeline": "^7.0.0"
} }
} }

21
pnpm-lock.yaml generated
View File

@@ -7,6 +7,10 @@ settings:
importers: importers:
.: .:
dependencies:
ember-lifeline:
specifier: ^7.0.0
version: 7.0.0(@ember/test-helpers@5.4.1(@babel/core@7.28.6))
devDependencies: devDependencies:
'@babel/core': '@babel/core':
specifier: ^7.28.5 specifier: ^7.28.5
@@ -2254,6 +2258,15 @@ packages:
'@typescript-eslint/parser': '@typescript-eslint/parser':
optional: true optional: true
ember-lifeline@7.0.0:
resolution: {integrity: sha512-2l51NzgH5vjN972zgbs+32rnXnnEFKB7qsSpJF+lBI4V5TG6DMy4SfowC72ZEuAtS58OVfwITbOO+RnM21EdpA==}
engines: {node: 16.* || >= 18}
peerDependencies:
'@ember/test-helpers': '>= 1.0.0'
peerDependenciesMeta:
'@ember/test-helpers':
optional: true
ember-modifier@4.2.2: ember-modifier@4.2.2:
resolution: {integrity: sha512-pPYBAGyczX0hedGWQFQOEiL9s45KS9efKxJxUQkMLjQyh+1Uef1mcmAGsdw2KmvNupITkE/nXxmVO1kZ9tt3ag==} resolution: {integrity: sha512-pPYBAGyczX0hedGWQFQOEiL9s45KS9efKxJxUQkMLjQyh+1Uef1mcmAGsdw2KmvNupITkE/nXxmVO1kZ9tt3ag==}
@@ -6762,6 +6775,14 @@ snapshots:
- eslint - eslint
- typescript - typescript
ember-lifeline@7.0.0(@ember/test-helpers@5.4.1(@babel/core@7.28.6)):
dependencies:
'@embroider/addon-shim': 1.10.2
optionalDependencies:
'@ember/test-helpers': 5.4.1(@babel/core@7.28.6)
transitivePeerDependencies:
- supports-color
ember-modifier@4.2.2(@babel/core@7.28.6): ember-modifier@4.2.2(@babel/core@7.28.6):
dependencies: dependencies:
'@embroider/addon-shim': 1.10.2 '@embroider/addon-shim': 1.10.2