ShellCheck is like a spaz hall monitor, filling my editor with useless warnings about what it believes are best practices. I thank my stars I mostly write shell scripts in zsh which it doesn't support.
Shellcheck has good heuristics, like making mistakes with for and subshell variables. I’ve never found its heuristics to be off-base, and when it can’t genuinely tell because of some context that is only known to you, you can opt out via # shellcheck disable=SCxxxx