From 564d012fc6e86723857a43bf51caa7e69f7a5656 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Thu, 1 Dec 2022 16:30:00 -0500 Subject: [PATCH] Use string union types instead of enums for better TypeScript compatibility with config file type (#322) --- lib/types.ts | 4 ++-- test/lib/generate/option-rule-doc-notices-test.ts | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/types.ts b/lib/types.ts index 713ebde5..da619f9b 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -143,7 +143,7 @@ export type GenerateOptions = { * Choices: `configs`, `deprecated`, `fixable` (off by default), `fixableAndHasSuggestions`, `hasSuggestions` (off by default), `options` (off by default), `requiresTypeChecking`, `type` (off by default). * Default: `['deprecated', 'configs', 'fixableAndHasSuggestions', 'requiresTypeChecking']`. */ - readonly ruleDocNotices?: readonly NOTICE_TYPE[]; + readonly ruleDocNotices?: readonly `${NOTICE_TYPE}`[]; /** Disallowed sections in each rule doc. Exit with failure if present. */ readonly ruleDocSectionExclude?: readonly string[]; /** Required sections in each rule doc. Exit with failure if missing. */ @@ -158,7 +158,7 @@ export type GenerateOptions = { * Choices: `configsError`, `configsOff`, `configsWarn`, `deprecated`, `description`, `fixable`, `fixableAndHasSuggestions` (off by default), `hasSuggestions`, `name`, `options` (off by default), `requiresTypeChecking`, `type` (off by default). * Default: `['name', 'description', 'configsError', 'configsWarn', 'configsOff', 'fixable', 'hasSuggestions', 'requiresTypeChecking', 'deprecated']`. */ - readonly ruleListColumns?: readonly COLUMN_TYPE[]; + readonly ruleListColumns?: readonly `${COLUMN_TYPE}`[]; /** * Rule property to split the rules list by. * A separate list and header will be created for each value. diff --git a/test/lib/generate/option-rule-doc-notices-test.ts b/test/lib/generate/option-rule-doc-notices-test.ts index 32e4517d..239aa105 100644 --- a/test/lib/generate/option-rule-doc-notices-test.ts +++ b/test/lib/generate/option-rule-doc-notices-test.ts @@ -174,9 +174,7 @@ describe('generate (--rule-doc-notices)', function () { it('has no issues', async function () { await expect( generate('.', { - // @ts-expect-error -- testing string value instead of enum ruleDocNotices: ['type'], - // @ts-expect-error -- testing string value instead of enum ruleListColumns: ['name'], }) ).resolves.toBeUndefined();