Linting the following code with Fennel's linter produces the "unused local foo" error:
(fn x [g] (set g.f (fn foo [])))
While the function name is indeed unused in the function itself, the compiled Lua clearly uses it:
local function x(g)
local function foo()
end
g.f = foo
return nil
end
Noticed that with one of my macros that generate functions with user-specified body, so I can't just omit the name in the macro, as it may be used for recursion.
I think in this case when the user wants to enable this linting but doesn't want to use the name, they should pick a name that starts with an underscore.
Given how much better fennel-ls is than
src/linter.fnl
, and the fact that it can be used in batch mode without any LSP involved I think it's best if we consider the latter to be included as an example of how to write a plugin, and not concern ourselves too much with how good it is at linting.