When programming with dplyr, what is the correct way to avoid undefined global variables?

Unless I'm misinterpreting your question, you would need to include something like this somewhere in your source code for each relevant argument which is a missing a global binding.

utils::globalVariables('data', 'group_var', 'weight_var')

The values the user supplies is not relevant, since those can't be known ahead of time.