mirror of
https://github.com/ccmdi/obsidian-map-plus.git
synced 2026-07-22 06:43:14 +00:00
refactor: clean up types/eslint
This commit is contained in:
parent
cbe1021b27
commit
3a3940ddd5
4 changed files with 7 additions and 14 deletions
|
|
@ -41,8 +41,7 @@ export default class MapPlugin extends Plugin {
|
|||
}
|
||||
|
||||
async loadSettings() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData() as MapPluginSettings);
|
||||
}
|
||||
|
||||
async saveSettings() {
|
||||
|
|
|
|||
|
|
@ -465,6 +465,7 @@ export function createMapRenderer(config: MapRendererOptions): Deck<MapViewType[
|
|||
_offset: number;
|
||||
tile: Tile2DHeader<HTMLImageElement>;
|
||||
}) => {
|
||||
//TODO: replace with boundingBox
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
const bbox = props.tile.bbox;
|
||||
if (!('west' in bbox)) return null;
|
||||
|
|
@ -497,8 +498,7 @@ export function createMapRenderer(config: MapRendererOptions): Deck<MapViewType[
|
|||
const tooltip = containerEl.createEl('div', { cls: 'map-tooltip' });
|
||||
|
||||
const numPoints = points.length;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const deckData: DeckDataPoint[] = new Array(numPoints);
|
||||
const deckData: DeckDataPoint[] = new Array<DeckDataPoint>(numPoints);
|
||||
|
||||
for (let i = 0; i < numPoints; i++) {
|
||||
const point = points[i];
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ export class ThumbnailCacheManager {
|
|||
|
||||
if (exists) {
|
||||
const content = await this.app.vault.adapter.read(metadataPath);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
this.cache = JSON.parse(content);
|
||||
this.cache = JSON.parse(content) as ThumbnailCacheMetadata;
|
||||
}
|
||||
|
||||
this.cacheLoaded = true;
|
||||
|
|
|
|||
|
|
@ -129,8 +129,7 @@ export class MapBasesView extends BasesView {
|
|||
if (!boundsStr || typeof boundsStr !== 'string') return undefined;
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const parsed = JSON.parse(boundsStr);
|
||||
const parsed = JSON.parse(boundsStr) as unknown[];
|
||||
if (Array.isArray(parsed) && parsed.length === 2 &&
|
||||
Array.isArray(parsed[0]) && parsed[0].length === 2 &&
|
||||
Array.isArray(parsed[1]) && parsed[1].length === 2) {
|
||||
|
|
@ -377,9 +376,7 @@ export class MapBasesView extends BasesView {
|
|||
|
||||
const fileCache = this.app.metadataCache.getFileCache(entry.file);
|
||||
if (fileCache?.frontmatter?.tags) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const tags = fileCache.frontmatter.tags;
|
||||
point.tags = Array.isArray(tags) ? tags : [tags];
|
||||
point.tags = fileCache.frontmatter.tags as string[];
|
||||
}
|
||||
|
||||
if (coverProp) {
|
||||
|
|
@ -554,8 +551,7 @@ export class MapBasesView extends BasesView {
|
|||
// Handle string value as JSON array
|
||||
if (value instanceof StringValue) {
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const parsed = JSON.parse(value.toString().trim());
|
||||
const parsed = JSON.parse(value.toString().trim()) as unknown[];
|
||||
if (Array.isArray(parsed)) {
|
||||
const coords: [number, number][] = [];
|
||||
for (const item of parsed) {
|
||||
|
|
@ -608,7 +604,6 @@ export class MapBasesView extends BasesView {
|
|||
|
||||
const performSearch = async (query: string) => {
|
||||
try {
|
||||
// Using Photon API (free, no API key, OSM-based)
|
||||
const response = await requestUrl(`https://photon.komoot.io/api/?q=${encodeURIComponent(query)}&limit=5`);
|
||||
const data = response.json as PhotonResponse;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue