When Object.prototype.hasOwnPrototype.call is used, this rule requires using the Object.hasOwn
instead. Object.hasOwn
is a syntactic sugar and makes the code cleaner.
Examples of incorrect code for this rule:
/*eslint prefer-object-has-own: "error"*/
Object.prototype.hasOwnProperty.call(obj, "a");
({}).hasOwnProperty(obj,"a");
let a = Object.prototype.hasOwnProperty;
Examples of correct code for this rule:
/*eslint prefer-object-has-own: "error"*/
Object.hasOwn(obj, "a");