Skip to content

False-positive for "error" causing issues in prefer-await-to-callbacks rule #212

Open
@xjamundx

Description

see: #202 (comment)

The way that this rule detects a callback function is anything with a function signature of:

function(err) { // or now "error"
   // you look like a standard node.js callback function
}

The problem is plenty of people would do something like:

{errorsLists.map(error => <p>{error.message</[>})

Especially in JSX/react land and possibly elsewhere.

I could also see:

errors.forEach(error => console.log(error.message));

This rule is definitely not meant to apply in these scenarios, because these aren't actually the async style callbacks we're worried about, but....is there a better way to differentiate them?

I'd be pretty ok adding a JSX exception to this rule, or just like disable the rule if it doesn't apply to your app. Mostly I had node.js in mind when I made this :D

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions