From 4eec0dda70e518bea761a8790f2c536840ea2643 Mon Sep 17 00:00:00 2001 From: ssube Date: Thu, 14 Nov 2019 06:02:55 -0600 Subject: [PATCH] lint: remove valid-mode check in main Mode is collected from a positional by yargs, but assigned from callbacks, so it cannot leave the enum's valid range. --- src/app.ts | 10 +++------- src/config/args.ts | 2 -- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/app.ts b/src/app.ts index 76ed1e5..ad7ac7b 100644 --- a/src/app.ts +++ b/src/app.ts @@ -2,7 +2,7 @@ import { createLogger } from 'bunyan'; import { showCompletionScript } from 'yargs'; import { loadConfig } from './config'; -import { CONFIG_ARGS_NAME, CONFIG_ARGS_PATH, MODE, parseArgs, VALID_MODES } from './config/args'; +import { CONFIG_ARGS_NAME, CONFIG_ARGS_PATH, MODE, parseArgs } from './config/args'; import { YamlParser } from './parser/YamlParser'; import { createRuleSelector, createRuleSources, loadRules, resolveRules, visitRules } from './rule'; import { readSource, writeSource } from './source'; @@ -26,12 +26,7 @@ export async function main(argv: Array): Promise { logger.info(VERSION_INFO, 'version info'); logger.info({ args, mode }, 'main arguments'); - // check mode - if (!VALID_MODES.has(mode)) { - logger.error({ mode }, 'unsupported mode'); - return STATUS_ERROR; - } - + // load rules const ctx = new VisitorContext({ logger, schemaOptions: { @@ -59,6 +54,7 @@ export async function main(argv: Array): Promise { return STATUS_SUCCESS; } + // load source const parser = new YamlParser(); const source = await readSource(args.source); const docs = parser.parse(source); diff --git a/src/config/args.ts b/src/config/args.ts index 201cf2f..f3d7676 100644 --- a/src/config/args.ts +++ b/src/config/args.ts @@ -10,8 +10,6 @@ export enum MODE { list = 'list', } -export const VALID_MODES = new Set([MODE.check, MODE.fix, MODE.list]); - /* eslint-disable @typescript-eslint/no-explicit-any */ export const CONFIG_ARGS_NAME = 'config-name';