import-js / import-js/eslint-import-resolver-typescript
Missing file extension "ts" for [...] / passing through `enhanced-resolve`'s options.
- Dominant language
- TypeScript
- Stars
- 825
- Forks
- 73
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to supply `eslint-import-resolver-typescript` with custom `extensionAlias` option. Is this the correct way:
```json
{
"plugins": ["import"],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": "./tsconfig.json",
"extensionAlias": {
".js": [ ".ts", ".d.ts", ".js" ],
".cjs": [ ".cts", ".d.cts", ".cjs" ],
".mjs": [ ".mts", ".d.mts", ".mjs" ],
".ts": [ ".js", ".d.ts", ".ts" ],
".cts": [ ".cjs", ".d.cts", ".cts" ],
".mts": [ ".mjs", ".d.mts", ".mts" ],
}
}
}
},
"rules": {
"import/extensions": [
"error"
"always",
{
"ignorePackages": false
}
]
}
}
```
bc it doesn't seem to work...
What am i trying to achieve?
I am trying to fix `Missing file extension "ts" for [...]` linting error from `import/extensions` rule by trying to "teach" `eslint-import-resolver-typescript` resolver to treat ".js" as aliases for ".ts" extension.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing how the resolver configuration in the supplied tsconfig.json setup is parsed and whether enhanced-resolve options such as extensionAlias are forwarded. Verify the behavior with the reported import/extensions case; done means .js aliases resolve to the corresponding TypeScript files without the missing file extension error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100