Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upNew rule: consistent-return #221
Comments
This comment has been minimized.
This comment has been minimized.
|
On the surface, this seems like a good rule. But it's actually not that well implemented, and it gives a ton of false positives. 23 repos in the test suite will fail if you enable this rule.
Of particular note, the popular rs.pipe(through.obj(function (data, enc, cb) {
if (data.value.toString()[0] === '{') return cb()
if (verify) {
verify(u, val.message, val.signature, function (_, valid) {
m.valid = !!valid
processor(m, cb)
})
return
}
})You can play around with potential rule changes by modifying |
feross
closed this
Aug 4, 2015
This comment has been minimized.
This comment has been minimized.
|
Ahh, that makes very much sense. I'll try to play around with the rules and see if there is anything that we can learn from xo and others :) |
This comment has been minimized.
This comment has been minimized.
|
Great idea, thanks!
|
LinusU commentedAug 4, 2015
Suggesting that we include the rule consistent-return
This rule is aimed at ensuring all return statements either specify a value or don't specify a value.
The following patterns are considered warnings:
The following patterns are considered okay and do not cause warnings:
I found the rule while comparing which rules
xohas versusstandardhere: #216 (comment)