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

Bug: no-callback-literal #162

Closed
1 task done
JounQin opened this issue Jan 6, 2024 · 2 comments · Fixed by #163
Closed
1 task done

Bug: no-callback-literal #162

JounQin opened this issue Jan 6, 2024 · 2 comments · Fixed by #163

Comments

@JounQin
Copy link

JounQin commented Jan 6, 2024

Environment

Node version: v20.10.0
npm version: 10.2.3
ESLint version: v8.56.0
eslint-plugin-n version: 16.6.1
Operating System: macOS 14

What rule do you want to report?

no-callback-literal

Link to Minimal Reproducible Example

N/A

What did you expect to happen?

let result: string

try {
  result = renderToString(component)

  if (options.template) {
    result = templateRenderer.renderSync(result, context)
  }
  cb(null, result)
} catch (err) {
  cb(err as Error) // `Unexpected literal in error position of callback.` error here
}

Participation

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

Additional comments

No response

@JounQin JounQin added the bug label Jan 6, 2024
@scagood
Copy link

scagood commented Jan 7, 2024

Mmm, I am just taking a quick look on my phone and I can't see anything that is immediately obvious.

Screenshot_20240107-202427.png

After taking a look at the ast, maybe we should add TSAsExpression to the couldBeError function 🤔

https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/rules/no-callback-literal.js#L56

It may be worth giving that a try, but I can also try look in a day or two if that does not work

@aladdin-add
Copy link

we could just ignore unknown nodes - to avoid possible false positives. will make a PR later.

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

Successfully merging a pull request may close this issue.

3 participants