Skip to content

refactor: normalize error messages and descriptions#12214

Merged
kgryte merged 2 commits into
developfrom
philipp/drift-tools-lint-2026-05-20
May 20, 2026
Merged

refactor: normalize error messages and descriptions#12214
kgryte merged 2 commits into
developfrom
philipp/drift-tools-lint-2026-05-20

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • Normalizes two outlier packages in the @stdlib/_tools/lint/* namespace to the conventions used by the rest of the namespace, found via a cross-package drift sweep. No observable behavior changes — error type, JSDoc tag set, and CLI output are otherwise unchanged.

Namespace summary

  • Namespace: @stdlib/_tools/lint (9 non-autogenerated packages)
  • Features analyzed: file tree, package.json shape, README section list, lib/async.js / lib/main.js JSDoc shape, error-construction style, validation prologue, docs/usage.txt formatting.
  • Clear majority (≥75% conformance): error-message phrasing for callback validation; presence of @throws {TypeError} options argument must be an object in the JSDoc of packages that accept an options object; leading newline in docs/usage.txt.
  • No clear majority (excluded): presence of os field in package.json (2/9 vs 7/9 split, intentional vs accidental unclear); the cb vs clbk callback parameter name; presence of lib/sync.js / lib/async.js / lib/validate.js (genuine API-shape differences across packages).

@stdlib/_tools/lint/namespace-aliases

Replaces "Last argument must be a function." with "Callback argument must be a function." in the TypeError thrown by lib/async.js, and updates the matching @throws JSDoc tag. All 7 other sibling packages with a callback-arity validation use the "Callback argument" phrasing (87.5% conformance, 7/8 of comparable siblings); the function signature is lint( options, clbk ) with clbk unambiguously the callback, so the "Last argument" wording is a copy-paste outlier with no semantic justification.

@stdlib/_tools/lint/pkg-json-names

Two corrections in this package:

  • Adds the missing * @throws {TypeError} options argument must be an object line to the JSDoc for lib/async.js. The throw is already implemented in lib/validate.js but undocumented at the public entry. All 6 sibling packages that accept an options object document this throw (100% conformance).
  • Prepends a leading blank line to docs/usage.txt. The file is read at runtime into the CLI's --help output, and 8 of 8 sibling packages start their docs/usage.txt with \n; pkg-json-names was the only one starting on the Usage: line, which produced subtly different vertical spacing in --help.

Validation

  • Structural extraction over file tree, package.json keys, README section list, and docs/usage.txt first byte across all 9 namespace members.
  • Semantic extraction of JSDoc shape, validation prologue, and error-construction style.
  • Three-agent drift validation (semantic, cross-reference, structural) confirmed each correction was a confirmed-drift rather than an intentional deviation. Cross-reference verified that tests in both packages assert only on instanceof TypeError, never on message text, and that the CLI's test.cli.js reads docs/usage.txt symmetrically against the produced --help output.
  • Deliberately excluded: the os field divergence (behavior-affecting, unclear majority), the cb/clbk naming difference (no 75% majority), and the empty <section class="notes"> in pkg-json/repl-txt READMEs (requires authored content, not mechanical).

Related Issues

Does this pull request have any related issues?

No.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Each outlier package has its own commit so the audit trail is per-package. Conformance percentages for each item are quoted in the respective commit body.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

This PR was produced by a cross-package API drift sweep run by Claude Code. The drift signals (majority error phrasing, missing JSDoc tag, missing leading newline in docs/usage.txt) were extracted automatically across the 9 packages in @stdlib/_tools/lint, then validated by three review passes before any file was modified. All edits are mechanical text substitutions in two packages; no behavior, signatures, or test expectations changed.


@stdlib-js/reviewers


Generated by Claude Code

claude added 2 commits May 20, 2026 04:18
…/namespace-aliases`

Replaces "Last argument" with "Callback argument" in the `TypeError`
thrown by `lib/async.js` when the callback parameter is not a function,
and updates the matching `@throws` JSDoc tag. The "Callback argument"
phrasing is used by 7 of the 8 sibling `@stdlib/_tools/lint/*` packages
with a callback validation (87.5% conformance); `namespace-aliases`
was the only outlier.
…s/lint/pkg-json-names`

Adds the missing `@throws {TypeError} options argument must be an
object` line to the `lib/async.js` JSDoc; the throw is already present
in `lib/validate.js` but was undocumented at the public entry. All 6
sibling `@stdlib/_tools/lint/*` packages with `options` validation
document this throw (100% conformance among comparable siblings).

Prepends a leading blank line to `docs/usage.txt` so the CLI `--help`
banner matches the vertical spacing produced by the other 8 sibling
packages, all of which start their `docs/usage.txt` with `\n`.
@stdlib-bot stdlib-bot added the Tools Issue or pull request related to project tooling. label May 20, 2026
@kgryte kgryte marked this pull request as ready for review May 20, 2026 05:12
@kgryte kgryte requested a review from a team May 20, 2026 05:12
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label May 20, 2026
@kgryte kgryte changed the title refactor: normalize callback error and JSDoc/usage drift in @stdlib/_tools/lint refactor: normalize error messages and descriptions May 20, 2026
@kgryte kgryte removed the Needs Review A pull request which needs code review. label May 20, 2026
@kgryte kgryte merged commit 3df93b0 into develop May 20, 2026
54 checks passed
@kgryte kgryte deleted the philipp/drift-tools-lint-2026-05-20 branch May 20, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tools Issue or pull request related to project tooling.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants