Fix: no-unused-expressions directive support (fixes #1185)

Fixes #1185. Related: #1186.
Please add JSDoc for these functions. I know the existing functions didn't have them, but I've been trying to clean those up.