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 upIncorrect reporting of `no-callback-literal` #809
Comments
This comment has been minimized.
This comment has been minimized.
|
@xjamundx Thoughts? Maybe we should only check |
This comment has been minimized.
This comment has been minimized.
They are good, even can add Here we don't need this, but edit: |
This comment has been minimized.
This comment has been minimized.
juliangruber
commented
Mar 3, 2017
|
also discovered this in https://github.com/juliangruber/hyperdrive-import-files, in a setting like this: function next (mode) {
//
}
next('created')Using common callback names sounds good to me, or maybe checking if the value of the last argument is ever called as a function. |
This comment has been minimized.
This comment has been minimized.
xjamundx
commented
Mar 3, 2017
•
|
|
This comment has been minimized.
This comment has been minimized.
|
yea it can stay as it is currently, but the main point is to detect and warn only if there is argument with such name and it is called incorrectlly |
This comment has been minimized.
This comment has been minimized.
|
Shouldn't the callback detection be limited to a function argument? |
This comment has been minimized.
This comment has been minimized.
|
@dcousens absolutely. |
feross
added this to the
standard v10 milestone
Mar 6, 2017
feross
added
the
bug
label
Mar 6, 2017
This comment has been minimized.
This comment has been minimized.
|
I don't have the bandwidth to change this rule to only detect callbacks that are passed in as function arguments before getting out the 10.0.0 release. I'm going to remove |
tunnckoCore commentedMar 3, 2017
•
edited
I have a iterator function, that is called recursively. Something like
If that's not so clear enough, see what i mean here each-promise/utils.js#L44-L83
Basically this
nextfunction in parallel flow is called for each item in array, passing the index of the itemnext(index). And in serial flow, thatnextfunction is just called recursively.And it reports that the literal passed as first argument to next is not valid. Easiest fix for me is to just rename that function to, say,
nextStep... but yea. I believe the implementation ineslint-plugin-standardcan be done better, to report only if there is argument callednext,cborcallback.It is just the more correct approach.
For me, it should report that warning only if the case is such like that
only when there is last argument named
next/cb/callbackand is passed with wrong literal.