-
-
Notifications
You must be signed in to change notification settings - Fork 472
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
feat(linter): add eslint/constructor-super #7651
base: main
Are you sure you want to change the base?
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
CodSpeed Performance ReportMerging #7651 will not alter performanceComparing Summary
|
@camc314 I am feeling stupid parsing all possible Statements for the right error. Here are some key points what this rule does:
1 When no super class is there or not a valid one like 2 Some does not get executed because of a 3 Some are expressions like 2 3 Some can be in switch cases with and without Do you have a better idea before I try to be a runtime-parser :)? |
@Boshen do you have any idea? :) |
apologies @Sysix , last few days have been very busy. Without diving too deep into the eslint code, i could guess that using a visitor would be the best approach - something like: struct ConstrucorSuperVisitor<'a,'b> {
semanticL &'b Semantic<'a>,
stack: Vec<AstKind<'a>>,
super_found: bool
invalid_super_calls: Vec<Span> // maybe vec of diagnostic actually
}
impl <'a> Visit<'a> for ConstrucorSuperVisitor {
} then inside the Any time you found a i guess potential problems with this approach is that it would be tricky to check stuff like: class A extends B {
constructor() {
try { a; } catch (err) { super(); }
}
} maybe for those it'd make sense to use the cfg? |
Okay that looks like almost what I am doing. I added the ToDos in the nursery-block.
as far as I understood the rule, all super calls in try and catch are not valid. you need a finally block. I would be happy if we can merge this current state :) |
🫠 i think it would depend. the following should be valid i think
i can take a propert look tomorow, thanks for your work on this |
This is one of the rule, which should fail 😆 |
Thank you trying to tackle one of the last and hardest rules, because it requires the CFG :-( |
closes #2280
This is still not completed but a good start.
Currently I am questioning myself if this make sense how I built it.
Still in nursery!