import-js / import-js/eslint-plugin-import
Auto fix of import without extension
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
`Node.js` doesn’t supports imports without file extension:
```js
import client from './client';
```
This will be error, extension should be provided:
```js
import client from './client.js';
```
Extensions can be:
- `js`
- `mjs`
- `cjs`
And need to be resolved, checking what kind of a file exists.
In `CommonJS` was no such a problem, we can avoid extension:
```js
const client = require(‘./client’);
```
Because of autoresolver.
So what I want to ask is: **Is it possible to autofix cases when extension is missing?**
So there was no need to `fix` such things by hand.
That would be amazing :)!
Contributor guide
Research direction
The issue names no files, tests, or entry points. Start by locating the import-extension validation rule and its resolver, then determine how existing autofixes handle filesystem resolution; done means missing .js, .mjs, and .cjs extensions are safely resolved and autofixed without changing valid imports.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100