- JavaScript / TypeScript
- typescript:S2301
- We understand that the main idea of the rule and agree. For example, we should do something like this:
export function getFieldTitle ({ isField }: TestObject) {
return isField ? getCoolValue() : getUndefined();
}
But we believe that when we use objects the rule is redundant. When working with objects, we do not have a problem with “developers calling the method won’t see the parameter name, only its value”, and it would be better to exclude this case from this rule.
- Community Build v24.12.0.100206
- Code example:
export function getFieldTitle ({ isField }: TestObject) {
return isField ? TITLES.COOL_VALUE : undefined;
}