It depends. You can also configure luacheck from within the file you are checking. For instance, in some of my lua code [1], I have:
-- luacheck: globals init handler
-- luacheck: ignore 611
The first line tells luacheck that the variables `init` and `handler` are globals, and the second line tells it to ignore lines that contain just whitespace (a quirk the text editor I use uses to manage indenting levels).[1] https://github.com/spc476/port70/blob/master/port70/handlers...
Although, I've been using luacheck https://github.com/mpeterv/luacheck. It is quite nice, but you have to write down the global variables by hand on the config file.
Edit: Also, the vscode lua plugins have been getting quite good, and completion works to a certain extent.