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 experiments folder.
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 without disturbing what is already there.
Then check it: Import a server util into a "use client" file. Lint refuses it by name.Reads https://ntent.app/r/f/import-boundaries
Read the code
eslint.config.mjs
10 lines
{
rules: {
'no-restricted-imports': ['error', {
patterns: [
{ group: ['**/server/**'], message: 'Server-only. Importing it here ships it to the browser.' },
{ group: ['**/experiments/**'], message: 'Experiments are not importable. Promote it first.' },
],
}],
},
}Success check: Import a server util into a "use client" file. Lint refuses it by name.