Skip to content
TypeScript

refactor(client-runtime): remove unused file position predicate (#9976)

Julius Marminge044a6e168ad1
diff --git a/packages/client-runtime/src/markdownLinks.test.ts b/packages/client-runtime/src/markdownLinks.test.ts
index 42cd7a35e47..4aea947b87d 100644
--- a/packages/client-runtime/src/markdownLinks.test.ts
+++ b/packages/client-runtime/src/markdownLinks.test.ts
@@ -3,7 +3,6 @@ import { describe, expect, it } from "vite-plus/test";
import {
fileBasename,
inlineCodeFilePathCandidate,
- isConventionalFilePosition,
parseFileUrlHref,
parseMarkdownFileLink,
splitFilePathPosition,
@@ -28,15 +27,6 @@ describe("inlineCodeFilePathCandidate", () => {
});
});
-describe("isConventionalFilePosition", () => {
- it("distinguishes extensionless file locations from labels and ports", () => {
- expect(isConventionalFilePosition("Dockerfile:8:2")).toBe(true);
- expect(isConventionalFilePosition("Makefile")).toBe(false);
- expect(isConventionalFilePosition("TODO:12")).toBe(false);
- expect(isConventionalFilePosition("port:3000")).toBe(false);
- });
-});
-
describe("parseFileUrlHref", () => {
it.each([
["file:///Users/julius/project/src/main.ts#L42", "/Users/julius/project/src/main.ts", "#L42"],
diff --git a/packages/client-runtime/src/markdownLinks.ts b/packages/client-runtime/src/markdownLinks.ts
index 2e455655d00..29a337e49c4 100644
--- a/packages/client-runtime/src/markdownLinks.ts
+++ b/packages/client-runtime/src/markdownLinks.ts
@@ -15,7 +15,6 @@ const INLINE_CODE_DISQUALIFIER_PATTERN = /[\s`]/;
const PATH_SEPARATOR_PATTERN = /[\\/]/;
const FILE_EXTENSION_PATTERN = /\.[A-Za-z0-9_-]+$/;
const NUMERIC_DOTTED_PATTERN = /^\d+(?:\.\d+)+$/;
-const BARE_EXTENSIONLESS_POSITION_PATTERN = /^[A-Za-z0-9_-]+(?::\d+){1,2}$/;
// Standard OS and dev-container roots; deliberately excludes app-route-ish
// prefixes like /app/ or /chat/ so SPA routes never read as files.
const POSIX_FILE_ROOT_PREFIXES = [
@@ -152,14 +151,6 @@ function looksLikeHostname(segment: string, hasPosition: boolean): boolean {
return !hasPosition && COUNTRY_HOSTNAME_TLDS.has(lastLabel);
}
-/** Recognizes conventional extensionless filenames with an explicit line position. */
-export function isConventionalFilePosition(path: string): boolean {
- return (
- BARE_EXTENSIONLESS_POSITION_PATTERN.test(path) &&
- EXTENSIONLESS_FILE_NAMES.has(path.replace(POSITION_SUFFIX_PATTERN, ""))
- );
-}
-
/**
* Picks path-shaped inline code for the client's markdown file-link resolver.
* It does not resolve paths or turn plain prose and fenced code into links.