preventing relative imports across monorepo packages

In large monorepos that use workspace: as the installation target for resolving different packages, sometimes a rogue relative import along the lines of ../../../../../other-package/src/some-file.ts makes it way in. If you run into this, and you're different packages have disjoint versions of dependencies, that debugging process probably sucked.

The answer is simply to use "rootDir": "." in your tsconfig.json. This will result in the following typescript error if someone accidentally imports from outside the package now:

File '~/waku/packages/create-waku/src/index.ts' is not
under 'rootDir' '~/waku/packages/waku/src'. 'rootDir'
is expected to contain all source files.

This may not be the most obvious error to what we want to avoid, but it does the trick.

Also, now that you've told typescript the root of your project scope, it will no longer auto-import from outside that root. This makes the accidental import from another relative directory basically never happen unless it's some sort of llm mistake.