getter-return
NOTE: this rule is part of the
recommended
rule set.Enable full set in
deno.json
:{ "lint": { "rules": { "tags": ["recommended"] } } }
Enable full set using the Deno CLI:
deno lint --rules-tags=recommended
This rule can be explictly included to or excluded from the rules present in the current tag by adding it to the
include
or exclude
array in deno.json
:{ "lint": { "rules": { "include": ["getter-return"], "exclude": ["getter-return"] } } }
Requires all property getter functions to return a value.
Getter functions return the value of a property. If the function returns no value then this contract is broken.
Invalid:
let foo = {
get bar() {},
};
class Person {
get name() {}
}
Valid:
let foo = {
get bar() {
return true;
},
};
class Person {
get name() {
return "alice";
}
}