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

chore: Fix or individually disable no-this-alias lint rule violations. #6371

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

gonfunko
Copy link
Contributor

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Part of #5857

Proposed Changes

Fixes or individually disables violations of the no-this-alias lint rule. Where the violation was in the spirit of the rule (shenanigans with this) I fixed it by generally converting to arrow functions; in cases where the assignment was intentional (generally recursive traversals starting with this), I disabled the warning.

Behavior Before Change

Lint warnings for assigning this to a variable were always suppressed.

Behavior After Change

Lint warnings for assigning this to a variable are selectively suppressed but generally enabled.

@gonfunko gonfunko requested a review from a team as a code owner August 22, 2022 20:44
Copy link
Contributor

@maribethb maribethb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -570,6 +570,7 @@ export class Block implements IASTNodeLocation, IDeletable {
* @return The block (if any) that surrounds the current block.
*/
getSurroundParent(): this|null {
/* eslint-disable-next-line @typescript-eslint/no-this-alias */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be sweet if this rule were smart enough to only trigger if the alias was used inside a function. ah well.

@gonfunko gonfunko merged commit 43f54b1 into google:develop Aug 22, 2022
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

Successfully merging this pull request may close these issues.

2 participants