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

`no-unused-modules` should not halt execution if ignoreExports value is not found

Open
#2,128 1 comment 2 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

I have an ESLint config that contains the following:

```js
"import/no-unused-modules": [
"error",
{
missingExports: true,
unusedExports: true,
ignoreExports: ["src/**/*.d.ts"],
},
],
```

This is because I want to use the `no-unused-modules` rule by default in my TypeScript projects, but I also want exclude any TypeScript definitions by default. (They will result in false positives.)

This mostly works great, but a big problem with this is that when I import the template config into a brand new TypeScript project, ESLint will refuse to execute, because no ".d.ts" files exist yet in the repository.

I think a more-sane default behavior here would be for ESLint to throw a warning and continue executing. Honestly, even showing a warning at all is pretty spurious in the case of a wildcard input, but I guess that could be argued either way.

Contributor guide

Open the contributing guide

Research direction

Start with the `no-unused-modules` rule entry point and its existing tests, then trace how `ignoreExports` patterns are handled when they match no files. The change is done when a missing wildcard match no longer halts ESLint execution and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.