Skip to content

chore: migrate to knip - #2576

Merged
chris-olszewski merged 2 commits into
mainfrom
olszewski/ts7-knip
Oct 26, 2026
Merged

chris-olszewski merged 2 commits into
mainfrom
olszewski/ts7-knip

Conversation

@chris-olszewski

@chris-olszewski chris-olszewski commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

What was changed

  • Migrate from ts-prune to knip
  • Small patch to get knip to ignore our current backwards compatible lib/* entrypoints. Otherwise everything becomes public and knip isn't effective. Semi-hacky, but I think this is a reasonable workaround until we remove the lib/* entrypoints.

Why?

  • ts-prune hasn't had a release in 5 years
  • ts-prune embeds a typescript version which won't support the module: node20 we'll need to move to with a TS 6/7 upgrade.
  • As you can see from the removal of comments, the analysis is more extensive with knip
  • pnpm run lint:prune is now ~ 3x faster

Checklist

  1. Closes N/A

  2. How was this tested:
    pnpm run lint:prune, quick verification that knip does in fact catch unused exports.

  3. Any docs updates needed?
    N/A

@chris-olszewski chris-olszewski added the skip-changelog No changelog is necessary for this PR. label Oct 23, 2026
Comment thread patches/knip@6.40.0.patch
- const { main, module, browser, bin, exports, types, typings } = manifest;
+ const { main, module, browser, bin, exports: allExports, types, typings } = manifest;
+ const exports = allExports && typeof allExports === 'object' && !Array.isArray(allExports)
+ ? Object.fromEntries(Object.entries(allExports).filter(([key]) => key !== './lib/*'))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary workaround so don't mark every export as used by the fallback entrypoint which will be removed.

// Note: encodeSearchAttributeIndexedValueType exported for use in tests to register search attributes
// ts-prune-ignore-next
export const [encodeSearchAttributeIndexedValueType, _] = makeProtoEnumConverters<
export const [encodeSearchAttributeIndexedValueType] = makeProtoEnumConverters<

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we care/want an exported _

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we're going to be the future lodash!!!

}

export default async function (...args: unknown[]): Promise<NameAndArgs> {
export async function defaultActivity(...args: unknown[]): Promise<NameAndArgs> {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no reason to use export default here other than default lines up with our desired activity name.

@chris-olszewski
chris-olszewski marked this pull request as ready for review October 23, 2026 20:26
@chris-olszewski
chris-olszewski requested a review from a team as a code owner October 23, 2026 20:26
@chris-olszewski
chris-olszewski requested a review from a team as a code owner October 23, 2026 20:35
@chris-olszewski
chris-olszewski merged commit 7070ad6 into main Oct 26, 2026
96 of 103 checks passed
@chris-olszewski
chris-olszewski deleted the olszewski/ts7-knip branch October 26, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog No changelog is necessary for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants