# no-irregular-whitespace

Rule `eslint/no-irregular-whitespace`. Disallow irregular whitespace

- Source: eslint
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 277.6M weekly downloads of presets that enable it
- Trend: +46.0% last quarter
- Rank: #23 by reach, #881 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-irregular-whitespace` | yes | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-irregular-whitespace) |
| Oxlint | `no-irregular-whitespace` | yes | no | plugin `eslint`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-irregular-whitespace.html) |
| Biome | `suspicious/noIrregularWhitespace` | yes | no | group suspicious, since 1.9.0 | [docs](https://biomejs.dev/linter/rules/no-irregular-whitespace/) |

## Code examples

### Incorrect: the rule reports this

```js
const thing = function() /*<NBSP>*/{
    return 'test';
}

const foo = function( /*<NBSP>*/){
    return 'test';
}

const bar = function /*<NBSP>*/(){
    return 'test';
}

const baz = function /*<Ogham Space Mark>*/(){
    return 'test';
}

const qux = function() {
    return 'test'; /*<ENSP>*/
}

const quux = function() {
    return 'test'; /*<NBSP>*/
}

const item = function() {
    // Description <NBSP>: some descriptive text
}

/*
Description <NBSP>: some descriptive text
*/

// …
```

### Correct: the rule accepts this

```js
const thing = function() {
    return ' <NBSP>thing';
}

const foo = function() {
    return '​<ZWSP>thing';
}

const bar = function() {
    return 'th <NBSP>ing';
}
```

```js
function thing() {
    // Description <NBSP>: some descriptive text
}

/*
Description <NBSP>: some descriptive text
*/
```

```js
function thing() {
    return / <NBSP>regexp/;
}
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "no-irregular-whitespace": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "no-irregular-whitespace": "error"
  }
}
```

### Biome: `biome.json`

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [ESLint recommended](https://lintradar.dev/presets/eslint-recommended.md) | ESLint | `@eslint/js` | 64 | 178.8M | +25.9% |
| [Oxlint default](https://lintradar.dev/presets/oxlint-default.md) | Oxlint | `oxlint` | 111 | 50.8M | +183.6% |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [JavaScript Standard Style](https://lintradar.dev/presets/standard.md) | ESLint | `eslint-config-standard` | 161 | 3.1M | +12.9% |
| [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% |
| [Nuxt](https://lintradar.dev/presets/nuxt.md) | ESLint | `@nuxt/eslint-config` | 188 | 1.5M | +72.8% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |
| [Google](https://lintradar.dev/presets/google.md) | ESLint | `eslint-config-google` | 60 | 646.4K | +18.9% |
| [Google TypeScript Style](https://lintradar.dev/presets/gts.md) | ESLint | `gts` | 71 | 553.3K | +10.3% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [neostandard](https://lintradar.dev/presets/neostandard.md) | ESLint | `neostandard` | 95 | 317.6K | +50.2% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [vue/no-irregular-whitespace](https://lintradar.dev/rules/vue/no-irregular-whitespace.md): Disallow irregular whitespace in `.vue` files
- [eslint/no-this-before-super](https://lintradar.dev/rules/eslint/no-this-before-super.md): Disallow `this`/`super` before calling `super()` in constructors
- [eslint/no-unsafe-negation](https://lintradar.dev/rules/eslint/no-unsafe-negation.md): Disallow negating the left operand of relational operators
- [eslint/no-extra-boolean-cast](https://lintradar.dev/rules/eslint/no-extra-boolean-cast.md): Disallow unnecessary boolean casts
- [eslint/no-async-promise-executor](https://lintradar.dev/rules/eslint/no-async-promise-executor.md): Disallow using an async function as a Promise executor
- [eslint/no-debugger](https://lintradar.dev/rules/eslint/no-debugger.md): Disallow the use of `debugger`

---

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