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

Bug: import/no-deprecated doesn't work with typescript #1315

Closed
Hotell opened this issue Apr 5, 2019 · 6 comments
Closed

Bug: import/no-deprecated doesn't work with typescript #1315

Hotell opened this issue Apr 5, 2019 · 6 comments

Comments

@Hotell
Copy link

Hotell commented Apr 5, 2019

.eslintrc.js

module.exports = {
  root: true,
  plugins: [
    '@typescript-eslint',
    'react',
    'react-hooks',
    'jsx-a11y',
    'filenames',
    'import',
  ],
  rules: {
    'import/no-deprecated': 'error',
  },
};

Code:

// usage.ts

import { foo } from './foo';

console.log(foo());

// foo.ts
/**
 * this is what you get when you trust a mouse talk show
 * @deprecated don't use this!
 * @returns {string} nonsense
 */
export function foo() {
  return 'bar';
}

lint run:

eslint --ignore-path .gitignore --ext .ts,.tsx packages

will produce NO lint errors

@benmosher
Copy link
Member

benmosher commented Jun 29, 2019

I think you need to configure a parser. I just added some tests and it seems to be working, if a TypeScript parser is configured. Might also need the TS resolver:

settings: {
  'import/parsers': { '@typescript-eslint/parser': ['.ts'] },
  'import/resolver': { 'eslint-import-resolver-typescript': true },
}

@Hotell
Copy link
Author

Hotell commented Jul 3, 2019

Fixed by #1257

thx!

@digeomel
Copy link

Is the fix released already? I can't tell from the comments on #1257

@ljharb
Copy link
Member

ljharb commented Mar 31, 2020

Long fixed. Try it and see.

@digeomel
Copy link

digeomel commented Apr 1, 2020

It still doesn't work for me. I was using RxJs forkJoin and it was not marked as deprecated in vscode (other eslint warnings work fine). A colleague using IntelliJ (which I guess uses an internal check, not eslint-based) pointed it out to me.

@ljharb
Copy link
Member

ljharb commented Apr 1, 2020

Please file a new issue for that.

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

No branches or pull requests

4 participants