Skip to content

Commit

Permalink
✨ Create eslint-generate-todo cli bin
Browse files Browse the repository at this point in the history
  • Loading branch information
markbrouch committed Dec 19, 2019
1 parent 2bcb7a7 commit 1a49aa9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions bin/eslint-generate-todo.js
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);

0 comments on commit 1a49aa9

Please sign in to comment.