ShellCheck directives must be placed before complete commands like if, while, or function definitions. Applying directives to parts of commands, such as elif or else blocks, is incorrect. Move the directive to the nearest preceding complete command to ensure proper functionality.