import-js/eslint-plugin-import

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

Open

#2,128 opened on Jun 14, 2021

 (1 comment) (2 reactions) (0 assignees)JavaScript (1,548 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (5,940 stars)
PR merge metrics
 (PR metrics pending)

Description

I have an ESLint config that contains the following:

    "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