# prefer-object-has-own

Rule `eslint/prefer-object-has-own`. Disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`

- Source: eslint
- Technologies: JavaScript
- Kind: suspicious
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 2.6M weekly downloads of presets that enable it
- Trend: +92.2% last quarter
- Rank: #1470 by reach, #280 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `prefer-object-has-own` | no | safe | package `eslint` | [docs](https://eslint.org/docs/latest/rules/prefer-object-has-own) |
| Oxlint | `prefer-object-has-own` | no | safe | plugin `eslint`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-object-has-own.html) |
| Biome | `suspicious/noPrototypeBuiltins` | yes | safe | group suspicious, since 1.1.0 | [docs](https://biomejs.dev/linter/rules/no-prototype-builtins/) |

## Code examples

### Incorrect: the rule reports this

```js
Object.prototype.hasOwnProperty.call(obj, "a");

Object.hasOwnProperty.call(obj, "a");

({}).hasOwnProperty.call(obj, "a");

const hasProperty = Object.prototype.hasOwnProperty.call(object, property);
```

### Correct: the rule accepts this

```js
Object.hasOwn(obj, "a");

const hasProperty = Object.hasOwn(object, property);
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "prefer-object-has-own": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "prefer-object-has-own": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "suspicious": {
        "noPrototypeBuiltins": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [eslint/require-unicode-regexp](https://lintradar.dev/rules/eslint/require-unicode-regexp.md): Enforce the use of `u` or `v` flag on regular expressions
- [eslint/complexity](https://lintradar.dev/rules/eslint/complexity.md): Enforce a maximum cyclomatic complexity allowed in a program
- [eslint/max-nested-callbacks](https://lintradar.dev/rules/eslint/max-nested-callbacks.md): Enforce a maximum depth that callbacks can be nested
- [eslint/no-implicit-globals](https://lintradar.dev/rules/eslint/no-implicit-globals.md): Disallow declarations in the global scope
- [eslint/no-object-constructor](https://lintradar.dev/rules/eslint/no-object-constructor.md): Disallow calls to the `Object` constructor without an argument
- [eslint/no-eq-null](https://lintradar.dev/rules/eslint/no-eq-null.md): Disallow `null` comparisons without type-checking operators

---

Web page: https://lintradar.dev/rules/eslint/prefer-object-has-own. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
