Skip to content

Match typed-path lint URL detection to runtime roots - #65490

Open
Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/typedpaths-url-prefixes
Open

Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/typedpaths-url-prefixes

Conversation

@jakebailey

Copy link
Copy Markdown
Member

The lint rule was wrong here.

Drive-like prefixes are URL roots unless they satisfy the runtime's DOS
root rules. Treating every second-character colon as a drive bypasses URL
query and fragment validation for strings that runtime rejects.

Require a letter and a rooted drive suffix, reuse the URL classifier for
suffix parsing, and cover rejected queries alongside accepted drive and
URL edge cases in the analyzer fixtures.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the typed-path URL and Windows drive-root detection changes.

No open issues 🎉

What changed in this PR

Aligns typed-path lint URL detection with runtime path-root handling, distinguishing Windows drive roots from URL-like paths.

Changes:

  • Restricts drive-root detection to alphabetic drive letters followed by a colon and either a separator or the end of the string.
  • Reuses URL detection when extracting URL path components.
  • Adds accepted and rejected constructor cases and updates expected diagnostics.
File Description
tools/​customlint/​typedpaths.go Corrects drive-root detection and shares URL classification logic.
tools/​customlint/​testdata/​typedpaths/​typedpaths.go.golden Updates expected diagnostics for the new regression cases.
tools/​customlint/​testdata/​typedpaths/​typedpaths.go Adds coverage for drive roots, URL-like paths, and query or fragment characters.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants