Closed fabiospampinato closed 4 years ago
Hi, would you mind posting an example code snippet? These are the existing tests for getters/setters that are passing:
const foo = { get bar() { return "test"; } }
const foo = { set bar(xyz) {} }
class foo { get bar() { return "test"; } }
class foo { set bar(xyz) { } }
@TristonJ You're right it is actually detecting some getters/setters, but not this one:
Object.defineProperty ( window, 'foo', {
get () {
return 123;
}
});
Thank you for the additional details @fabiospampinato. It looks to me like it is correctly reporting an error in that specific case. In your snippet, we are actually defining a property called get
on an object that is passed into Object.defineProperty
. You can re-write that snippet of code as:
Object.defineProperty ( window, 'foo', {
get: () => 123
});
which is entirely valid syntax.
Oh you're right! 🤦♂ Thanks!
This rule is telling me I have to write my getters as arrow functions, which is impossible.