Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add missing return statement
  • Loading branch information
Eskibear committed Aug 6, 2024
commit 71fe5f3643e18c8233f9a92b9edcf9b1c97ed36b
1 change: 1 addition & 0 deletions src/featureManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class FeatureManager implements IFeatureManager, IVariantFeatureManager {
return { variant, reason: VariantAssignmentReason.User };
Copy link
Member

@zhiyuanliang-ms zhiyuanliang-ms Aug 5, 2024

Choose a reason for hiding this comment

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

Should it be { variant: variant, reason: VariantAssignmentReason.User }?

Copy link
Member Author

Choose a reason for hiding this comment

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

{variant} is short for {variant: variant}. A syntax sugar for simplicity, I can make it clearer if it looks confusing to you now.

Copy link
Member

Choose a reason for hiding this comment

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

I am ok with it. But personally, I prefer consistency. Is there linting rule for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Of course there is corresponding linting rule, it's called object-shorthand.
This shorthand syntax makes the code more readable and is widely adopted in ES6 and later versions of JavaScript. See the example of this rule, usually we force to use object shorthand in linting rules instead of forbidding.

} else {
console.warn(`Variant ${userAllocation.variant} not found for feature ${featureFlag.id}.`);
return { variant: undefined, reason: VariantAssignmentReason.None };
}
}
}
Expand Down