I’ve noticed that many plugins store their config in a data.json file. I’m not sure if this is some kind of standard that all plugins follow, but all of the plugins that I use seem to do this. So I just keep the data.json files.
I have the following in my .gitignore:
.obsidian/workspace
.obsidian/themes
# exclude plugins/ but keep the data.json files in order to sync plugin settings
.obsidian/plugins/*/*
!.obsidian/plugins/*/data.json