# id-match

Rule `eslint/id-match`. Require identifiers to match a specified regular expression

- Source: eslint
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 2.1M weekly downloads of presets that enable it
- Trend: +151.7% last quarter
- Rank: #1512 by reach, #16 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `id-match` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/id-match) |
| Oxlint | `id-match` | no | no | plugin `eslint`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/id-match.html) |

## Code examples

### Incorrect: the rule reports this

```js
const my_favorite_color = "#112C85";
const _myFavoriteColor  = "#112C85";
const myFavoriteColor_  = "#112C85";
const MY_FAVORITE_COLOR = "#112C85";
function do_something() {
    // ...
}

class My_Class {}

class myClass {
    do_something() {}
}

class anotherClass {
    #do_something() {}
}
```

```js
const obj = {
    my_pref: 1
};

obj.do_something = function() {
    // ...
};
```

```js
class myClass {
    my_pref = 1;
}

class anotherClass {
    #my_pref = 1;
}
```

### Correct: the rule accepts this

```js
const myFavoriteColor   = "#112C85";
const foo = bar.baz_boom;
const buz = { qux: bar.baz_boom };
do_something();
const obj = {
    my_pref: 1
};

class myClass {}

class anotherClass {
    doSomething() {}
}

class oneMoreClass {
    #doSomething() {}
}
```

```js
foo = __dirname;
```

```js
const { category_id } = query;

const { category_Id = 1 } = query;

const { category_alias: category_alias } = query;
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "id-match": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "id-match": "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% |

## Related rules

- [unicorn/id-match](https://lintradar.dev/rules/unicorn/id-match.md): Require identifiers to match a specified regular expression.
- [eslint/id-denylist](https://lintradar.dev/rules/eslint/id-denylist.md): Disallow specified identifiers
- [eslint/no-duplicate-imports](https://lintradar.dev/rules/eslint/no-duplicate-imports.md): Disallow duplicate module imports
- [eslint/no-inline-comments](https://lintradar.dev/rules/eslint/no-inline-comments.md): Disallow inline comments after code
- [eslint/sort-vars](https://lintradar.dev/rules/eslint/sort-vars.md): Require variables within the same declaration block to be sorted
- [eslint/func-style](https://lintradar.dev/rules/eslint/func-style.md): Enforce the consistent use of either `function` declarations or expressions assigned to variables

---

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