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

Refactor to improve types for lib/assignDisabledRanges.js #6014

Merged
merged 5 commits into from Apr 18, 2022

Conversation

ybiquitous
Copy link
Member

@ybiquitous ybiquitous commented Apr 15, 2022

Which issue, if any, is this issue related to?

Ref: #5983

Is there anything in the PR that needs further explanation?

This change aims to:

  • fix errors by the TypeScript compiler option noUncheckedIndexedAccess
  • remove unreachable code
  • reduce duplication

@@ -259,18 +263,10 @@ module.exports = function assignDisabledRanges(root, result) {

if (ruleIsDisabled(ALL_RULES) && disabledRanges[ruleToEnable] === undefined) {
// Get a starting point from the where all rules were disabled
if (!disabledRanges[ruleToEnable]) {
Copy link
Member Author

Choose a reason for hiding this comment

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

[note] If ruleIsDisabled(ALL_RULES) && disabledRanges[ruleToEnable] === undefined is true, !disabledRanges[ruleToEnable] should always be true. So, the else block should never be executed.

@ybiquitous ybiquitous marked this pull request as ready for review April 18, 2022 02:24
Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you.

@ybiquitous
Copy link
Member Author

@jeddy3 Thank you for the review. 👍🏼

@ybiquitous ybiquitous merged commit 55a8daf into main Apr 18, 2022
@ybiquitous ybiquitous deleted the refactor-assignDisabledRanges.js branch April 18, 2022 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants