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

Add lint "no-deprecated" rule based on @deprecated JSDoc tag #7102

Closed
3 tasks
harrytruong opened this issue Oct 26, 2018 · 1 comment
Closed
3 tasks

Add lint "no-deprecated" rule based on @deprecated JSDoc tag #7102

harrytruong opened this issue Oct 26, 2018 · 1 comment

Comments

@harrytruong
Copy link

Cross-posting issue from gajus/eslint-plugin-flowtype#367
Not sure if this is best implemented as part of flow, or eslint-plugin-flowtype?


I'd like to add a new lint to https://flow.org/en/docs/linting/rule-reference/

This is similar to the existing tslint rule deprecation:

I'm willing to do the work and submit a PR, if there's any interest in this?


Implementation Goals

  • implement lint warning on @deprecated functions/methods
  // @deprecated 
  function foo(): void;
  // @deprecated use baz instead
  function bar(): void;
  /**
   * @deprecated see http://example.com/1234
   */
  function baz(): void;

  foo(); // Warning: 'foo' is deprecated.
  bar(); // Warning: 'bar' is deprecated. use baz instead
  baz(); // Warning: 'baz' is deprecated. see http://example.com/1234
  • implement lint warning on @deprecated type declarations
  // @deprecated use Foozy in new code.
  type Foo = string;
  type Foozy = 'foo' | 'bar' | 'baz';

  declare var foo: Foo; // Warning: type 'Foo' is deprecated. use Foozy in new code
  // from misc.js
  /**
   * Collection of misc utility functions
   * @deprecated use `foo` and `bar` modules instead.
   */
  const foo = () => ...;
  const bar = () => ...;
  export default { foo, bar };


  // from `otherFile.js`
  import utils from 'misc'; // Warning: 'misc' is deprecated. use `foo` and `bar` modules instead.
@harrytruong
Copy link
Author

closing issue. I found that import/no-deprecated works well enough for my needs!

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

No branches or pull requests

1 participant