I had this annoying issue with mypy and VSCode recently and it turned out to be a simple solution.

I was getting the error Unused “type: ignore” comment mypy(error) in VSCode and I couldn’t sort out why. I needed to ignore this lib since I don’t want to write stubs for it but I kept getting that error.

How dare you ignore my stub check!

Turns out that in the VSCode mypy config, it was already set up to ignore missing imports and that’s why VSCode thought it was unused in the code even though I needed that there for my pipeline checks.

I just needed to remove the –ignore-missing-imports and voila no more error in VSCode

Once I removed that line, I was able to pay attention to the red marked files for other errors 🙂