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

Return boolean through direct comparison #4822

Merged
merged 13 commits into from
Oct 18, 2023
Merged

Return boolean through direct comparison #4822

merged 13 commits into from
Oct 18, 2023

Conversation

rnbr04
Copy link
Contributor

@rnbr04 rnbr04 commented Oct 2, 2023

Changes

  • Remove ternary operator and simply rely on return value of strict equality (===)

Issues
N/A

@rnbr04 rnbr04 requested a review from a team as a code owner October 2, 2023 13:05
@thornbill thornbill added the cleanup Cleanup of legacy code or code smells label Oct 4, 2023
@thornbill
Copy link
Member

We should add this eslint rule to the config to prevent any other issues of this type being added in the future: https://eslint.org/docs/latest/rules/no-unneeded-ternary

@thornbill
Copy link
Member

@Goku-04 would you care to add that eslint rule as part of this PR? Thanks!

@rnbr04
Copy link
Contributor Author

rnbr04 commented Oct 10, 2023

I hope I did it right... it's my first time contributing to a project and handling linters

.eslintrc.js Outdated Show resolved Hide resolved
@rnbr04
Copy link
Contributor Author

rnbr04 commented Oct 14, 2023

The lint rule created some erros in other directories and I think some of them are false errors.

@dmitrylyzo
Copy link
Contributor

The lint rule created some erros in other directories and I think some of them are false errors.

All of them (9) are using unnecessary ternary: x = condition ? true : false => x = condition. In some cases !! (double negation) may be required to cast to boolean.

@rnbr04 rnbr04 requested a review from thornbill October 16, 2023 13:35
@jellyfin-bot jellyfin-bot added the merge conflict Conflicts prevent merging label Oct 16, 2023
@jellyfin-bot
Copy link
Collaborator

This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.

@jellyfin-bot jellyfin-bot removed the merge conflict Conflicts prevent merging label Oct 17, 2023
@sonarcloud
Copy link

sonarcloud bot commented Oct 18, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jellyfin-bot
Copy link
Collaborator

Cloudflare Pages deployment

Latest commit ba146d5
Status ✅ Deployed!
Preview URL https://ebcdf8fe.jellyfin-web.pages.dev
Type 🔀 Preview

View build logs
View bot logs

@thornbill thornbill merged commit 61a4964 into jellyfin:master Oct 18, 2023
22 checks passed
@rnbr04 rnbr04 deleted the patch-2 branch October 19, 2023 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Cleanup of legacy code or code smells
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants