Skip to content

Strict Component Boundaries

Error
small-rules/strict-component-boundaries

Prevent imports that reach into another component's nested modules.

Diagnostic Messages

noReachingIntoComponent
Do not reach into an individual component's folder for nested modules. Import from the closest shared components folder instead.

Configuration

This rule accepts one options object after the severity.

allowOptional

Regular expression patterns for imports allowed to cross component boundaries.

maxDepthOptional

Maximum path depth allowed inside another component before reporting.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/strict-component-boundaries": [
"error",
{
"allow": [],
"maxDepth": 1
}
]
}
}

Examples

Nested component import
import someThing from '../Bar/any-path';
Shared components import
import {someThing} from './components';