Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import js from '@eslint/js';
import { includeIgnoreFile } from '@eslint/compat';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import { builtinModules } from 'node:module';
import { fileURLToPath } from 'node:url';
import ts from 'typescript-eslint';

Expand All @@ -25,5 +26,34 @@ export default ts.config(
...globals.node
}
}
},
// @svelte-vitals/core is runtime-agnostic by contract (design §8, see packages/core/src/index.ts):
// no node: imports, no I/O, no runtime-specific globals. Enforce it here so a violation
// fails `pnpm lint` / CI instead of relying on review. I/O is injected via the Runtime
// interface. The bare-builtin ban list is generated from node:module's builtinModules
// (plus a `/*` variant for subpaths like `path/posix`) so it can never go stale.
{
files: ['packages/core/src/**/*.ts'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['node:*', ...builtinModules, ...builtinModules.map((m) => `${m}/*`)],
message:
'@svelte-vitals/core is runtime-agnostic (design §8): no Node builtins here — inject I/O through the Runtime interface (src/runtime.ts).'
}
]
}
],
'no-restricted-globals': [
'error',
{ name: 'process', message: 'core is runtime-agnostic (design §8): no runtime-specific globals.' },
{ name: '__dirname', message: 'core is runtime-agnostic (design §8): no runtime-specific globals.' },
{ name: '__filename', message: 'core is runtime-agnostic (design §8): no runtime-specific globals.' },
{ name: 'Buffer', message: 'core is runtime-agnostic (design §8): no runtime-specific globals.' }
]
}
}
);