When you scaffold your widget it is typically created for you.
Standard in that .gitignore is:
dist/
node_modules/
tests/testProject/
*.log
.env
In addition to Bob’s answer, Mendix themselves have a lot of their widgets and modules on Github. You could look directly at one of their widgets and see what they have in their .gitignore files.
https://github.com/orgs/mendix/repositories?type=all