Report unused ignore lines
Logicer16 opened this issue · 4 comments
Report ignore lines which are not silencing an issue. This will help catch comments that are yet to be removed even if the issue they were previously silencing has been fixed. These unused comments may pollute the code over time and may hide new issues in the code.
Similar to eslint's reportUnusedDisableDirectives:
1:1 error Unused eslint-disable directive (no problems were reported)
Or typescript's:
TS2578: Unused '@ts-expect-error' directive.
1 // @ts-expect-error
~~~~~~~~~~~~~~~~~~~
I think it's out of scope of this tool, it's not type of any identifier.
I think it's out of scope of this tool
I'm not sure I understand. I'm referring to the // type-coverage:ignore-next-line
and // type-coverage:ignore-line
comments described here. These are comments specific to this project and are only relevant to this project's functionality.
The examples above are just to demonstrate similar functionality in other projects. I am not asking to reimplement the functionality of these projects for their use cases, but to instead have one for this project's use case.
When a user tries to ignore an any
type which doesn't exist, this is likely mistake and should be brought to the user's attention. For example:
// Valid
const one: number = 1;
// type-coverage:ignore-next-line
const two: any = getTwo();
// Invalid: There is no any type so the ignore comment is unused.
// type-coverage:ignore-next-line
const three: number = 3
v2.28
's --report-unused-ignore
should support this.
Thank you so much! ❤️