Open carakessler opened 3 years ago
which is NOT the native array find
There's no way to statically infer that unless the method definition is in the same scope.
Ah that makes sense, I wonder if it makes sense to expose a more ergonomic way to override the rule.. I'll think on that. Thanks for the prompt response!
We also get this false positive when it should be statically clear that the data passed in is not a callback:
const query = {}
const docs = m.find(query) // FAILS here (m is NOT an array etc)
I also ran into this false positive with Angular using ng-mocks
library
import { ngMocks } from 'ng-mocks';
import { MyComponent } from './my-component';
ngMocks.find(MyComponent)
https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1480#issue-967623165
mongoose Models have a
find
function to query a MongoDB Database. I think this could be added toignoredCallee
import { model, Schema, Types } from 'mongoose' type Account = { _id: string, id: string } const schema = new Schema<Account, Model<Account>, Account>() const AccountModel = model('Account', schema) AccountModel.find({_id: '000000000000000000000000'})
I have found a problem with
no-array-callback-reference
:The rule is erroring on a custom implementation of a method called
find
We have a class that contains a functionfind
, and I am getting an error on passing in a parameter to that function, which is NOT the native arrayfind
Additionally, the parameter
taskName
(as shown in the screenshot below) is not a function, and is in fact a string (although again, it shouldn't matter because this isn't a native array method anyway)