From 1a49aa9fb412c2b3ac4e937e968e4dd0a32990ad Mon Sep 17 00:00:00 2001 From: Mark Brouch Date: Thu, 19 Dec 2019 17:20:13 -0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Create=20eslint-generate-todo=20cli?= =?UTF-8?q?=20bin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/eslint-generate-todo.js | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 bin/eslint-generate-todo.js diff --git a/bin/eslint-generate-todo.js b/bin/eslint-generate-todo.js new file mode 100755 index 0000000..2a600b9 --- /dev/null +++ b/bin/eslint-generate-todo.js @@ -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 ", + "Set the output format of the todo list ", + ["yaml", "json"], + "yaml" + ) + .option( + "-o --off", + "Set todo list items to 'off' instead of 'warning'", + program.BOOL, + false + ) + .option( + "-p --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);