# eslint-plugin-command

> Comment-as-command for one-off codemod with ESLint

Latest version **4.0.0** (published 2026-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-command
pnpm add eslint-plugin-command
yarn add eslint-plugin-command
bun add eslint-plugin-command
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2026-07-31 |
| First published | 2024-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | ^22.22.2 \|\| >=24.15.0 |
| Dependencies | 1 |
| Unpacked size | 62.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 371 |
| Author | Anthony Fu <anthonyfu117@hotmail.com> |
| Maintainers | antfu |
| Keywords | eslint-plugin, codemod |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-command
- Repository: https://github.com/antfu/eslint-plugin-command
- Homepage: https://github.com/antfu/eslint-plugin-command#readme
- Issues: https://github.com/antfu/eslint-plugin-command/issues
- Funding: https://github.com/sponsors/antfu
- npm.io page: https://npm.io/package/eslint-plugin-command

## Dependencies (1)

- [@es-joy/jsdoccomment](https://npm.io/package/@es-joy/jsdoccomment.md) ^0.92.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2026-07-31
- 3.5.3 — 2026-07-14
- 3.5.2 — 2026-02-25
- 3.5.1 — 2026-02-24
- 3.4.0 — 2025-12-10
- 3.3.1 — 2025-06-23
- 3.3.0 — 2025-06-20
- 3.2.1 — 2025-05-24
- 3.2.0 — 2025-03-21
- 3.1.0 — 2025-02-15
- 3.0.0 — 2025-01-25
- 2.1.0 — 2025-01-09
- 2.0.7 — 2025-01-09
- 0.2.7 — 2024-12-17
- 0.2.6 — 2024-09-26
- … 19 more at https://npm.io/package/eslint-plugin-command/versions

## README

# eslint-plugin-command

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]

[**Documentations**](https://eslint-plugin-command.antfu.me/)

Comment-as-command for one-off codemod with ESLint.

https://github.com/antfu/eslint-plugin-command/assets/11247099/ec401a21-4081-42d0-8748-9d0376b7d501

## Introduction

**ESLint Plugin Command** is a special kind of ESLint plugin, that by default, **does nothing**. Instead of checking for code quality, it serves as a micro-codemod tool triggers by special comments on-demand, resuse the infrastructure of ESLint.

For example, one of the built-in commands, `/// to-function` allows you to convert a single arrow function expression to a function declaration.

<!-- eslint-skip -->

```ts
/// to-function
const foo = async <T>(msg: T): void => {
  console.log(msg)
}
```

Will be transformed to this when you hit save with your editor or run `eslint . --fix`. After executing the command, the comment will also be removed along with the transformation:

```ts
async function foo<T>(msg: T): void {
  console.log(msg)
}
```

One more example that `/// to-promise-all` converts a sequence of `await` expressions to `await Promise.all()`:

<!-- eslint-skip -->

```ts
/// to-promise-all
const foo = await bar().then
const { get } = await import('lodash-es')
```

Will be transformed to:

```ts
const [
  foo,
  { get },
] = await Promise.all([
  bar(),
  import('lodash-es'),
] as const)
```

Refer to the [documentation](https://eslint-plugin-command.antfu.me/) for more details.

## Sponsors

<p align="center">
  <a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.circles.svg">
    <img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.circles.svg' alt='Sponsors'/>
  </a>
</p>

## License

MIT License © 2024-PRESENT [Anthony Fu](https://github.com/antfu)

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/eslint-plugin-command?style=flat&colorA=080f12&colorB=1fa669
[npm-version-href]: https://npmjs.com/package/eslint-plugin-command
[npm-downloads-src]: https://img.shields.io/npm/dm/eslint-plugin-command?style=flat&colorA=080f12&colorB=1fa669
[npm-downloads-href]: https://npmjs.com/package/eslint-plugin-command

---
_Source: https://npm.io/package/eslint-plugin-command · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
