Server code pulled into code that runs in the browser, which can send your secret keys to every visitor. Also real code depending on something in the explorations sandbox, so a design that breaks the rules on purpose cannot leak into the product.
Add "Import boundaries" from ntent to this repo.
Fetch https://ntent.app/r/f/import-boundaries as plain text. Merge it into eslint.config.mjs, the import at the top; the two blocks in the exported array, after the one holding the house rules, without disturbing what is already there. Then make exactly these edits and no others: Merge, never add. Flat config keeps only the last block that sets a rule, so spreading boundaryRules next to a no-restricted-imports the repo already has REPLACES the repo’s: one repo went from 379 warnings to 0 that way. If the config already sets no-restricted-imports, wrap its entry in mergeBoundaryRules from scripts/eslint-rules.mjs, as in `{ rules: { 'no-restricted-imports': mergeBoundaryRules(existingEntry) } }`, which adds the two boundaries to its patterns and paths and keeps its severity. Count the warnings before and after: the number must not drop. It needs eslint-rules.mjs. If this repo does not have it, stop and tell me.
Then check it: Import a server util into a "use client" file, or import anything under src/explorations/ from a route. Lint refuses both by name, and an exploration importing a sibling exploration still passes. Narrow the sandbox pattern and check-probes names the import that stopped being caught.Reads https://ntent.app/r/f/import-boundaries
Read the code
eslint.config.mjs · the import at the top; the two blocks in the exported array, after the one holding the house rules
7 lines
import { boundaryRules, sandboxBoundaryRules, SANDBOX } from './scripts/eslint-rules.mjs'
// One way only: the app may not import the sandbox, the sandbox may import the
// app. Flat config applies the last matching block, so inside the sandbox the
// rule is re-declared without that fence, and server code stays fenced off.
{ files: ['**/*.{ts,tsx}'], rules: { ...boundaryRules } },
{ files: [`**/${SANDBOX}/**`], rules: { ...sandboxBoundaryRules } },How to tell it works: Import a server util into a "use client" file, or import anything under src/explorations/ from a route. Lint refuses both by name, and an exploration importing a sibling exploration still passes. Narrow the sandbox pattern and check-probes names the import that stopped being caught.