filter_after_early_return
Added in 0.8.0
When this rule encounters a return
statement at the end of a do
statement block, it will clear out the next statements of the outer block.
This rule is effective when applied after rules that may produce do statements with return statements, like
For example, given the following code:
do
local function process()
-- ...
end
return process
end
local function otherImplementation()
-- ...
end
return otherImplementation
The rule will clear the otherImplementation
since process
will always be returned first. It will produce the following code:
do
local function process()
-- ...
end
return process
end