mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Make the init config category order predictable (#51247)
This commit is contained in:
parent
1ca99b3402
commit
2625c1feae
@ -2582,12 +2582,21 @@ namespace ts {
|
||||
|
||||
function writeConfigurations() {
|
||||
// Filter applicable options to place in the file
|
||||
const categorizedOptions = createMultiMap<CommandLineOption>();
|
||||
const categorizedOptions = new Map<DiagnosticMessage, CommandLineOption[]>();
|
||||
// Set allowed categories in order
|
||||
categorizedOptions.set(Diagnostics.Projects, []);
|
||||
categorizedOptions.set(Diagnostics.Language_and_Environment, []);
|
||||
categorizedOptions.set(Diagnostics.Modules, []);
|
||||
categorizedOptions.set(Diagnostics.JavaScript_Support, []);
|
||||
categorizedOptions.set(Diagnostics.Emit, []);
|
||||
categorizedOptions.set(Diagnostics.Interop_Constraints, []);
|
||||
categorizedOptions.set(Diagnostics.Type_Checking, []);
|
||||
categorizedOptions.set(Diagnostics.Completeness, []);
|
||||
for (const option of optionDeclarations) {
|
||||
const { category } = option;
|
||||
|
||||
if (isAllowedOptionForOutput(option)) {
|
||||
categorizedOptions.add(getLocaleSpecificMessage(category!), option);
|
||||
let listForCategory = categorizedOptions.get(option.category!);
|
||||
if (!listForCategory) categorizedOptions.set(option.category!, listForCategory = []);
|
||||
listForCategory.push(option);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2599,7 +2608,7 @@ namespace ts {
|
||||
if (entries.length !== 0) {
|
||||
entries.push({ value: "" });
|
||||
}
|
||||
entries.push({ value: `/* ${category} */` });
|
||||
entries.push({ value: `/* ${getLocaleSpecificMessage(category)} */` });
|
||||
for (const option of options) {
|
||||
let optionName;
|
||||
if (compilerOptionsMap.has(option.name)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user