Skip to content

strict-component-boundaries

Blocks relative imports that reach into another component folder.

This rule only checks relative imports.

It resolves the import path, looks for PascalCase component directories in the target path, and reports deep imports that reach into another component’s internals instead of importing from that component’s boundary.

By default, maxDepth is 1, which means imports can reach the component root but not deeper nested files. Imports to an index file are allowed, fixture paths under fixtures are allowed in the expected cases, and you can add regex patterns to allow for local exceptions.

Incorrect
import { helper } from "../UserCard/utils/helper";
import { useProfile } from "../UserProfile/hooks/useProfile";
Correct
import { UserCard } from "../UserCard";
import { localHelper } from "./utils/localHelper";
OptionTypeDefaultNotes
allowstring[][]Regex patterns matched case-insensitively against the import source.
maxDepthnumber1Maximum allowed depth into another component path.