but I didn't realize it's available for Debian as the lua-check package
I don’t know if the package is up to date on Debian, but if you have installed luarocks, you may prefer to install lua-check this way.
they enforce a particular style
I tend to like conforming myself to a linter or a formatter. Anyway, they're just tools. They have their limitations.
Having to replace unused identifiers with _ just to keep the linter happy, in particular, is a pet peeve of mine. It hides the meaning of the parameter or variable, and makes it one more place to change if I decide to use it later.
I disagree on this point. It’s just a convention to name a variable `_`, but it does clearly tell the reader that the variable is unused. If I see an unused variable, I want it removed. It’s already a burden to keep track of all the other used variables ;-)
Of course, it’s painful to convert existing code to what Luacheck enjoys, but if you start developing right away with it, it can be rewarding. With dynamically-typed languages (especially Lua), when I misspell a variable I’m actually defining a new global. I like that Luacheck is able to catch that early. I’like even more static typing.
reported every access to the globals that were defined in love.load as undeclared
If I have to declare globals I do it the ugly way with `_G`. I also do declarations of "globals to the file chunk".
Code: Select all
local x, y, z
x = some_resource()