Skip to content

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Oct 20, 2025

Mainly for external PRs which don't realize that our paths are usually incompatible with the stdlib packages (especially filepath) outside certain circumstances.

Same goes for os, runtime.GOOS.

@Copilot Copilot AI review requested due to automatic review settings October 20, 2025 19:39
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a linter rule to prevent accidental usage of Go's standard path and path/filepath packages, enforcing the use of the internal tspath package instead. This helps external contributors avoid compatibility issues since the codebase uses custom path handling.

  • Enables the forbidigo linter to detect and flag usage of standard path libraries
  • Configures exemptions for test files, tools, and specific internal packages where standard path usage is acceptable
  • Adds a lint suppression comment to one existing legitimate use case in extension.go

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.golangci.yml Adds forbidigo linter with pattern rules to forbid path/filepath packages and defines exemption paths for tests and tools
internal/tspath/extension.go Adds nolint comment to exempt legitimate filepath.Ext usage

@jakebailey jakebailey changed the title Forbid non-tspath path library usage Forbid platform specific package uses in agnostic files Oct 20, 2025
Comment on lines +57 to +58
cmd := exec.Command("npm", args...)
cmd.Dir = cwd
Copy link
Member Author

Choose a reason for hiding this comment

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

A bit of a hack but I prefer this greatly to there being any chance that tests run npm install.

@jakebailey jakebailey enabled auto-merge October 20, 2025 22:45
@jakebailey jakebailey added this pull request to the merge queue Oct 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Oct 21, 2025
@jakebailey jakebailey added this pull request to the merge queue Oct 21, 2025
Merged via the queue into main with commit 55cbead Oct 21, 2025
22 checks passed
@jakebailey jakebailey deleted the jabaile/forbid-non-tspath branch October 21, 2025 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants