Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
My proposal is suitable for this project
- My proposal specifically checks TypeScript syntax, or it proposes a check that requires type information to be accurate.
- My proposal is not a "formatting rule"; meaning it does not just enforce how code is formatted (whitespace, brace placement, etc).
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
Re-opening #1223: being able to lint against usage of an API marked as @deprecated
is a common request for TypeScript developers. It was a TSLint rule back in those days, and now is provided primarily by https://github.com/gund/eslint-plugin-deprecation. eslint-plugin-deprecation
existing is why #1223 was closed by a docs change pointing folks externally.
But! Since then:
- We've stabilized as a repository and IMO this is an important + often-useful enough rule to justify being included (so folks don't have to use a third-party plugin)
eslint-plugin-deprecation
isn't 100% actively maintained, and has an issue template notice indicating its maintainer doesn't have the bandwidth to ramp up on it & actively fix issues
Proposal: let's write a new implementation of a deprecation
rule in this repo?
Fail Cases
/** @deprecated */
declare function v1(): unknown;
v1();
Pass Cases
declare function v2(): unknown;
v2();
Additional Info
Note that the licensing here is tricky. https://github.com/gund/eslint-plugin-deprecation includes the following README.md note:
This rule was originally ported from the SonarJS repository.
...and is licensed under the GNU Lesser General Public License.
We need to be very sure that if this issue is accepted, any code added to our project is not based on the GNU license, and is at most licensed under MIT. If this is accepted, I think a member of the typescript-eslint team should work on it.
Other references of related licensed rules are:
- https://github.com/import-js/eslint-plugin-import/blob/f77ceb679d59ced5d9a633123385470a9eea10d9/src/rules/no-deprecated.js (MIT)
- https://palantir.github.io/tslint/rules/deprecation (Apache-2.0)
cc @gund - you've done a great job for a while of keeping eslint-plugin-deprecation
afloat ❤️. If you have any thoughts here, that'd be great.