Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use string union types instead of enums for better TypeScript compatibility with public config file type #322

Merged
merged 1 commit into from Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/types.ts
Expand Up @@ -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. */
Expand All @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions test/lib/generate/option-rule-doc-notices-test.ts
Expand Up @@ -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();
Expand Down