Skip to content

knip setup & use ts7 - #1138

Open
philiplehmann wants to merge 6 commits into
mainfrom
typescript-knip
Open

knip setup & use ts7#1138
philiplehmann wants to merge 6 commits into
mainfrom
typescript-knip

Conversation

@philiplehmann

@philiplehmann philiplehmann commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores

    • Added automated unused-code checks to the CI validation workflow.
    • Standardized development tooling on the supported TypeScript language server and compiler.
    • Added project configuration for improved code-quality analysis.
    • Updated build output metadata so generated packages expose correct JavaScript, type, and export paths.
  • Refactor

    • Removed obsolete validation and compiler configuration options.
    • Reduced internal APIs that were not intended for external use.

Add a workspace knip config and script, update dependencies, and
remove unused exports/types detected during cleanup. Also patch the
bun build executor to write main/types/exports in built package.json
without relying on @nx/js helpers.
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@philiplehmann, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 12 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f5de501-5c18-4532-a74a-578de9b1f19e

📥 Commits

Reviewing files that changed from the base of the PR and between 53c944a and 94c0bfd.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • libs/biomejs/src/executors/lint/executor.ts
  • libs/bun/src/executors/build/executor.ts
  • libs/bun/src/executors/serve/executor.ts
  • libs/bun/src/executors/test/executor.ts
  • libs/docker/src/docker-buildx-build.ts
  • libs/helper/src/executors/e2e-install/executor.ts
  • libs/node/src/executors/test/executor.ts
  • libs/nx/src/index.ts
  • libs/nx/src/lib/replace-placeholders.ts
  • libs/tsc/src/executors/typecheck/executor.spec.ts
  • libs/tsc/src/executors/typecheck/executor.ts
  • package.json
  • tsconfig.base.json
📝 Walkthrough

Walkthrough

Changes

Tooling and build cleanup

