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

fix(eslint-plugin): [no-unnecessary-boolean-literal-compare] incorrect fix when condition is reversed #3581

Merged
merged 5 commits into from Jul 31, 2021

Conversation

alonstern
Copy link
Contributor

Fixes #3442
Before this PR no-unnecessary-boolean-literal-compare fix would change

if (true === var) {
   ...
}

to

if (true) {
   ...
}

instead of

if (var) {
   ...
}

This PR intends to fix this issue.

@nx-cloud
Copy link

nx-cloud bot commented Jun 26, 2021

Nx Cloud Report

CI ran the following commands for commit 5ff2fac. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=build --all --parallel
#000000 nx run-many --target=typecheck --all --parallel

Sent with 💌 from NxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @alonstern!

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.

@alonstern alonstern changed the title fix(eslint-plugin): no-unnecessary-boolean-literal-compare when the boolean literal is used before the variable fix(eslint-plugin): no-unnecessary-boolean-literal-compare incorrect fix Jun 26, 2021
@codecov
Copy link

codecov bot commented Jun 26, 2021

Codecov Report

Merging #3581 (5ff2fac) into master (75dcf69) will increase coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3581      +/-   ##
==========================================
+ Coverage   92.64%   92.66%   +0.02%     
==========================================
  Files         326      326              
  Lines       11253    11253              
  Branches     3171     3171              
==========================================
+ Hits        10425    10428       +3     
+ Misses        368      367       -1     
+ Partials      460      458       -2     
Flag Coverage Δ
unittest 92.66% <ø> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
...rc/rules/no-unnecessary-boolean-literal-compare.ts 93.50% <ø> (+3.89%) ⬆️

@bradzacher bradzacher added the bug Something isn't working label Jul 31, 2021
@bradzacher bradzacher changed the title fix(eslint-plugin): no-unnecessary-boolean-literal-compare incorrect fix fix(eslint-plugin): [no-unnecessary-boolean-literal-compare] incorrect fix when condition is reversed Jul 31, 2021
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.

LGTM - thanks for fixing this!

@bradzacher bradzacher merged commit b595575 into typescript-eslint:master Jul 31, 2021
@alonstern alonstern deleted the issue-3442 branch August 18, 2021 16:33
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[no-unnecessary-boolean-literal-compare] Incorrect fix when reversed
2 participants