Skip to content

[no-this-alias] does not detect all cases of aliasing this to local variable #4690

@fushi

Description

@fushi
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
   "@typescript-eslint/no-this-alias": "error",
  }
}
let that;

that = this;

Expected Result

3:5 error Unexpected aliasing of 'this' to local variable @typescript-eslint/no-this-alias

Actual Result

No error or warning.

Additional Info

https://github.com/sindresorhus/eslint-plugin-unicorn catches this with unicorn/no-this-assignment

Versions

package version
@typescript-eslint/eslint-plugin 15.5.0
@typescript-eslint/parser 15.5.0
TypeScript 4.6.2
ESLint 8.9.0
node 16.13.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy