Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

eslint-plugin-command

> 编程语言
Open source

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

374 stars0 likes1 views
WebsiteGitHub

About

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

eslint-plugin-command

npm version npm downloads

Documentations

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.

typescript
/// to-function
const foo = async (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:

typescript
async function foo(msg: T): void {
  console.log(msg)
}

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

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

Will be transformed to:

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

Refer to the documentation for more details.

Sponsors

License

MIT License © 2024-PRESENT Anthony Fu

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptcodemodeslint-plugin

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言