import-js/eslint-plugin-import

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

Open

#2.128 geöffnet am 14. Juni 2021

Auf GitHub ansehen
 (1 Kommentar) (2 Reaktionen) (0 zugewiesene Personen)JavaScript (1.540 Forks)batch import
enhancementhelp wanted

Repository-Metriken

Stars
 (4.946 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 138T 22h) (3 gemergte PRs in 30 T)

Beschreibung

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