In an episode of AskGooglebot, an SEO Professional asked John Mueller whether or not it was a good idea to hide affiliate links.
John explained that affiliate links are just fine and you can absolutely use them to help monetize a website.
You want to make sure that you mark affiliate links by using the new nofollow rules: mark them as rel=sponsored or rel=nofollow.
He also recommends to double-check the Google search documentation for any items you might have missed.
Additionally, hidden text and links can be a violation of Google’s webmaster guidelines.