chore(lint): forbid *.test-fixture.svelte imports from production code
Add ESLint no-restricted-imports rule banning *.test-fixture.svelte from non-test files. Tree-shaking already keeps test fixtures out of the production bundle, but making the boundary lint-enforced catches an accidental autocomplete-driven import in a route or component. Test files and the fixtures themselves are exempt. Nora #2 on PR #629 round 3. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -106,6 +106,31 @@ export default defineConfig(
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// Forbid test fixtures (*.test-fixture.svelte) from being imported by
|
||||||
|
// production code. Tree-shaking keeps them out of the production bundle
|
||||||
|
// today (no route reaches them), but a lint rule makes the boundary
|
||||||
|
// explicit so an accidental autocomplete import in a route or component
|
||||||
|
// fails fast. Test files (*.spec.ts / *.test.ts) and the fixtures
|
||||||
|
// themselves are exempt — see the next block. Nora #2 on PR #629
|
||||||
|
// round 3.
|
||||||
|
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js', '**/*.ts'],
|
||||||
|
ignores: ['**/*.spec.ts', '**/*.test.ts', '**/*.test-fixture.svelte'],
|
||||||
|
rules: {
|
||||||
|
'no-restricted-imports': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
group: ['**/*.test-fixture.svelte'],
|
||||||
|
message:
|
||||||
|
'Test fixtures (*.test-fixture.svelte) are test-only — do not import from production code. Tracked by #637.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
plugins: { boundaries },
|
plugins: { boundaries },
|
||||||
settings: {
|
settings: {
|
||||||
|
|||||||
Reference in New Issue
Block a user