knip setup & use ts7 - #1138
Conversation
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.
|
Warning Review limit reached
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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (13)
📝 WalkthroughWalkthroughChangesTooling and build cleanup
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
knip.json (1)
19-35: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd
treatConfigHintsAsErrorstoknip.json.Knip emits configuration hints as warnings by default. Add
"treatConfigHintsAsErrors": truesobun knipfails 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
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (13)
.github/workflows/ci.yaml.vscode/settings.json.zed/settings.jsonapps/pdftk/src/schema.tsknip.jsonlibs/binary/libreoffice-fs/src/lib/directFsConvert.tslibs/bun/src/executors/build/executor.tslibs/http/body/src/lib/request-to-multipart-form-data/request-to-multipart-form-data.tslibs/tsc/src/executors/typecheck/executor.tslibs/tsc/src/executors/typecheck/schema.d.tslibs/tsc/src/executors/typecheck/schema.jsonnx.jsonpackage.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
| - name: knip | ||
| run: bun knip | ||
|
|
There was a problem hiding this comment.
🎯 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.
| "@swc/core": "1.15.47", | ||
| "@swc/helpers": "0.5.23", | ||
| "@types/bun": "1.3.14", | ||
| "@types/node": "26.2.0", |
There was a problem hiding this comment.
🎯 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 -160Repository: 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 || trueRepository: 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}")
PYRepository: 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
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.
Summary by CodeRabbit
Chores
Refactor