-
Notifications
You must be signed in to change notification settings - Fork 105
False positive on handle-callback-err when not using parentheses #146
Comments
I have a fix for the rule (rewrote the logic to find out if we use the parameter) and I have also added the eslint tests. I wanted to see if the original code would pass the missing eslint tests and ... they do. With the exception of the cases that @fxlemire mentioned. For instance:
fails but
is fine. I think there might be a bug with typescript. It all comes down to this line:
When we don't use parentheses
In this case we would expect the node to the one corresponding to the parameter
Using
Just tried the latest version but the error is still there:
EDIT: Here is the reason:
When adding parentheses it works because |
Original Solution With Quick Fix: New Solution in which we manually keep track of the function scope instead of using the typescript service to highlight the document for occurrences of the error parameter. Sorry about the crappy screenshots. This is the modified solution: Not as short and elegant as the first one but, more efficient? I'll let you guys decide which solution you want. |
[fix] handle-callback-err (closes #146)
v3.2.0 has been released. It includes this fix and arrow rules dealing with their style. In case anyone is wondering why the build is failing, it is because |
Following code displays a
handle-callback-err
inside VS Code, but does not iferr
is wrapped with parentheses.rule:
"handle-callback-err": [true, "^(err|error)$"]
The text was updated successfully, but these errors were encountered: