I was stuck on this for ages, but ChatGPT came to my rescue. It was a keyboard setting on my Mac that had converted the hyphens, so instead of displayed two hyphens (--) resulted in an unrecognised (–) causing an argument error because Hardhat doesn't recognise this syntax.
To fix I went to System Preferences and changed this: