Add @internal JSDoc annotations and CI lint to enforce export boundaries#21
Open
parthban-db wants to merge 1 commit into
Open
Add @internal JSDoc annotations and CI lint to enforce export boundaries#21parthban-db wants to merge 1 commit into
parthban-db wants to merge 1 commit into
Conversation
…e public API and introduces a CI lint script to enforce the convention going forward.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🥞 Stacked PR
Use this link to review incremental changes.
Summary
Adds
@internalJSDoc tags to exported symbols that are not part of the public API and introduces a CI lint script to enforce the convention going forward.Why
Source files use
exportfor cross-file usage within a package, but only a subset of those exports are re-exported fromindex.tsbarrel files (the actual public API). Today, there is no way to tell at a glance whether an exported symbol is public or package-internal — you have to cross-reference the barrel file manually. This makes it easy to accidentally treat an internal symbol as public, or to forget marking a new internal export.What changed
Interface changes
None. No new public API surface. The
@internaltag is a documentation-only annotation that signals "this export exists for intra-package use and is not part of the public contract."Behavioral changes
None. Existing consumers are unaffected.
Internal changes
@internalannotations added to three non-public exports:toCode()inpackages/databricks/src/apierror/apierror.tsparseErrorDetails()inpackages/databricks/src/apierror/details.tsrandinpackages/databricks/src/api/retrier.tsscripts/check-internal-exports.ts— new lint script that uses the TypeScript compiler API to:exportsfield to discover barrel files./** @internal */and public exports do not.package.json— addedcheck:internalscript (node --experimental-strip-types; no new dependencies)..github/workflows/ci.yml— addedcheck:internalstep to the lint job.How is this tested?
npm run check:internalpasses clean on the current codebase.@internalfrom a non-public export (toCode) causes the script to fail with an actionable error message.@internalto a public export (APIError) causes the script to fail.