import-js / import-js/eslint-plugin-import
This plugin does not report `import/extensions` and `import/no-unresolved` errors on `import type …` constructs
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Assuming we force extensions `"always"`, I get the following results:
```typescript
import type Foo from "foo"; // No errors reported.
import type { Bar } from "bar"; // No errors reported.
import Foo from "foo"; // Errors reported.
import { type Bar } from "bar"; // Errors reported.
```
This is not ideal, since I mostly deal with `.d.mts` files in the project where this occurs. And typescript enforces `import type` on any `.d.ts` and `.d.mts` files.
This is the `.eslintrc.cjs` of the project:
```javascript
module.exports = {
env: {
es6: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.eslint.json",
sourceType: "module",
},
plugins: ["@typescript-eslint", "eslint-plugin-tsdoc", "import"],
rules: {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }],
"@typescript-eslint/no-unsafe-declaration-merging": "off", // TODO: reenable in V10
"import/extensions": ["error", "always"],
"tsdoc/syntax": "warn",
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".mts", ".ts"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
},
},
};
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the examples from the issue using the provided .eslintrc.cjs configuration, focusing on import/extensions and import/no-unresolved with import type declarations. Trace how these rules handle the shown TypeScript forms, then add coverage and ensure the same errors are reported for unresolved imports and missing extensions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript, typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100