question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unicorn/no-fn-reference-in-iterator - wrong context

See original GitHub issue

The lint is claiming a MongoDB query (.find)

// Example
// error  Do not pass function `collection` directly to `.find(…)`  unicorn/no-fn-reference-in-iterator
const results = await collection
  .find({
    $and: [cursorQuery, params.query]
  }, {
    projection: params.projection
  })
  .sort($sort)
  .limit(params.limit + 1)
  .toArray()

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
fiskercommented, May 29, 2020

No problem. As I comment above, if you use object in .find({}) , it will ignored in https://github.com/sindresorhus/eslint-plugin-unicorn/pull/756. But .find(foo) will still be a problem, you’ll have to use //eslint-disable.

0reactions
aleksandr-omisecommented, Oct 8, 2020

With D3 delaunay error too.

const delaunay = Delaunay.from(
  valuesWithCoord,
  (el) => el.x,
  (el) => el.y
)

const nearestPointIndex = delaunay.find(x, y)

I guess nothing can do about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's wrong with passing C++ iterator by reference?
In this context, I think that passing an iterator by reference is perfectly sensible, as long as it's well-documented.
Read more >
eslint-config-ash-nazg - npm
The ash-nazg/sauron config expands upon the regular ash-nazg rules to indicate what are generally best practices but are less likely to be due...
Read more >
Converse.js API Documentation Source: headless/dist ...
@private * @param {Array} array The array to iterate over. * @param {Function} callback The function that gets called for every array *...
Read more >
How to capture a variable in C# and not to shoot yourself in ...
(A reference to the Action object in the current iteration). ... that is aimed at detecting incorrect capture of the variables and anonymous ......
Read more >
Suppression of false positive warnings - PVS-Studio
You can notify the analyzer that the warning V678 issued on this code is a false positive. It can be done either manually...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found