I've always done it. Recently I started using Arch Linux with KDE plasma and went for a game of CS2 with my buddies
But I kept. Fuckin. Jumping. I jumped when I flicked, I jumped when I set my mouse down
It was awful, I even spoke to Logitech Support about it, they were obviously not much help.
I have a G502 Lightspeed, bit on the pricy side so I wasn't too thrilled about changing my mouse
I tested it on my windows 10 laptop and it worked fine, it didn't scroll when shaken.
I also tested it without the lightspeed dongle (Wired mode) and it didn't happen
So I installed a program called Solaar and set it up as follows:

Which did the trick. There must be ways to set up these quirks without this GUI software, using libinput (By setting the local-overrides.quirks file or something) but it works for me so I've stopped looking into it.
That's all. Good luck