import-js / import-js/eslint-plugin-import
Report invalid index
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
It is a common pattern to have an index file that exports all the siblings, e.g.
Suppose the following directory structure.
```
./src/loaders/
├── BadgeByBadgeIdLoader.js
├── BadgesByPostIdLoader.js
├── BlogByBlogIdLoader.js
├── PostsByBlogIdLoader.js
├── UserByUserIdLoader.js
└── index.js
```
Then the `./index.js` would contain:
``` js
export BadgeByBadgeIdLoader from './BadgeByBadgeIdLoader';
export BadgesByPostIdLoader from './BadgesByPostIdLoader';
export BlogByBlogIdLoader from './BlogByBlogIdLoader';
export PostsByBlogIdLoader from './PostsByBlogIdLoader';
export UserByUserIdLoader from './UserByUserIdLoader';
```
This rule would check all `./index.js` files that only have import/export statements.
If a matched file does not list one of the sibling files in the directory, it would report a problem.
Contributor guide
Research direction
Start with the proposed ./index.js pattern and review the repository's existing import/export rule entry points and tests. The change is complete when index files containing only import/export statements report missing sibling files while preserving the stated sibling-export pattern.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100