Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

[Feature Request] Complain on unnecessary tslint:disable directives? #4118

Closed
JoshuaKGoldberg opened this issue Aug 16, 2018 · 2 comments
Closed

Comments

@JoshuaKGoldberg
Copy link
Contributor

Feature request

Is your feature request related to a problem? Please describe.

Anecdotally there are likely many places in a lot of code bases where // tslint:disable-next-line used to be used on a place but no longer is. It's nice to be clean, and a little more nice to not be misleading. I've seen people copy & paste these comments and not know what they're for within the linter.

Describe the solution you'd like

Flow has a nifty feature with $FlowFixMe where it complains if you use it unnecessarily. Can we add a flag to TSLint to enable this kind of post-lint check?

Describe alternatives you've considered

We can't make this into a rule because the individual rules don't have access to this kind of accumulated info (right?).

@reduckted
Copy link
Contributor

ESLint has this option. Obviously it's a different tool with different infrastructure, but we might be able to get some inspiration from how it's implemented.

--report-unused-disable-directives

This option causes ESLint to report directive comments like // eslint-disable-line when no errors would have been reported on that line anyway. This can be useful to prevent future errors from unexpectedly being suppressed, by cleaning up old eslint-disable comments which are no longer applicable.

@JoshuaKGoldberg
Copy link
Contributor Author

Duplicate of #1330

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants