import-js/eslint-plugin-import

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

Open

#2,128 opened on 2021年6月14日

GitHub で見る
 (1 comment) (2 reactions) (0 assignees)JavaScript (1,540 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (4,946 stars)
PR merge metrics
 (平均マージ 138d 22h) (30d で 3 merged PRs)

説明

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.

コントリビューターガイド