import-js / import-js/eslint-plugin-import

Cannot allow paths starting with ./ in no-internal-modules

Open
#2,893 8 comments 5 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Due to the following filter:

https://github.com/import-js/eslint-plugin-import/blob/cd957286efe1c4aa0423f82ac5576c75fd3be71e/src/rules/no-internal-modules.js#L63

There is no way to match relative paths with the `no-internal-modules` rule, thus exporting any files from subdirectories in any index.ts file triggers an error. The above filter prevents rules like `./**` which would solve this issue.

I'm using Angular for my project which is irrelevant, other than the common filesystem pattern that this issue affects:

```ts
/* No error */
export { ContactModule } from './contact.module';

/* Reaching to "./components/contact-card/contact-card.component" is not allowed. eslint(import/no-internal-modules) */
export { ContactCardComponent } from './components/contact-card/contact-card.component';
```

Contributor guide

Open the contributing guide

Research direction

Start by reading src/rules/no-internal-modules.js at the filter linked in the issue and reproduce the rule with a relative glob such as ./**. Trace the existing rule coverage, then add regression coverage for relative paths; done means exports from nested relative paths no longer trigger the rule when the pattern explicitly allows them.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.