8000 Bug: [no-deprecated] Rule doesn't report on call inside default export · Issue #10327 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content

Bug: [no-deprecated] Rule doesn't report on call inside default export #10327

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

Closed
4 tasks done
wszydlak opened this issue Nov 13, 2024 · 1 comment · Fixed by #10330
Closed
4 tasks done

Bug: [no-deprecated] Rule doesn't report on call inside default export #10327

wszydlak opened this issue Nov 13, 2024 · 1 comment · Fixed by #10330
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@wszydlak
Copy link
Contributor

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=5.6.2&fileType=.tsx&code=PQKhAIAEBMFMAcBOsDGBDALra5oHtwA7PDcAVwGdZwMALASwvADMzCUN69DwRgAoVu07dwADwAUASnABvfuHDIMZRD1kBfANz8N-fsGDh0ZAOa0M-SVJ0GjxUifOXYY%2BHkSk4zNGQA2pNZaQA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1oBNFjpEZAIb5E3dFETRoHaJHBgAviEVA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

/** @deprecated do not use this function */
function x() {
  return {};
}

// caught
x();

// not caught
export default x();

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/no-deprecated": "error"
  },
};

tsconfig

{
  "compilerOptions": {
    "strictNullChecks": true
  }
}

Expected Result

I expected that line export default x(); will show error about using deprecated function, this worked properly with eslint-plugin-deprecation.

Actual Result

Line export default x(); did not show linting error.

Additional Info

Additional demo: https://stackblitz.com/edit/tvzmwg-17xps4?file=src%2Findex.ts

@wszydlak wszydlak added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Nov 13, 2024
@wszydlak
Copy link
Contributor Author

Probably allowing checking nodes that are inside default exports will make it work correctly:

https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/no-deprecated.ts#L130

@JoshuaKGoldberg JoshuaKGoldberg changed the title Bug: [no-deprecated] Rule doesn't work when combined with default export Bug: [no-deprecated] Rule doesn't report on call inside default export Nov 13, 2024
@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for team members to take a look labels Nov 13, 2024
wszydlak added a commit to wszydlak/typescript-eslint that referenced this issue Nov 14, 2024
wszydlak added a commit to wszydlak/typescript-eslint that referenced this issue Nov 14, 2024
wszydlak added a commit to wszydlak/typescript-eslint that referenced this issue Nov 14, 2024
wszydlak added a commit to wszydlak/typescript-eslint that referenced this issue Nov 14, 2024
wszydlak added a commit to wszydlak/typescript-eslint that referenced this issue Nov 14, 2024
wszydlak added a commit to wszydlak/typescript-eslint that referenced this issue Nov 15, 2024
wszydlak added a commit to wszydlak/typescript-eslint that referenced this issue Nov 16, 2024
@github-actions github-actions bot added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Nov 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0