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

feat(eslint-plugin): [no-this-alias] report on assignment expressions #4718

Merged
merged 2 commits into from Mar 29, 2022
Merged

feat(eslint-plugin): [no-this-alias] report on assignment expressions #4718

merged 2 commits into from Mar 29, 2022

Conversation

juank1809
Copy link
Contributor

@juank1809 juank1809 commented Mar 23, 2022

PR Checklist

Overview

The rule 'no-this-alias' had no logic of how to manage a reassignment of a variable already declared, it was only working in a variable declaration. This code adds an AssignmentExpression node to be handled and grabs the id of the Identifier of either AssigmentExpression or VariableDeclarator.

@nx-cloud
Copy link

nx-cloud bot commented Mar 23, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 84cef31. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 43 targets

Sent with 💌 from NxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @juank1809!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@netlify
Copy link

netlify bot commented Mar 23, 2022

Deploy Preview for typescript-eslint failed.

Name Link
🔨 Latest commit 84cef31
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/623fa7e1ec24040008e4836a

@codecov
Copy link

codecov bot commented Mar 23, 2022

Codecov Report

Merging #4718 (84cef31) into main (d4768c0) will increase coverage by 7.41%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #4718      +/-   ##
==========================================
+ Coverage   86.97%   94.39%   +7.41%     
==========================================
  Files           5      151     +146     
  Lines         215     8189    +7974     
  Branches       60     2645    +2585     
==========================================
+ Hits          187     7730    +7543     
- Misses         22      258     +236     
- Partials        6      201     +195     
Flag Coverage Δ
unittest 94.39% <100.00%> (+7.41%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/eslint-plugin/src/rules/no-this-alias.ts 100.00% <100.00%> (ø)
...plugin-internal/src/rules/prefer-ast-types-enum.ts
...lugin-internal/src/rules/plugin-test-formatting.ts
...-internal/src/rules/no-typescript-estree-import.ts
...gin-internal/src/rules/no-poorly-typed-ts-props.ts
...internal/src/rules/no-typescript-default-import.ts
packages/eslint-plugin/src/rules/no-loop-func.ts 98.11% <0.00%> (ø)
...c/rules/no-non-null-asserted-nullish-coalescing.ts 91.66% <0.00%> (ø)
.../eslint-plugin/src/util/explicitReturnTypeUtils.ts 96.42% <0.00%> (ø)
...int-plugin/src/rules/require-array-sort-compare.ts 88.88% <0.00%> (ø)
... and 147 more

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

This makes sense, thanks for the change! I'm leaving some comments in the linked issue that might change things, so I'll defer to @bradzacher on merging.

packages/eslint-plugin/src/rules/no-this-alias.ts Outdated Show resolved Hide resolved
@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready label Mar 26, 2022
Co-authored-by: Josh Goldberg <me@joshuakgoldberg.com>
@bradzacher bradzacher changed the title fix(eslint-plugin): add assignment expression logic in no-this-alias feat(eslint-plugin): add assignment expression logic in no-this-alias Mar 29, 2022
@bradzacher bradzacher added the enhancement New feature or request label Mar 29, 2022
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

this LGTM! Thanks for adding the extra handling!

@bradzacher bradzacher changed the title feat(eslint-plugin): add assignment expression logic in no-this-alias feat(eslint-plugin): [no-this-alias] report on assignment expressions Mar 29, 2022
@bradzacher bradzacher merged commit 8329498 into typescript-eslint:main Mar 29, 2022
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Apr 9, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`5.17.0` -> `5.18.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/5.17.0/5.18.0) |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`5.17.0` -> `5.18.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/5.17.0/5.18.0) |

---

### Release Notes

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>

### [`v5.18.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#&#8203;5180-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5170v5180-2022-04-04)

[Compare Source](typescript-eslint/typescript-eslint@v5.17.0...v5.18.0)

##### Bug Fixes

-   **eslint-plugin:** method-signature-style respect getter signature ([#&#8203;4777](typescript-eslint/typescript-eslint#4777)) ([12dd670](typescript-eslint/typescript-eslint@12dd670))

##### Features

-   **eslint-plugin:** \[no-shadow] ignoreOnInitialization option ([#&#8203;4603](typescript-eslint/typescript-eslint#4603)) ([068ea9b](typescript-eslint/typescript-eslint@068ea9b))
-   **eslint-plugin:** \[no-this-alias] report on assignment expressions ([#&#8203;4718](typescript-eslint/typescript-eslint#4718)) ([8329498](typescript-eslint/typescript-eslint@8329498))

</details>

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>

### [`v5.18.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#&#8203;5180-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5170v5180-2022-04-04)

[Compare Source](typescript-eslint/typescript-eslint@v5.17.0...v5.18.0)

**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1282
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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