no-sibling-import
Disallow sibling-file imports from the current directory.
Targeted pattern scope
This rule checks module source strings in:
import ... from "..."export ... from "..."export * from "..."- dynamic
import("...")
It reports sources matching ./* by default.
It is built on the same glob-based import-pattern engine as
disallow-import.
What this rule reports
This rule reports source paths that match configured disallow glob patterns
and are not exempted by allow patterns.
Why this rule exists
Disallowing sibling imports can enforce stricter layering where modules import through explicit public boundaries instead of lateral file coupling.
❌ Incorrect
import value from "./source";
✅ Correct
import value from "../source";
Behavior and migration notes
This rule reports only and does not provide an autofix.
Default disallow is ./*, but you can override with custom allow and
disallow patterns.
Options
type Options = {
allow?: string[];
disallow?: string[];
};
Default:
{ "disallow": ["./*"] }
Additional examples
// default disallow: ["./*"]
export { value } from "./value";
// ❌ reported
export { value } from "../value";
// ✅ valid
await import("./runtime");
// ❌ reported
ESLint flat config example
import etcMisc from "eslint-plugin-etc-misc";
export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/no-sibling-import": "error",
},
},
];
When not to use it
Disable this rule if sibling imports are part of your module design.
Package documentation
Rule catalog ID: R041
Further reading
Adoption resources
- Start at warning level in CI, then move to error after cleanup.
- Use focused codemods/autofix batches per package or directory.