← 返回首页
GitHub - antfu/eslint-plugin-command: Comment-as-command for one-off codemod with ESLint. · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

antfu/eslint-plugin-command

Go to file
Code

Repository files navigation

More items

eslint-plugin-command

Documentations

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

eslint-plugin-command-half.mov

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.

/// 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:

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():

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

Will be transformed to:

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

About

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

Topics

Resources

License

Code of conduct

Contributing

Stars

370 stars

Watchers

3 watching

Forks

Sponsor this project

 
Sponsor

Packages

 
 
 

Contributors

Footer

© 2026 GitHub, Inc.