# no-underscore-dangle

Rule `eslint/no-underscore-dangle`. Disallow dangling underscores in identifiers

- Source: eslint
- Technologies: JavaScript
- Kind: suspicious
- Needs type information: no
- Autofix: no
- Reach: 9.9M weekly downloads of presets that enable it
- Trend: +2.2% last quarter
- Rank: #1089 by reach, #1596 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-underscore-dangle` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-underscore-dangle) |
| Oxlint | `no-underscore-dangle` | no | no | plugin `eslint`, category suspicious | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-underscore-dangle.html) |
| Biome | `nursery/noDanglingUnderscore` | no | no | group nursery, since 2.6.3 | [docs](https://biomejs.dev/linter/rules/no-dangling-underscore/) |

## Code examples

### Incorrect: the rule reports this

```js
let foo_;
const __proto__ = {};
foo._bar();
```

### Correct: the rule accepts this

```js
const _ = require('underscore');
const obj = _.contains(items, item);
obj.__proto__ = {};
const file = __filename;
function foo(_bar) {};
const bar = { onClick(_bar) {} };
const baz = (_bar) => {};
```

Examples from the ESLint documentation.

## Enable it

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

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

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "no-underscore-dangle": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noDanglingUnderscore": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [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% |

## Related rules

- [eslint/no-continue](https://lintradar.dev/rules/eslint/no-continue.md): Disallow `continue` statements
- [eslint/no-restricted-exports](https://lintradar.dev/rules/eslint/no-restricted-exports.md): Disallow specified names in exports
- [eslint/consistent-return](https://lintradar.dev/rules/eslint/consistent-return.md): Require `return` statements to either always or never specify values
- [eslint/accessor-pairs](https://lintradar.dev/rules/eslint/accessor-pairs.md): Enforce getter and setter pairs in objects and classes
- [eslint/no-unmodified-loop-condition](https://lintradar.dev/rules/eslint/no-unmodified-loop-condition.md): Disallow unmodified loop conditions
- [eslint/no-console](https://lintradar.dev/rules/eslint/no-console.md): Disallow the use of `console`

---

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