Skip to content

Conversation

@jakebailey
Copy link
Member

Getting this lint rule prototype out of my git stash.

Exported APIs containing unexported elements is generally annoying, because it means consuming code can't write down the type name but can do things with it (even still creating values of that type via generic helpers!). It also means people doing funky stuff like tsgolint have to work around APIs that aren't fully declared.

This PR adds a lint rule to find these cases and complain, then fixes everything.

Copilot AI review requested due to automatic review settings October 29, 2025 22:17
Copy link
Contributor

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 systematically exports internal types throughout the codebase by capitalizing their names (e.g., usageUsage, fileIncludeReasonFileIncludeReason). The changes also add a new custom linter unexportedapi to detect exported APIs that reference unexported types, helping maintain API consistency going forward.

Key changes:

  • Export numerous internal types across multiple packages (vfs, project, compiler, checker, execute, etc.)
  • Add unexportedapi custom linter with comprehensive test coverage
  • Update all references to use the new exported names

Reviewed Changes

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

Show a summary per file
File Description
internal/vfs/utilities.go Exports Usage type and related constants
internal/repo/paths.go Exports SkippableTest interface
internal/project/*.go Exports multiple types: PatternsAndIgnored, SnapshotFS, Overlay, ExtendedConfigCache, ProjectCollectionBuilder, CheckerPool
internal/compiler/*.go Exports FileIncludeReason type and updates all references
internal/execute/incremental/*.go Exports FileInfo, DiagnosticsOrBuildInfoDiagnosticsWithFileName
internal/execute/build/*.go Exports BuildTask type
internal/execute/tsctests/*.go Exports TestSys type
internal/checker/*.go Exports NodeBuilderImpl, EmitResolver
internal/ast/ast.go Exports MutableNode type
internal/ls/*.go Exports ReferenceEntry, DefinitionKind, SortText, ExportInfoMap
internal/pprof/pprof.go Exports ProfileSession
internal/fourslash/fourslash.go Simplifies AnyTextEdits from type alias to direct variable
internal/format/*.go Exports FormattingContext
_tools/customlint/*.go Adds new unexportedapi linter with comprehensive tests

@jakebailey
Copy link
Member Author

FYI @camc314

@jakebailey jakebailey added this pull request to the merge queue Oct 31, 2025
Merged via the queue into main with commit 10186e0 Oct 31, 2025
28 checks passed
@jakebailey jakebailey deleted the jabaile/unexported-lint branch October 31, 2025 17:41
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.

3 participants