-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Create eslint-generate-todo cli bin
- Loading branch information
1 parent
2bcb7a7
commit 1a49aa9
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env node | ||
|
||
const program = require("caporal"); | ||
const { execute } = require("../dist/index"); | ||
const package = require("../package.json"); | ||
|
||
program | ||
.version(package.version) | ||
.description("Generates a list of disabled eslint rules.") | ||
.argument("[files...]", "Files to validate", program.LIST, ".") | ||
.option( | ||
"-f --format <format>", | ||
"Set the output format of the todo list <yaml | json>", | ||
["yaml", "json"], | ||
"yaml" | ||
) | ||
.option( | ||
"-o --off", | ||
"Set todo list items to 'off' instead of 'warning'", | ||
program.BOOL, | ||
false | ||
) | ||
.option( | ||
"-p --path <path>", | ||
"Set the location of the generated todo list overrides file" | ||
) | ||
.action(async (args, options, logger) => { | ||
const level = options.off ? "off" : "warn"; | ||
|
||
const configFile = await execute(args.files, { | ||
level, | ||
format: options.format, | ||
path: options.path | ||
}); | ||
|
||
logger.info(`ESLint todo config written to ${configFile}`); | ||
logger.info("You may now extend this config in your ESLint config file."); | ||
}); | ||
|
||
program.parse(process.argv); |