unicorn/no-fn-reference-in-iterator mistaking .find method?
See original GitHub issueI’m using a third-party API that contains a method called find. It is not find as in the collection find, but rather their own find. It expects a scalar value (id) and then does its thing.
XO is throwing the following error:
✖ 82:41 Do not pass function directly to .find(…). unicorn/no-fn-reference-in-iterator
Given that the parameter is scalar, how could this happen? Sample code:
const clientId = 20
const client = await oidc.Client.find(clientId)
If this is still a valid application of the rule, what would the correct code look like? The rule doc explains the code could be wrapped in an arrow function, which does pass the text. But, is this right?
const clientId = 20
const client = await oidc.Client.find(() => clientId)
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (2 by maintainers)
Top Results From Across the Web
Why is Java's Iterator not an Iterable? - Stack Overflow
An iterator is stateful. The idea is that if you call Iterable.iterator() twice you'll get independent iterators - for most iterables, anyway.
Read more >@cling/eslint-config - npm
... reference directly to iterator methods. ( unicorn/no-array-callback-reference ); Disallow using the this argument in array methods.
Read more >sindresorhus/eslint-plugin-unicorn (Raised $2856.00)
unicorn /no-fn-reference-in-iterator mistaking .find method? Unfunded#813created byRobertoMachorro. $0.00. Rule proposal: Collapsible if-statements.
Read more >Iterator - CPlusPlus.com
An iterator is any object that, pointing to some element in a range of elements (such as an array or a container), has...
Read more >Lab 9: Sets in the Java Collection Framework For this week's lab
In your main program, when you find a word that is not in the set of legal words, pass that word to this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think we can exclude any
await
’ed expression.One second, what if
?