Skip to content

Bug: n/no-sync incorrectly applies to method definitions #355

Closed
@benjie

Description

@benjie

Environment

Node version: 20.12.1
npm version: pnpm 9
ESLint version: 8.57.0
eslint-plugin-n version: 17.11.1
Operating System: Ubuntu

What rule do you want to report?

n/no-sync

Link to Minimal Reproducible Example

https://eslint-online-playground.netlify.app/#eNp9kTFvwyAQhf/KiamNHHt3lU5dO3UsVYXss0uLDwTnyFHk/14wdtJKURY40ON7946zCL6pcFKDM1h+B1GLxlJgUHCAsyQAj8GaI/pQ5zPA68iKtaXLBYAKJ2qAvzT14S2WD58FKN+HAiKNceLHqxag2kFZlrCrtqu52KrAY9clQr0yb5AOz/dhuVi2uMyiEBiMJi4jodN9TqkHZz0DQeftAHKV7J0Ze017kuJJkiScFlWLnRoNw3tirt5ZmaYSIVsAPxq8Dgoilyqy+5REijrZeG+9FP9b/IhesUunmh/Vp1+wFDtcIFLwyWF+O9g24qVYvKRo8fiCDqlFajSGpFl9tzT5mVGMIdZrizei/lVdpjb/AupTp8w=

What did you expect to happen?

The following code does not do any synchronous calls, but it does define two methods that end in Sync:

const a = {
  resolvers: {
    Mutation: {
      async thingsSync(_, args, context) {
        /* ... */
      },
      stuffSync: async (_, args, context) => {
        /* ... */
      }
    }
  }
}

The validation rule should only fire for function calls / method execution, not definition.

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions