Detect if visible

I have the command 'execute as @s at @s run tp @s ^ ^ ^1.5 facing entity @e[sort=nearest,limit=1,type=!#calamity:ignore]'. The function of this command is that it causes the entity of which is running it to rapidly move towards the nearest entity. How can I make it so it only moves towards an entity if it can see it?

Continue to help post