(context)
| 111 | } |
| 112 | |
| 113 | function createUsage(context) { |
| 114 | const sortedOptions = context.detailedOptions.sort((optionA, optionB) => |
| 115 | optionA.name.localeCompare(optionB.name), |
| 116 | ); |
| 117 | |
| 118 | const options = getOptionsWithOpposites(sortedOptions).filter( |
| 119 | // remove unnecessary option (e.g. `semi`, `color`, etc.), which is only used for --help <flag> |
| 120 | (option) => |
| 121 | !( |
| 122 | option.type === "boolean" && |
| 123 | option.oppositeDescription && |
| 124 | !option.name.startsWith("no-") |
| 125 | ), |
| 126 | ); |
| 127 | const groupedOptions = groupBy(options, (option) => option.category); |
| 128 | |
| 129 | const firstCategories = categoryOrder.slice(0, -1); |
| 130 | const lastCategories = categoryOrder.slice(-1); |
| 131 | const restCategories = Object.keys(groupedOptions).filter( |
| 132 | (category) => !categoryOrder.includes(category), |
| 133 | ); |
| 134 | const allCategories = [ |
| 135 | ...firstCategories, |
| 136 | ...restCategories, |
| 137 | ...lastCategories, |
| 138 | ]; |
| 139 | |
| 140 | const optionsUsage = allCategories.map((category) => { |
| 141 | const categoryOptions = groupedOptions[category] |
| 142 | .map((option) => |
| 143 | createOptionUsage(context, option, OPTION_USAGE_THRESHOLD), |
| 144 | ) |
| 145 | .join("\n"); |
| 146 | return `${category} options:\n\n${indent(categoryOptions, 2)}`; |
| 147 | }); |
| 148 | |
| 149 | return [usageSummary, ...optionsUsage, ""].join("\n\n"); |
| 150 | } |
| 151 | |
| 152 | function createPluginDefaults(pluginDefaults) { |
| 153 | if (!pluginDefaults || Object.keys(pluginDefaults).length === 0) { |
no test coverage detected
searching dependent graphs…