eslint-doc-generator
Version:
Automatic documentation generator for ESLint plugins and rules.
77 lines (76 loc) • 2.31 kB
JavaScript
// Custom types.
/**
* Where a rule comes from (where it's defined).
*/
export const RULE_SOURCE = {
self: 'self', // From this plugin.
eslintCore: 'eslintCore',
thirdPartyPlugin: 'thirdPartyPlugin',
};
export const SEVERITY_ERROR = new Set([2, 'error']);
export const SEVERITY_WARN = new Set([1, 'warn']);
export const SEVERITY_OFF = new Set([0, 'off']);
export const SEVERITY_TYPE = {
error: 'error',
warn: 'warn',
off: 'off',
};
export const SEVERITY_TYPE_TO_SET = {
[SEVERITY_TYPE.error]: SEVERITY_ERROR,
[SEVERITY_TYPE.warn]: SEVERITY_WARN,
[SEVERITY_TYPE.off]: SEVERITY_OFF,
};
/**
* Rule doc notices.
*/
export const NOTICE_TYPE = {
CONFIGS: 'configs',
DEPRECATED: 'deprecated',
DESCRIPTION: 'description',
FIXABLE: 'fixable',
FIXABLE_AND_HAS_SUGGESTIONS: 'fixableAndHasSuggestions', // Consolidated notice for space-saving.
HAS_SUGGESTIONS: 'hasSuggestions',
OPTIONS: 'options',
REQUIRES_TYPE_CHECKING: 'requiresTypeChecking',
TYPE: 'type',
};
/**
* Rule list columns.
*/
export const COLUMN_TYPE = {
CONFIGS_ERROR: 'configsError',
CONFIGS_OFF: 'configsOff',
CONFIGS_WARN: 'configsWarn',
DEPRECATED: 'deprecated',
DESCRIPTION: 'description',
FIXABLE: 'fixable',
FIXABLE_AND_HAS_SUGGESTIONS: 'fixableAndHasSuggestions', // Consolidated column for space-saving.
HAS_SUGGESTIONS: 'hasSuggestions',
NAME: 'name',
OPTIONS: 'options',
REQUIRES_TYPE_CHECKING: 'requiresTypeChecking',
TYPE: 'type',
};
/**
* CLI/config file options.
*/
export const OPTION_TYPE = {
CHECK: 'check',
CONFIG_EMOJI: 'configEmoji',
CONFIG_FORMAT: 'configFormat',
IGNORE_CONFIG: 'ignoreConfig',
IGNORE_DEPRECATED_RULES: 'ignoreDeprecatedRules',
INIT_RULE_DOCS: 'initRuleDocs',
PATH_RULE_DOC: 'pathRuleDoc',
PATH_RULE_LIST: 'pathRuleList',
POSTPROCESS: 'postprocess',
RULE_DOC_NOTICES: 'ruleDocNotices',
RULE_DOC_SECTION_EXCLUDE: 'ruleDocSectionExclude',
RULE_DOC_SECTION_INCLUDE: 'ruleDocSectionInclude',
RULE_DOC_SECTION_OPTIONS: 'ruleDocSectionOptions',
RULE_DOC_TITLE_FORMAT: 'ruleDocTitleFormat',
RULE_LIST_COLUMNS: 'ruleListColumns',
RULE_LIST_SPLIT: 'ruleListSplit',
URL_CONFIGS: 'urlConfigs',
URL_RULE_DOC: 'urlRuleDoc',
};