# no-invalid-property-descriptor

Rule `unicorn/no-invalid-property-descriptor`. Disallow invalid property descriptors.

- Source: unicorn
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 9.9M weekly downloads of presets that enable it
- Trend: +28.3% last quarter
- Rank: #934 by reach, #1189 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/no-invalid-property-descriptor` | no | suggestion | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/no-invalid-property-descriptor.md) |

## Code examples

### Incorrect: the rule reports this

```js
Object.defineProperty(object, 'property', {
  get: getter,
  writable: false,
});
```

```js
Reflect.defineProperty(object, 'property', {get: null});
```

```js
Object.defineProperties(object, {
  property: {value: 1, writeable: true},
});
```

### Correct: the rule accepts this

```js
Object.defineProperty(object, 'property', {get: getter});
```

```js
Reflect.defineProperty(object, 'property', {get: undefined});
```

```js
Object.defineProperties(object, {
  property: {value: 1, writable: true},
});
```

Examples from the ESLint documentation.

## Enable it

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

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/no-invalid-property-descriptor": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [Unicorn unopinionated](https://lintradar.dev/presets/unicorn-unopinionated.md) | ESLint | `eslint-plugin-unicorn` | 236 | 9.5M | +30.3% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/no-invalid-intl-options](https://lintradar.dev/rules/unicorn/no-invalid-intl-options.md): Disallow invalid or ignored Intl options.
- [unicorn/no-invalid-response-options](https://lintradar.dev/rules/unicorn/no-invalid-response-options.md): Disallow invalid options in `new Response()`, `Response.json()`, and `Response.redirect()`.
- [unicorn/no-invalid-integrity](https://lintradar.dev/rules/unicorn/no-invalid-integrity.md): Disallow invalid subresource integrity metadata.
- [unicorn/no-invalid-style-set-property](https://lintradar.dev/rules/unicorn/no-invalid-style-set-property.md): Disallow invalid arguments to `CSSStyleDeclaration#setProperty()`.
- [unicorn/no-invalid-dom-token](https://lintradar.dev/rules/unicorn/no-invalid-dom-token.md): Disallow invalid DOM tokens.
- [unicorn/no-invalid-temporal-arithmetic](https://lintradar.dev/rules/unicorn/no-invalid-temporal-arithmetic.md): Disallow statically known invalid Temporal arithmetic.

---

Web page: https://lintradar.dev/rules/unicorn/no-invalid-property-descriptor. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
