Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
raymondfeng opened this issue Sep 1, 2020 · 4 comments
Open
Labels

Comments

@raymondfeng
Copy link

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 added a commit to loopbackio/loopback-next that referenced this issue Sep 1, 2020
The mocha plugin incorretly reports the following signature as a
violation of `mocha/handle-done-callback` (misinterpreting `this`
as `done`).

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

See lo1tuma/eslint-plugin-mocha#270

Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
@lo1tuma
Copy link
Owner

lo1tuma commented Sep 1, 2020

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

@raymondfeng
Copy link
Author

raymondfeng commented Sep 1, 2020

@raymondfeng
Copy link
Author

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

raymondfeng added a commit to loopbackio/loopback-next that referenced this issue Sep 3, 2020
The mocha plugin incorretly reports the following signature as a
violation of `mocha/handle-done-callback` (misinterpreting `this`
as `done`).

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

See lo1tuma/eslint-plugin-mocha#270

Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
raymondfeng added a commit to loopbackio/loopback-next that referenced this issue Sep 3, 2020
The mocha plugin incorretly reports the following signature as a
violation of `mocha/handle-done-callback` (misinterpreting `this`
as `done`).

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

See lo1tuma/eslint-plugin-mocha#270

Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
@Ulrikop
Copy link

Ulrikop commented Jul 25, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants