|
| 1 | +/** @type {import('eslint-doc-generator').GenerateOptions} */ |
| 2 | +const config = { |
| 3 | + configFormat: 'plugin-colon-prefix-name', |
| 4 | + ignoreConfig: ['all'], |
| 5 | + pathRuleList: ['README.md', 'docs/rules/index.md'], |
| 6 | + ruleDocSectionInclude: ['Rule Details', 'Version', 'Implementation'], |
| 7 | + ruleDocSectionOptions: false, |
| 8 | + ruleDocTitleFormat: 'prefix-name', |
| 9 | + ruleListColumns: [ |
| 10 | + // All standard columns except `deprecated` since we split the list such that there's a dedicated "Deprecated" section. |
| 11 | + 'name', |
| 12 | + 'description', |
| 13 | + 'configsError', |
| 14 | + 'configsWarn', |
| 15 | + 'configsOff', |
| 16 | + 'fixable', |
| 17 | + 'hasSuggestions', |
| 18 | + 'requiresTypeChecking', |
| 19 | + ], |
| 20 | + ruleListSplit(rules) { |
| 21 | + return [ |
| 22 | + { |
| 23 | + title: 'Possible Errors', |
| 24 | + rules: rules.filter( |
| 25 | + ([, rule]) => rule.meta.docs.category === 'Possible Errors' && !rule.meta.deprecated |
| 26 | + ), |
| 27 | + }, |
| 28 | + { |
| 29 | + title: 'Best Practices', |
| 30 | + rules: rules.filter( |
| 31 | + ([, rule]) => rule.meta.docs.category === 'Best Practices' && !rule.meta.deprecated |
| 32 | + ), |
| 33 | + }, |
| 34 | + { |
| 35 | + title: 'Stylistic Issues', |
| 36 | + rules: rules.filter( |
| 37 | + ([, rule]) => rule.meta.docs.category === 'Stylistic Issues' && !rule.meta.deprecated |
| 38 | + ), |
| 39 | + }, |
| 40 | + { |
| 41 | + title: 'Deprecated', |
| 42 | + rules: rules.filter(([, rule]) => rule.meta.deprecated), |
| 43 | + }, |
| 44 | + ]; |
| 45 | + }, |
| 46 | + urlRuleDoc(name, page) { |
| 47 | + if (page === 'README.md') { |
| 48 | + // Use URLs only in the README to link to the vitepress SPA. Otherwise, fallback to relative URLs. |
| 49 | + return `https://ota-meshi.github.io/eslint-plugin-regexp/rules/${name}.html`; |
| 50 | + } |
| 51 | + }, |
| 52 | +}; |
| 53 | + |
| 54 | +module.exports = config; |
0 commit comments