Commit 1381c513 authored by David Sveningsson's avatar David Sveningsson

feat(cli): exit early when encountering unknown cli arguments

parent 95c67374
......@@ -125,6 +125,8 @@ const argv: minimist.ParsedArgs = minimist(process.argv.slice(2), {
"ext",
"f",
"formatter",
"h",
"help",
"max-warnings",
"rule",
"stdin-filename",
......@@ -140,10 +142,18 @@ const argv: minimist.ParsedArgs = minimist(process.argv.slice(2), {
alias: {
c: "config",
f: "formatter",
h: "help",
},
default: {
formatter: "stylish",
},
unknown: (opt: string) => {
if (opt[0] === "-") {
process.stderr.write(`unknown option ${opt}\n`);
process.exit(1);
}
return true;
},
});
function showUsage(): void {
......@@ -193,7 +203,7 @@ if (argv.version) {
process.exit();
}
if (argv.h || argv.help || argv._.length === 0) {
if (argv.help || argv._.length === 0) {
showUsage();
process.exit();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment