-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
linter: fix all bugs in getter-return
and promote to correctness
#2312
Comments
Hi. Is there anything I can do to help? |
Yes, you may try and fix these false positives in https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/rules/eslint/getter_return.rs |
Ok. I'll look into it. |
In this example, the complaint looks justified. In places with return undefined, it is not explicitly returned. function fn(): SomeValue | undefined |
https://eslint.org/docs/latest/rules/getter-return#handled_by_typescript
Oh ... we can disable this rule for TypeScript. We can abort the whole rule with
|
I turned |
@Boshen Are these false positives only happening in the typescript files? It might be a logical error instead of a control flow issue. If I have access to our current false positives to create a unit test for them I can start working on a fix. |
I'm just seeing this. I haven't touched this code in a while, but the CFG generally works at the level of statements, rather than expressions, if I recall correctly. Many expression-level nodes are special-cased. I'd confirm the structure of the ast with this example, both for the getter and for the switch and case statements. I'd be happy to take a look later tonight as well. |
If you find the time it would be awesome, But be prepared since the code has been changed quite a bit due to recent refactors for Traverse and CFG. |
#3714) related but won't close #2312 [oxlint-ecosystem-ci](https://github.com/rzvxa/oxlint-ecosystem-ci/actions/runs/9547942249/job/26314030884)
I had to rewrite some parts of this rule so now it uses a set dfs. It is arguably a little bit slower than before but it is less prone to false negatives. closes #2312 [oxlint-ecosystem-ci](https://github.com/oxc-project/oxlint-ecosystem-ci/actions/runs/9586832129/job/26435575457?pr=16)
getter-return
is rewritten with cfg, but it is buggycc @camc314 @TzviPM
The text was updated successfully, but these errors were encountered: