Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 866 Bytes

no-package-self-import.md

File metadata and controls

31 lines (19 loc) · 866 Bytes

Disallow importing from the same package (no-package-self-import/no-package-self-import)

💼 This rule is enabled in the ✅ recommended config.

Rule Details

In some cases, like in a mono repo, it is possible to import a module from within the same package using the package name. This is not recommended as it can lead to confusion and affect how packages are resolved. This rule disallows importing from the same package using the package name.

Examples of correct code for this rule:

/* packages/my-package/src/file.js */

import {something} from 'another-package';
/* packages/my-package/src/file.js */

import {something} from './local-module';

Examples of incorrect code for this rule:

/* packages/my-package/src/file.js */

import {something} from 'my-package';