luacheck icon indicating copy to clipboard operation
luacheck copied to clipboard

Add support for custom operators (like those in the Playdate SDK)?

Open bedinotti opened this issue 2 years ago • 1 comments

Hey there. The Playdate SDK uses Lua and adds a handful of additional assignment operators, like += and -= that aren't present in the normal Lua language.

I'd love to be able to run luacheck on my Playdate lua code. When I do that now with one of these custom operators (In the example below, +=), luacheck (rightly) gives me an error:

CleanShot 2022-03-15 at 19 56 10@2x

Can you please add a way to specify that these operators are not actually errors, maybe in the .luacheckrc file? Or maybe even just a way to specify that this error should be ignored when encountering these operators?

Thanks!

bedinotti avatar Mar 16 '22 03:03 bedinotti

Ignoring this syntax error would probably open up a whole kettle of fish where random other mistakes would get through. But exposing the list of valid operators is such a way that it would be possible to add an operator via the RC file might be feasible. I only skimmed the relevant code but it doesn't look impossible to me.

I don't have the time to hack on it right now but I'd be willing to review and facilitate a PR if anybody else wants to contribute this.

alerque avatar Mar 25 '22 11:03 alerque