This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
🐛 lint/rules/noUnreachableSuper
triggers a false positive if the constructor contains an if
statement that returns in both clauses
#4616
Labels
Environment information
What happened?
Run the linter on code like the following:
https://docs.rome.tools/playground/?code=YwBsAGEAcwBzACAAQQAgAHsACgAgACAAYwBvAG4AcwB0AHIAdQBjAHQAbwByACgAKQAgAHsACgAgACAAIAAgAGMAbwBuAHMAbwBsAGUALgBsAG8AZwAoACIAQwBvAG4AcwB0AHIAdQBjAHQAaQBuAGcAIABBACEAIgApAAoAIAAgAH0ACgB9AAoACgAvAC8AIABOAG8AdABlACAAdABoAGEAdAAgAHQAaABpAHMAIABwAGEAcgB0AGkAYwB1AGwAYQByACAAZQB4AGEAbQBwAGwAZQAgAGMAYQBuACAAYgBlACAAIgBzAGkAbQBwAGwAaQBmAGkAZQBkACIAIAB0AG8AIABhAHYAbwBpAGQAIAB0AGgAZQAgAGwAaQBuAHQAZQByACAAYgB1AGcALgAgAEIAdQB0ACAAaQB0ACAAcwB0AGkAbABsACAAcwBlAHIAdgBlAHMAIAB0AG8AIABkAGUAbQBvAG4AcwB0AHIAYQB0AGUAIAB3AGgAYQB0ACAAbQBhAHkAIABoAGEAcABwAGUAbgAgAGkAbgAgAG0AbwByAGUAIABjAG8AbQBwAGwAaQBjAGEAdABlAGQAIABjAG8AZABlAC4ACgBjAGwAYQBzAHMAIABCACAAZQB4AHQAZQBuAGQAcwAgAEEAIAB7AAoAIAAgAG4AOgAgAG4AdQBtAGIAZQByACAAfAAgAHUAbgBkAGUAZgBpAG4AZQBkADsACgAgACAAYwBvAG4AcwB0AHIAdQBjAHQAbwByACgAbgApACAAewAKACAAIAAgACAAcwB1AHAAZQByACgAKQA7AAoAIAAgACAAIABpAGYAIAAoAHQAeQBwAGUAbwBmACAAbgAgAD0APQA9ACAAIgBzAHQAcgBpAG4AZwAiACkAIAB7AAoAIAAgACAAIAAgACAAaQBmACAAKABuACAAPQA9AD0AIAAiAGQAZQBmAGEAdQBsAHQAIgApACAAewAKACAAIAAgACAAIAAgACAAIAByAGUAdAB1AHIAbgA7AAoAIAAgACAAIAAgACAAfQAgAGUAbABzAGUAIAB7AAoAIAAgACAAIAAgACAAIAAgAHQAaABpAHMALgBuACAAPQAgAHAAYQByAHMAZQBJAG4AdAAoAG4AKQA7AAoAIAAgACAAIAAgACAAIAAgAHIAZQB0AHUAcgBuADsACgAgACAAIAAgACAAIAB9AAoAIAAgACAAIAB9AAoAIAAgACAAIAB0AGgAaQBzAC4AbgAgAD0AIABuAAoAIAAgAH0ACgB9AAoA
For the real-world example that triggered this, see: https://github.com/cubing/cubing.js/blob/143181657b7010404bf8e2f8ea726dcb68434ed2/src/cubing/alg/alg-nodes/leaves/Move.ts#L140-L160
This errors with
lint/correctness/noUnreachableSuper
using the message:This constructor has code paths accessing
this
without callingsuper()
first.Expected result
No linter error.
Code of Conduct
The text was updated successfully, but these errors were encountered: