getter-return
NOTE: this rule is part of the
recommended
rule set.Enable full set in
deno.json
:{ "lint": { "tags": ["recommended"] } }
Enable full set using the Deno CLI:
deno lint --tags=recommended
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";
}
}