eslint-plugin-mocha icon indicating copy to clipboard operation
eslint-plugin-mocha copied to clipboard

The handle-done-callback rule cannot handle TypeScript this parameter

Open raymondfeng opened this issue 3 years ago • 4 comments

The issue can be reproduced with the following TypeScript code:

before(async function setupApplication(this: Mocha.Context) {
    this.timeout(6000);
}

Please note this parameter is used.

The handle-done-callback rule marks it as a violation incorrectly.

It's also interesting to note that the function is async.

raymondfeng avatar Sep 01 '20 15:09 raymondfeng

Which parser are you using? I think this should be rather fixed in @typescript-eslint/parser.

lo1tuma avatar Sep 01 '20 17:09 lo1tuma

I use @typescript-eslint/parser. See https://github.com/strongloop/loopback-next/blob/renovate/major-typescript-eslint-monorepo/packages/eslint-config/eslintrc.js#L16

raymondfeng avatar Sep 01 '20 17:09 raymondfeng

@lo1tuma Do you recommend we open an issue against @typescript-eslint/parser?

raymondfeng avatar Sep 01 '20 22:09 raymondfeng

I run into the same problem. Is there any other solution than deactivating the rule for TypeScript files?

Ulrikop avatar Jul 25 '21 14:07 Ulrikop