Layer / File(s) Summary
Validation and editor tooling
.github/workflows/ci.yaml, knip.json, package.json, .vscode/settings.json, .zed/settings.json
Knip configuration and CI validation were added. TypeScript tooling dependencies and editor settings were updated.
Typecheck command contract
libs/tsc/src/executors/typecheck/*, nx.json
The typecheck executor and schemas no longer accept tsgo. Type checking always runs with tsc.
Built package metadata patching
libs/bun/src/executors/build/executor.ts
The build executor now patches generated package metadata with JavaScript, declaration, and export paths.
Module export cleanup
apps/pdftk/src/schema.ts, libs/binary/libreoffice-fs/src/lib/directFsConvert.ts, libs/http/body/src/lib/request-to-multipart-form-data/request-to-multipart-form-data.ts
Unused schemas and internal functions are no longer exported. The PDF toolkit schema module was removed.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the Knip setup and broadly references the TypeScript tooling changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch typescript-knip

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
knip.json (1)

19-35: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add treatConfigHintsAsErrors to knip.json.

Knip emits configuration hints as warnings by default. Add "treatConfigHintsAsErrors": true so bun knip fails CI when hints exist.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@knip.json` around lines 19 - 35, Add the top-level `treatConfigHintsAsErrors`
setting to `knip.json` with a value of true, alongside the existing Knip
configuration so `bun knip` treats configuration hints as CI failures.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yaml:
- Around line 128-130: Move the Knip step out of the lint job gated by
needs.nx-sha.outputs.has-affected-lint, or place it in a separate job with an
independent condition, so bun knip always runs even when no affected project has
lint, typecheck, or test targets.

In `@libs/bun/src/executors/build/executor.ts`:
- Around line 21-27: Update the build executor around the packageJson.main,
packageJson.types, and packageJson.typings assignments so published declaration
paths are valid: either generate and place declaration files at the configured
typesPath during the build, or remove the types and typings metadata when
declarations are not produced. Ensure the package never advertises missing .d.ts
files.

In `@package.json`:
- Around line 23-24: Update the TypeScript compiler configuration around the
typescript and `@typescript/native` dependencies so the child_process executor’s
bare tsc resolves to one explicitly intended compiler, either by retaining only
one compiler package or by invoking the desired package’s binary directly. If
`@typescript/native` remains intentionally unreferenced, preserve its knip.json
ignore entry; otherwise remove the obsolete dependency and ignore.
- Line 15: Update the `@types/node` dependency in package.json to a 24.x version
compatible with the declared Node 24.19.0 runtime, while preserving the existing
node:* module typings.

---

Nitpick comments:
In `@knip.json`:
- Around line 19-35: Add the top-level `treatConfigHintsAsErrors` setting to
`knip.json` with a value of true, alongside the existing Knip configuration so
`bun knip` treats configuration hints as CI failures.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 24bc66eb-77c8-4982-8799-e299b488d012

📥 Commits

Reviewing files that changed from the base of the PR and between 817fd88 and 53c944a.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • .github/workflows/ci.yaml
  • .vscode/settings.json
  • .zed/settings.json
  • apps/pdftk/src/schema.ts
  • knip.json
  • libs/binary/libreoffice-fs/src/lib/directFsConvert.ts
  • libs/bun/src/executors/build/executor.ts
  • libs/http/body/src/lib/request-to-multipart-form-data/request-to-multipart-form-data.ts
  • libs/tsc/src/executors/typecheck/executor.ts
  • libs/tsc/src/executors/typecheck/schema.d.ts
  • libs/tsc/src/executors/typecheck/schema.json
  • nx.json
  • package.json
💤 Files with no reviewable changes (3)
  • libs/tsc/src/executors/typecheck/schema.d.ts
  • apps/pdftk/src/schema.ts
  • libs/tsc/src/executors/typecheck/schema.json

Comment thread .github/workflows/ci.yaml
Comment on lines +128 to +130
- name: knip
run: bun knip

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Run Knip outside the affected-project gate.

If needs.nx-sha.outputs.has-affected-lint is false, GitHub skips the entire lint job before this step runs. A change that affects no project with lint, typecheck, or test can therefore bypass the new workspace-wide validation. Move Knip to a separate job without this condition, or use an independent condition for the Knip job.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yaml around lines 128 - 130, Move the Knip step out of
the lint job gated by needs.nx-sha.outputs.has-affected-lint, or place it in a
separate job with an independent condition, so bun knip always runs even when no
affected project has lint, typecheck, or test targets.

Comment thread libs/bun/src/executors/build/executor.ts Outdated
Comment thread package.json
"@swc/core": "1.15.47",
"@swc/helpers": "0.5.23",
"@types/bun": "1.3.14",
"@types/node": "26.2.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

runtime_major="$(jq -r '.engines.node' package.json | sed -E 's/[^0-9]*([0-9]+).*/\1/')"
types_major="$(jq -r '.devDependencies["`@types/node`"]' package.json | sed -E 's/[^0-9]*([0-9]+).*/\1/')"

test "$runtime_major" = "$types_major"

Repository: philiplehmann/container

Length of output: 161


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- package metadata ---'
cat -n package.json | sed -n '1,45p'

printf '%s\n' '--- Node and TypeScript references ---'
rg -n --glob '!node_modules' --glob '!dist' --glob '!build' \
  '"engines"|"node"|`@types/node`|typescript|tsc|typecheck' \
  package.json tsconfig*.json libs .github 2>/dev/null | head -240

printf '%s\n' '--- lockfile entries ---'
rg -n --glob '*lock*' '(`@types/node`|typescript)' . 2>/dev/null | head -160

Repository: philiplehmann/container

Length of output: 39862


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- runtime configuration ---'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  'node-version|NODE_VERSION|FROM node|engines|runtime|bun-version|setup-bun|nodejs' \
  .github Dockerfile* '**/Dockerfile*' package.json 2>/dev/null | head -240

printf '%s\n' '--- Node-specific type configuration and usage ---'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  'types[[:space:]]*:|from ["'\'']node:|require\(["'\'']node:|process\.|Buffer|fetch|FileHandle|availableParallelism' \
  --glob '*.{json,jsonc,ts,tsx,js,mjs,cjs}' . 2>/dev/null | head -260

printf '%s\n' '--- package-manager runtime metadata ---'
sed -n '1,150p' .github/workflows/ci.yaml 2>/dev/null || true

Repository: philiplehmann/container

Length of output: 1363


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT

python3 - "$tmp" <<'PY'
import json, pathlib, sys, urllib.request

out = pathlib.Path(sys.argv[1])
for version in ("24.0.0", "24.19.0", "26.0.0", "26.2.0"):
    url = f"https://registry.npmjs.org/@types/node/{version}"
    try:
        with urllib.request.urlopen(url, timeout=15) as response:
            data = json.load(response)
        print(version, "published", data.get("version"), "types", data.get("types"))
        print("  tarball:", data.get("dist", {}).get("tarball"))
    except Exception as exc:
        print(version, "ERROR", exc)
PY

printf '%s\n' '--- `@types/node` package metadata and declaration differences ---'
python3 - "$tmp" <<'PY'
import json, pathlib, sys, urllib.request, tarfile, io

out = pathlib.Path(sys.argv[1])
for version in ("24.19.0", "26.2.0"):
    url = f"https://registry.npmjs.org/@types/node/{version}"
    with urllib.request.urlopen(url, timeout=15) as response:
        data = json.load(response)
    tarball = data["dist"]["tarball"]
    with urllib.request.urlopen(tarball, timeout=30) as response:
        payload = response.read()
    target = out / version
    target.mkdir()
    with tarfile.open(fileobj=io.BytesIO(payload), mode="r:gz") as archive:
        archive.extractall(target)
    root = target / "node"
    print(version, "files", sum(p.is_file() for p in root.rglob("*")))
    for name in ("process.d.ts", "fs.d.ts", "http.d.ts", "globals.d.ts"):
        path = root / name
        if path.exists():
            print(f"--- {version}/{name} ---")
            for i, line in enumerate(path.read_text(errors="replace").splitlines(), 1):
                if any(token in line for token in (
                    "availableParallelism", "glob", "matchesGlob", "fetch", "process",
                    "nodejs", "FileHandle",
                )):
                    print(f"{i}:{line}")
PY

Repository: philiplehmann/container

Length of output: 3105


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- CI runtime sections ---'
sed -n '30,75p;100,130p;145,215p' .github/workflows/ci.yaml

printf '%s\n' '--- runtime entry points and Node execution ---'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  '(^|[[:space:]])(node|bun)[[:space:]]|#!/usr/bin/env node|process\.version|engines\.node|from ["'\'']node:|require\(["'\'']node:' \
  --glob '*.{json,jsonc,ts,tsx,js,mjs,cjs,yaml,yml,Dockerfile}' . 2>/dev/null | head -260

printf '%s\n' '--- npm registry metadata ---'
curl -fsSLk 'https://registry.npmjs.org/@types/node/26.2.0' |
  jq '{name,version,types,engines,dist:{tarball,integrity}}'

Repository: philiplehmann/container

Length of output: 20919


Keep Node declarations aligned with the supported Node version.

The workspace runs on Bun, but it declares Node 24.19.0 and uses node:* modules. @types/node 26.2.0 can expose Node 26 APIs that Node 24 does not provide. Use a compatible @types/node 24.x version, or update the supported Node runtime.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 15, Update the `@types/node` dependency in package.json
to a 24.x version compatible with the declared Node 24.19.0 runtime, while
preserving the existing node:* module typings.

Source: MCP tools

Comment thread package.json Outdated
Create package metadata when no built or source package.json exists
and fall back to project name, default version, and module type
based on build format. Only add types/typings and export types when
a source package.json is present.
Alias TypeScript to `@typescript/typescript6` and update
workspace executors to import nx helpers via relative `.ts` paths.
Also enable `allowImportingTsExtensions` in `tsconfig.base.json`
to support explicit `.ts` imports.
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