Skip to content

feat(lint): scope public-API rules to the package's public surface#50

Draft
natemoo-re wants to merge 1 commit into
mainfrom
feat/lint-public-surface
Draft

feat(lint): scope public-API rules to the package's public surface#50
natemoo-re wants to merge 1 commit into
mainfrom
feat/lint-public-surface

Conversation

@natemoo-re

Copy link
Copy Markdown
Member

Summary

bombshell-dev/exported-function-async and bombshell-dev/require-export-jsdoc exist to prevent breaking changes for consumers — but they fired on every export in the repo, which trained agents to sprinkle // oxlint-disable-line comments everywhere (1,194 and 444 occurrences across session logs, including one project with disable headers prepended to 26 files).

This PR adds src/surface.ts, which derives the public API surface from package.json (exports, bin, main/module, mapping dist/ paths back to src/), including conventional packages/*/ workspace members. bsh lint generates an effective oxlint config at runtime that lifts those two rules out of the global ruleset and re-applies them via overrides scoped to the surface.

Design decisions:

  • Wildcard passthroughs ("./": "./dist/*") do not designate surface — they make files importable by convention but aren't a curated public API
  • Surface = entry files only; no transitive re-export graph walk (possible follow-up)
  • Packages with no publish surface (apps, examples) are exempt entirely

Validation

  • Spiked first: confirmed oxlint jsPlugin rules work inside overrides blocks (patterns resolve relative to the config location, so the effective config is written into the project root and cleaned up after)
  • 8 unit tests for getPublicSurface + 2 integration tests through runOxlint
  • On cooper/packages/identity: the false exported-function-async warnings on internal modules go silent; self-lint warnings on this repo drop 61 → 44

Includes changeset (minor).

Derives the public API surface from package.json (exports/bin/main,
dist paths mapped back to src) and applies exported-function-async and
require-export-jsdoc only to those files via oxlint overrides, instead
of firing on every export in the repo. Internal modules, apps without a
publish surface, and wildcard passthroughs are exempt.
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 58be12f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bomb.sh/tools Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@bomb.sh/tools@50

commit: 58be12f

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.

1 participant