Skip to content

Commit

Permalink
chore(lint): fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed Sep 13, 2020
1 parent 7907413 commit 2dd4be9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions flags/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export function parseFlags<O extends Record<string, any> = Record<string, any>>(
}

/** Parse next argument for current option. */
// deno-lint-ignore no-inner-declarations
function parseNext(option: IFlagOptions, args: IFlagArgument[]): void {
const arg: IFlagArgument = args[argIndex];

Expand Down
16 changes: 8 additions & 8 deletions flags/validate-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function validateFlags(
}

option.conflicts?.forEach((flag: string) => {
if (isset(flag)) {
if (isset(flag, values)) {
throw new Error(
`Option --${option.name} conflicts with option: --${flag}`,
);
Expand All @@ -85,7 +85,7 @@ export function validateFlags(

option.depends?.forEach((flag: string) => {
// don't throw an error if the value is coming from the default option.
if (!isset(flag) && !defaultValues[option.name]) {
if (!isset(flag, values) && !defaultValues[option.name]) {
throw new Error(`Option --${option.name} depends on option: --${flag}`);
}
});
Expand All @@ -104,12 +104,6 @@ export function validateFlags(
throw new Error(`Missing value for option: --${option.name}`);
}
});

function isset(flag: string): boolean {
const name = paramCaseToCamelCase(flag);
// return typeof values[ name ] !== 'undefined' && values[ name ] !== false;
return typeof values[name] !== "undefined";
}
}

for (const option of flags) {
Expand All @@ -132,3 +126,9 @@ export function validateFlags(
throw new Error("No arguments.");
}
}

function isset(flag: string, values: Record<string, unknown>): boolean {
const name = paramCaseToCamelCase(flag);
// return typeof values[ name ] !== 'undefined' && values[ name ] !== false;
return typeof values[name] !== "undefined";
}
1 change: 0 additions & 1 deletion prompt/toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export class Toggle extends GenericPrompt<boolean, string, ToggleSettings> {
case this.settings.inactive:
return false;
}
return;
}

protected format(value: boolean): string {
Expand Down

0 comments on commit 2dd4be9

Please sign in to comment.