Deduplicate shared helpers and enforce aliased imports (#228)

* Deduplicate string cleanup helpers and not-found responses

* Enforce aliased imports for infra and shared modules

* Enforce @client/@server aliases for deep relative imports

* Deduplicate visa sponsor and location filter definitions

* Use shared city filter export in extractor location checks
This commit is contained in:
Shaheer Sarfaraz
2026-02-22 16:13:52 +00:00
committed by GitHub
parent 16acdf2b5e
commit 3da5ea35b4
67 changed files with 385 additions and 346 deletions
+1 -9
View File
@@ -65,13 +65,6 @@ export interface HiringCafeResult {
error?: string;
}
export function shouldApplyStrictLocationFilter(
location: string,
countryKey: string,
): boolean {
return shouldApplyStrictCityFilter(location, countryKey);
}
function resolveTsxCliPath(): string | null {
try {
return require.resolve("tsx/dist/cli.mjs");
@@ -213,8 +206,7 @@ export async function runHiringCafe(
for (let runIndex = 0; runIndex < runLocations.length; runIndex += 1) {
const location = runLocations[runIndex];
const strictLocationFilter =
location !== null &&
shouldApplyStrictLocationFilter(location, countryKey);
location !== null && shouldApplyStrictCityFilter(location, countryKey);
await clearStorageDataset();
+4 -6
View File
@@ -1,15 +1,13 @@
import { shouldApplyStrictCityFilter } from "@shared/search-cities.js";
import { describe, expect, it } from "vitest";
import { shouldApplyStrictLocationFilter } from "../src/run";
describe("hiringcafe location query strictness", () => {
it("enables strict filtering when city differs from country", () => {
expect(shouldApplyStrictLocationFilter("Leeds", "united kingdom")).toBe(
true,
);
expect(shouldApplyStrictCityFilter("Leeds", "united kingdom")).toBe(true);
});
it("disables strict filtering when location is country-level", () => {
expect(shouldApplyStrictLocationFilter("UK", "united kingdom")).toBe(false);
expect(shouldApplyStrictLocationFilter("United States", "us")).toBe(false);
expect(shouldApplyStrictCityFilter("UK", "united kingdom")).toBe(false);
expect(shouldApplyStrictCityFilter("United States", "us")).toBe(false);
});
});