New: add no-undefined rule (fixes #1020)

Fixes #1020.