I have created a similar library for bash. However, there are more pitfalls related to errexit, see [1] and even shellcheck can not help there. I have tried to solve the pitfalls in my library, but it turned out to be ugly and unreliable. That's why I'm trying to use rust [2] for shell scripting like tasks nowadays.
[1] https://github.com/anordal/shellharden/blob/master/how_to_do...
[2] https://github.com/rust-shell-script/rust_cmd_lib