New check: variable used only for type checkingΒ #8111
Closed as not planned
Description
Current problem
I have no immediate way to tell which imports are used for runtime functionality and which are used only for type checking.
Desired solution
I would like for Pylint to warn when imports are used only for type annotations and not for any runtime functionality. Such imports can then be moved behind the TYPE_CHECKING
flag.
Should this check be an extension? I'm not sure. Are there any undeniable benefits to putting type imports behind the type flag? Is it something that everyone really ought to do? If so, then maybe it should be enabled by default, and maybe an extension otherwise.
Only users with type annotations would be affected. I imagine such users are already more fastidious than average, so maybe they would appreciate it.
Additional context
No response