Skip to content
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

Rule proposal: Warn when deprecated APIs are used (eslint-plugin-deprecation) #8988

Open
6 tasks done
JoshuaKGoldberg opened this issue Apr 24, 2024 · 0 comments
Open
6 tasks done
Labels
enhancement: new plugin rule New rule request for eslint-plugin package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look

Comments

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Apr 24, 2024

Before You File a Proposal Please Confirm You Have Done The Following...

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:

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:

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.

@JoshuaKGoldberg JoshuaKGoldberg added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look enhancement: new plugin rule New rule request for eslint-plugin labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement: new plugin rule New rule request for eslint-plugin package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look
Projects
None yet
Development

No branches or pull requests

1 participant