# prefer-number-properties

Rule `unicorn/prefer-number-properties`. Prefer `Number` static methods over global functions and optionally static properties over global constants.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 12.8M weekly downloads of presets that enable it
- Trend: +40.7% last quarter
- Rank: #728 by reach, #937 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/prefer-number-properties` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/prefer-number-properties.md) |
| Oxlint | `unicorn/prefer-number-properties` | no | unsafe | plugin `unicorn`, category restriction | [docs](https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-number-properties.html) |
| Biome | `style/useNumberNamespace` | no | safe | group style, since 1.5.0 | [docs](https://biomejs.dev/linter/rules/use-number-namespace/) |

## Code examples

### Incorrect: the rule reports this

```js
const foo = parseInt('10', 2);
```

```js
const foo = parseFloat('10.5');
```

```js
const foo = isNaN(10);
```

### Correct: the rule accepts this

```js
const foo = Number.parseInt('10', 2);
```

```js
const foo = Number.parseFloat('10.5');
```

```js
const foo = Number.isNaN(10);
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/prefer-number-properties": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "unicorn/prefer-number-properties": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "useNumberNamespace": "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% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/error-message](https://lintradar.dev/rules/unicorn/error-message.md): Enforce passing a `message` value when creating a built-in error.
- [unicorn/throw-new-error](https://lintradar.dev/rules/unicorn/throw-new-error.md): Require `new` when creating an error.
- [unicorn/prefer-includes](https://lintradar.dev/rules/unicorn/prefer-includes.md): Prefer `.includes()` over `.indexOf()`, `.lastIndexOf()`, and `Array#some()` when checking for existence or non-existence.
- [unicorn/escape-case](https://lintradar.dev/rules/unicorn/escape-case.md): Require escape sequences to use uppercase or lowercase values.
- [unicorn/no-instanceof-builtins](https://lintradar.dev/rules/unicorn/no-instanceof-builtins.md): Disallow `instanceof` with built-in objects
- [unicorn/no-new-buffer](https://lintradar.dev/rules/unicorn/no-new-buffer.md): Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.

---

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