Skip to content

fix: webjs check skips a nested package with its own package.json - #1701

Merged
vivek7405 merged 2 commits into
mainfrom
fix/check-skip-nested-packages
Nov 13, 2026
Merged

vivek7405 merged 2 commits into
mainfrom
fix/check-skip-nested-packages

Conversation

@vivek7405

@vivek7405 vivek7405 commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1700

webjs check now skips any folder below the app root that has its own package.json, and everything under it, the way it already skips node_modules. Such a folder is a separate package (an Expo or React Native app in mobile/ beside an api backend), so its React imports and its TypeScript are no longer reported as WebJs code. The app root's own package.json is never a boundary, and no config key is needed.

What changed

  • packages/server/src/fs-walk.js: walk(dir, filter, { skipNestedPackages: true }) stops at a directory below dir that holds a package.json. The check is free, since the walk already reads each directory's entries.
  • packages/server/src/check/runner.js (the file list every file rule reads) and packages/server/src/check/rules-typescript.js (the separate TypeScript walk behind no-non-erasable-typescript) set the option.
  • runner-support.js imported walk but never called it, so the unused import is gone. Its scans are buildModuleGraph / scanComponents / buildRouteTable. Those still walk the whole app dir, mobile/ included, but the rule built on them only reports modules reachable from the app's own components and instrumentation-client, and nothing under a nested Expo app is a WebJs component, so no rule fires on it there.

Deliberately not changed

The router, the 'use server' action index and the component scanner keep walking everything. Skipping a nested package there is arguably right too, but it changes what the server registers and serves, so it is a separate change with its own tests if it is ever wanted.

Tests

  • packages/server/test/check/foreign-imports.test.js: a React import under mobile/ with mobile/package.json passes while components/ is still flagged, and the same files with no mobile/package.json still fail (counterfactual).
  • packages/server/test/check/check.test.js: the runner level, covering both walks (an enum and a JSX file in mobile/ are skipped, the app's own enum is still reported, and both come back once mobile/package.json is gone), plus the walk() option being opt-in.
  • Counterfactual: reverting the two call sites reds both new tests, and reverting only the TypeScript walk reds the runner test.
  • Bun: N/A for a dedicated script. The change is a plain readdir walk, not a runtime-sensitive surface, and the Bun matrix runs these node:test files.
  • Bun: both test files pass under bun test.
  • Browser / e2e / smoke: N/A, nothing the browser fetches changed.
  • Full npm test green (the blog integration file needed its local db seeded first).
  • Dogfood: webjs check passes in gallery, examples/blog and website. A fresh bun create webjs@latest app --template api --runtime bun --db postgres with mobile/package.json and a React mobile/src/ui.tsx passes with this branch's CLI, fails with it once mobile/package.json is removed, and fails with the published CLI as before.

Docs

  • website/app/(site)/docs/conventions/page.ts: the webjs check section says what is skipped.
  • Root AGENTS.md CLI section and packages/server/AGENTS.md module map (fs-walk.js).
  • Scaffold, brief, MCP, editors, README: N/A, nothing they describe changed.

A sub-folder with its own package.json is a separate package, such as
an Expo app in mobile/ beside an api backend. webjs check walked it as
app code, so no-foreign-framework-import failed on its React imports
and there was no way to exclude it. The check's file walk and its
TypeScript walk now stop at that boundary, as they stop at
node_modules. The router, action and component scans are unchanged.

Closes #1700
@vivek7405 vivek7405 self-assigned this Nov 13, 2026
@pilots-run

pilots-run Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Preview for d4be317 was not built: compose file has unsupported keys

Next: fix the listed keys in the compose file

runner-support.js imported walk but never called it, which read as a third check walk that needed the nested-package boundary. Its scans start from the app's components and routes instead.
@vivek7405
vivek7405 marked this pull request as ready for review November 13, 2026 18:47
@vivek7405
vivek7405 merged commit 164aeb9 into main Nov 13, 2026
10 of 11 checks passed
@vivek7405
vivek7405 deleted the fix/check-skip-nested-packages branch November 13, 2026 18:57
vivek7405 added a commit that referenced this pull request Nov 13, 2026
Ships the webjs check nested-package boundary from #1701, so an app
with a separate package such as an Expo app in mobile/ passes the check
once it installs the latest server.

Co-authored-by: t <t@t>
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.

dogfood: webjs check fails on a nested package such as an Expo app in mobile/

1 participant