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

Add a warning when using a JSDoc deprecated method #825

Closed
louy opened this issue Nov 27, 2015 · 4 comments
Closed

Add a warning when using a JSDoc deprecated method #825

louy opened this issue Nov 27, 2015 · 4 comments

Comments

@louy
Copy link
Contributor

louy commented Nov 27, 2015

So this was previously suggested in microsoft/TypeScript#390, but it seems like it should be in tslint, not typescript.

The idea is when a function which has the tag "@deprecated" is used it should show a warning.
For example:

interface IX {
  /**
   * @deprecated
   */
  function doSomething(): void;
}

class X implements IX {
  function doSomething(): void;

  /**
   * @deprecated
   */
  function doSomethingElse(): void;
}

const x = new X();
x.doSomething(); // Warning: IX.doSomething is deprecated
x.doSomethingElse(); // Warning: X.doSomethingElse is deprecated

Same thing should preferably apply to attributes. Getters & setters.

@adidahiya
Copy link
Contributor

Interesting suggestion. This would involve telling TSLint about your typings files so that it could crawl their JSDoc comments. We don't currently do this, and TSLint would have to treat typings different from sources (don't lint them since they probably don't have the same code style as your sources).

Related:

@louy
Copy link
Contributor Author

louy commented Nov 28, 2015

Yeah I agree. As to #680, that was actually one of the first frustrations I had with TSLint, coming from eslint.
I think we're stuck here until those two are closed then.

@punmechanic
Copy link

punmechanic commented Jul 13, 2016

Now that #680 is solved, what's the status on this?

@adidahiya
Copy link
Contributor

Open to PRs. I haven't yet looked at what language service APIs are available for reading JSDoc comments, but feel free to take a crack at it.

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

3 participants