Closed johnfoconnor closed 9 years ago
This rule can be applied as '--ignore 21/_.*' already, see #11. I'm not sure I want to add a flag as well. How would you name it if I did?
That's great that we can use this rule already.
that's a good question. I suppose one could unify all the unused options flags u r a s
into a single parametrized flag.
ex
--no-unused="redefined+secondaries"
would ignore redefined and secondary variables warnings. We could add a keyword to signify variables with a leading _
The problem is because the rule is quite specific there could be variations of it, e.g. with _ as suffix or prefix, ignoring all matching variables or only arguments, etc. So I think adding an option expressing one variation is not enough.
The idea of combining --unused-* options is interesting but orthogonal to expressing the rule better, it'll require an option or a keyword either way. Perhaps we could overload the meaning of the argument differently, could it be a pattern matching variable name? E.g. '--no-unused _.*'. It could work for other options, too, and would make inline options nicer, e.g. 'function f(x, y) --luacheck: no unused arg x'.
thanks for the reply. I guess an abstraction is a bit premature. Feel free to close this issue as it is addressed via the following
--ignore 212/_.* --ignore 211/_.* --ignore 213/_.*
OK. By the way, --ignore 21/_.*
should also work.
In Lua, "_" is only a convention with no inherent special meaning but it's commonly used to signify that we dont care about that variable
However, sometimes having naming that unused variable can provide helpful context. What are your thoughts on a flag which, when enables, ignores unused variables starting with a
_
. This is common practice in other languages