Why a linter does not cover this
Linters enforce style and a narrow set of correctness rules. They are excellent at what they do and largely indifferent to whether a key is committed, an interpolation is escaped or a catch block is empty.
Security scanners cover some of that, but they assume a repository, a build and a pipeline. The moment where generated code is most dangerous is earlier: the snippet in an editor, the file pasted from a chat window.
Static analysis of the kind that helps here is a rule set applied to text, cheap enough to run at every point where code is copied.