Skip to content

Commit

Permalink
refactor: 🚨 fix biome issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffJacobson committed Nov 25, 2024
1 parent b07437f commit 359583e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 32 deletions.
11 changes: 3 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
],
"json.schemas": [
{
"fileMatch": [
".ncurc",
".ncurc.json"
],
"fileMatch": [".ncurc", ".ncurc.json"],
"url": "https://raw.githubusercontent.com/raineorshine/npm-check-updates/main/src/types/RunOptions.json"
}
],
Expand All @@ -38,9 +35,7 @@
"https://json.schemastore.org/github-workflow.json": [
".github/workflows/node.js.yml"
],
"https://json.schemastore.org/lefthook.json": [
"lefthook.yml"
],
"https://json.schemastore.org/lefthook.json": ["lefthook.yml"],
"https://raw.githubusercontent.com/raineorshine/npm-check-updates/main/src/types/RunOptions.json": [
".ncurc.yml"
]
Expand All @@ -52,4 +47,4 @@
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
}
8 changes: 2 additions & 6 deletions biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
},
"files": {
"ignoreUnknown": false,
"ignore": [
"**/wsdot-web-styles/**",
"tests/routes.json",
"*.arcade"
]
"ignore": ["**/wsdot-web-styles/**", "tests/routes.json", "*.arcade"]
},
"formatter": {
"enabled": true,
Expand All @@ -31,4 +27,4 @@
"quoteStyle": "double"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MilepostLocationRenderer from "./Milepost Location Renderer.json";
import SimpleRenderer from "@arcgis/core/renderers/SimpleRenderer";
import MilepostLocationRenderer from "./Milepost Location Renderer.json";

/**
* Simple Renderer using a CIM symbol.
Expand Down
5 changes: 3 additions & 2 deletions src/setupPopupActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ export function setupPopupActions(view: __esri.MapView) {
document.body.append(alert);

const copyPointToClipboard = (point: __esri.Point) => {
let projectedPoint = point;
const { spatialReference } = point;
if (spatialReference.isWebMercator) {
point = webMercatorToGeographic(point) as __esri.Point;
projectedPoint = webMercatorToGeographic(point) as __esri.Point;
} else if (!spatialReference.isWGS84) {
throw new Error(
`Unsupported spatial reference: ${spatialReference.wkid}`,
);
}

const { x, y } = point;
const { x, y } = projectedPoint;
messageElement.textContent = `Copied ${[y, x].map((x) => x.toFixed(3)).join(",")} to clipboard.`;

navigator.clipboard
Expand Down
7 changes: 3 additions & 4 deletions src/widgets/LoadingIndicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export function setupViewLoadingIndicator(view: View) {
// Add the map loading indicator.
view.ui.add(viewProgress, "bottom-trailing");
// Make the view loading indicator only show up when the map is updating.
return view.watch(
"updating",
(updating) => (viewProgress.hidden = !updating),
);
return view.watch("updating", (updating) => {
viewProgress.hidden = !updating;
});
}
14 changes: 7 additions & 7 deletions tests/CIM.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import renderer from "../src/layers/MilepostLayer/milepost-line-layer/MilepostOffsetLineRenderer";
import { describe, test } from "vitest";
import renderer from "../src/layers/MilepostLayer/milepost-line-layer/MilepostOffsetLineRenderer";

describe.concurrent(
"CIM renderer from JSON exported from ArcGIS Online",
() => {
test("renderer was created successfully", ({ expect }) => {
expect(renderer).toBeDefined();
});
},
"CIM renderer from JSON exported from ArcGIS Online",
() => {
test("renderer was created successfully", ({ expect }) => {
expect(renderer).toBeDefined();
});
},
);
8 changes: 4 additions & 4 deletions tests/milepost-info.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ describe.concurrent("getRouteList", () => {
const routes = await getRouteList();
expect(routes.length).toBeGreaterThan(0);
for (const { RouteID, Direction, MinSrmp, MaxSrmp } of routes) {
[RouteID, Direction].forEach((x) => {
for (const x of [RouteID, Direction]) {
expect(x).to.be.a("string");
});
}
expect(RouteID).length.to.be.at.least(3);
expect(RouteID).length.to.not.be.greaterThan(12);
expect(Direction).length.to.be.at.least(1);
[MinSrmp, MaxSrmp].forEach((x) => {
for (const x of [MinSrmp, MaxSrmp]) {
expect(x).to.be.a("number");
expect(x).to.be.at.least(0);
});
}
}
});
});

0 comments on commit 359583e

Please sign in to comment.