Problem
kb reports 20 lint warnings across nine deferred rules and 16 files.
Context
Part of #1256.
preserve-caught-error recognizes only built-in Error constructions, so it flags 2 of the 6 kb sites
that fold a caught error's message into a new error without attaching cause. The other four throw
KbLoaderError, whose constructor takes no cause and which the README documents as part of kb's public
surface.
@williamthorsen/toolbelt.errors is published and supplies describeError and chainError from its
candidate tier, so kb adopts them rather than defining its own. It would be kb's first
@williamthorsen/* runtime dependency.
kb holds eight further copies of error instanceof Error ? error.message : String(error) outside any
throw. #1256 assigns the repo-wide sweep of these to a sibling ticket; kb's share comes forward so its
files are touched once.
extractGitErrorMessage in cli/targeting/resolve-changed-paths.ts is a superset rather than a
duplicate: it keeps its stderr branch and delegates only the fallback.
unicorn/prefer-simple-condition-first is off in the preset and re-enabled only by kb's own deferral,
so no sibling ticket has to land first. Retiring the deferral returns the other nine rules to error, so
it lands with the fixes rather than ahead of them.
Proposed solution
Attach cause at all six chained sites, not only the two the linter sees; KbLoaderError gains a cause
option to make the other four possible. Chained messages then join with : , following chainError's
shape, while kb's own composed messages keep —.
Acceptance criteria
Must have
Problem
kb reports 20 lint warnings across nine deferred rules and 16 files.
Context
Part of #1256.
preserve-caught-errorrecognizes only built-inErrorconstructions, so it flags 2 of the 6 kb sitesthat fold a caught error's message into a new error without attaching
cause. The other four throwKbLoaderError, whose constructor takes no cause and which the README documents as part of kb's publicsurface.
@williamthorsen/toolbelt.errorsis published and suppliesdescribeErrorandchainErrorfrom itscandidate tier, so kb adopts them rather than defining its own. It would be kb's first
@williamthorsen/*runtime dependency.kb holds eight further copies of
error instanceof Error ? error.message : String(error)outside anythrow. #1256 assigns the repo-wide sweep of these to a sibling ticket; kb's share comes forward so itsfiles are touched once.
extractGitErrorMessageincli/targeting/resolve-changed-paths.tsis a superset rather than aduplicate: it keeps its stderr branch and delegates only the fallback.
unicorn/prefer-simple-condition-firstisoffin the preset and re-enabled only by kb's own deferral,so no sibling ticket has to land first. Retiring the deferral returns the other nine rules to
error, soit lands with the fixes rather than ahead of them.
Proposed solution
Attach
causeat all six chained sites, not only the two the linter sees;KbLoaderErrorgains a causeoption to make the other four possible. Chained messages then join with
:, followingchainError'sshape, while kb's own composed messages keep
—.Acceptance criteria
Must have
nmr lint:checkreports nothing for kb, which retains no deferral residue: no rule list, nopackage strict-lint config, and no config reference to either.
@williamthorsen/toolbelt.errorsand defines no message-extraction or cause-chaininghelper of its own.
cause, including the fourpreserve-caught-errordoes not flag.causehas an assertion covering it.KbLoaderErrordescription covers the cause option.