A typo in a sudoers file can lock you out of sudo. I never edit those files in a plain editor, and visudo can also check them without opening anything.
The -c option is check-only mode. It looks at the sudoers file and every file it includes for syntax errors, and it exits with 0 when all is well and 1 when it found a problem. That makes it easy to use in a script:
sudo visudo -c && echo sudoers ok
If you give no path, it also checks the owner and permissions of the file. To test one file before it goes live, add -f:
sudo visudo -c -f /etc/sudoers.d/myapp
I run this after every change to a drop-in in /etc/sudoers.d. Add -s for strict checking, which treats an undefined alias or a cycle in an alias as a syntax error.
A broken file is read on every sudo call, and once sudo fails you need another way to become root. Keep a root shell open in a second terminal, or make sure you have console access, until the check passes.
The check covers syntax only. A valid line can still give a user more rights than you meant, so read the rule once more after it passes.
Further reading: visudo(8) man page