-
-
Notifications
You must be signed in to change notification settings - Fork 41
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: n/no-sync incorrectly applies to method definitions #355
Comments
This sounds simiular to #354 🤔 |
I almost filed a comment there, but then determined that it was sufficiently different to justify its own issue. This issue is about a general issue that |
Also seems to flag interfaces and generic parameters: interface BlahSync {}
function foo<T>(a: T): T {return a}
const a = foo<BlahSync>({}) |
This is because the only test is a selector: eslint-plugin-n/lib/rules/no-sync.js Lines 7 to 23 in 23d0e84
We could restrict this to |
Are there common cases where |
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
:The validation rule should only fire for function calls / method execution, not definition.
Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: