Skip to content

Commit

Permalink
apply automated linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bdon committed Jan 29, 2024
1 parent 5e41bd6 commit 5057b4d
Show file tree
Hide file tree
Showing 8 changed files with 473 additions and 315 deletions.
32 changes: 16 additions & 16 deletions js/adapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ declare const L: any;
declare const window: any;
declare const document: any;

import { PMTiles, Source, TileType } from "./index";
import { PMTiles, TileType } from "./index";

export const leafletRasterLayer = (source: PMTiles, options: any) => {
let loaded = false;
let mimeType: string = "";
let mimeType = "";
const cls = L.GridLayer.extend({
createTile: function (coord: any, done: any) {
createTile: (coord: any, done: any) => {
const el: any = document.createElement("img");
const controller = new AbortController();
const signal = controller.signal;
Expand All @@ -19,7 +19,7 @@ export const leafletRasterLayer = (source: PMTiles, options: any) => {
source.getHeader().then((header) => {
if (header.tileType == TileType.Mvt) {
console.error(
"Error: archive contains MVT vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."
"Error: archive contains MVT vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details.",
);
} else if (header.tileType == 2) {
mimeType = "image/png";
Expand Down Expand Up @@ -89,7 +89,7 @@ type ResponseCallback = (
error?: Error | null,
data?: any | null,
cacheControl?: string | null,
expires?: string | null
expires?: string | null,
) => void;

type Cancelable = {
Expand All @@ -113,14 +113,14 @@ export class Protocol {

tile = (
params: RequestParameters,
callback: ResponseCallback
callback: ResponseCallback,
): Cancelable => {
if (params.type == "json") {
const pmtiles_url = params.url.substr(10);
let instance = this.tiles.get(pmtiles_url);
const pmtilesUrl = params.url.substr(10);
let instance = this.tiles.get(pmtilesUrl);
if (!instance) {
instance = new PMTiles(pmtiles_url);
this.tiles.set(pmtiles_url, instance);
instance = new PMTiles(pmtilesUrl);
this.tiles.set(pmtilesUrl, instance);
}

instance
Expand Down Expand Up @@ -150,20 +150,20 @@ export class Protocol {
cancel: () => {},
};
}
const pmtiles_url = result[1];
const pmtilesUrl = result[1];

let instance = this.tiles.get(pmtiles_url);
let instance = this.tiles.get(pmtilesUrl);
if (!instance) {
instance = new PMTiles(pmtiles_url);
this.tiles.set(pmtiles_url, instance);
instance = new PMTiles(pmtilesUrl);
this.tiles.set(pmtilesUrl, instance);
}
const z = result[2];
const x = result[3];
const y = result[4];

const controller = new AbortController();
const signal = controller.signal;
let cancel = () => {
const cancel = () => {
controller.abort();
};

Expand All @@ -176,7 +176,7 @@ export class Protocol {
null,
new Uint8Array(resp.data),
resp.cacheControl,
resp.expires
resp.expires,
);
} else {
if (header.tileType == TileType.Mvt) {
Expand Down
20 changes: 20 additions & 0 deletions js/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"javascript": {
"formatter": {
"trailingComma": "es5"
}
},
"formatter": {
"indentStyle": "space"
},
"linter": {
"rules": {
"style": {
"useNamingConvention": {}
},
"nursery": {
"noUnusedImports": {}
}
}
}
}
Loading

0 comments on commit 5057b4d

Please sign in to comment.