import-js/eslint-plugin-import

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

Open

#2 128 ouverte le 14 juin 2021

Voir sur GitHub
 (1 commentaire) (2 réactions) (0 assignés)JavaScript (1 540 forks)batch import
enhancementhelp wanted

Métriques du dépôt

Stars
 (4 946 stars)
Métriques de merge PR
 (Merge moyen 138j 22h) (3 PRs mergées en 30 j)

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.

Guide contributeur