mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 00:55:32 -05:00
Add link to documentation in tsconfig.json template generated by tsc --init (#34686)
* Add Advanced Compile Options to --init command * removed advanced options and descriptioncolumn * tests: fix tsconfig.json baselines * tests: fix failing tests * feat: adjusted link to specification * fix: removed duplicate increment flag * chore: moved position back * return of the comments * fix for missalignment * return of the comment
This commit is contained in:
@@ -2119,15 +2119,12 @@ namespace ts {
|
||||
// Serialize all options and their descriptions
|
||||
let marginLength = 0;
|
||||
let seenKnownKeys = 0;
|
||||
const nameColumn: string[] = [];
|
||||
const descriptionColumn: string[] = [];
|
||||
const entries: { value: string, description?: string }[] = [];
|
||||
categorizedOptions.forEach((options, category) => {
|
||||
if (nameColumn.length !== 0) {
|
||||
nameColumn.push("");
|
||||
descriptionColumn.push("");
|
||||
if (entries.length !== 0) {
|
||||
entries.push({ value: "" });
|
||||
}
|
||||
nameColumn.push(`/* ${category} */`);
|
||||
descriptionColumn.push("");
|
||||
entries.push({ value: `/* ${category} */` });
|
||||
for (const option of options) {
|
||||
let optionName;
|
||||
if (compilerOptionsMap.has(option.name)) {
|
||||
@@ -2136,8 +2133,10 @@ namespace ts {
|
||||
else {
|
||||
optionName = `// "${option.name}": ${JSON.stringify(getDefaultValueForOption(option))},`;
|
||||
}
|
||||
nameColumn.push(optionName);
|
||||
descriptionColumn.push(`/* ${option.description && getLocaleSpecificMessage(option.description) || option.name} */`);
|
||||
entries.push({
|
||||
value: optionName,
|
||||
description: `/* ${option.description && getLocaleSpecificMessage(option.description) || option.name} */`
|
||||
});
|
||||
marginLength = Math.max(optionName.length, marginLength);
|
||||
}
|
||||
});
|
||||
@@ -2147,11 +2146,12 @@ namespace ts {
|
||||
const result: string[] = [];
|
||||
result.push(`{`);
|
||||
result.push(`${tab}"compilerOptions": {`);
|
||||
result.push(`${tab}${tab}/* ${getLocaleSpecificMessage(Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_json_to_read_more_about_this_file)} */`);
|
||||
result.push("");
|
||||
// Print out each row, aligning all the descriptions on the same column.
|
||||
for (let i = 0; i < nameColumn.length; i++) {
|
||||
const optionName = nameColumn[i];
|
||||
const description = descriptionColumn[i];
|
||||
result.push(optionName && `${tab}${tab}${optionName}${description && (makePadding(marginLength - optionName.length + 2) + description)}`);
|
||||
for (const entry of entries) {
|
||||
const { value, description = "" } = entry;
|
||||
result.push(value && `${tab}${tab}${value}${description && (makePadding(marginLength - value.length + 2) + description)}`);
|
||||
}
|
||||
if (fileNames.length) {
|
||||
result.push(`${tab}},`);
|
||||
|
||||
@@ -5613,7 +5613,10 @@
|
||||
"category": "Message",
|
||||
"code": 95109
|
||||
},
|
||||
|
||||
"Visit https://aka.ms/tsconfig.json to read more about this file": {
|
||||
"category": "Message",
|
||||
"code": 95110
|
||||
},
|
||||
"No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": {
|
||||
"category": "Error",
|
||||
"code": 18004
|
||||
|
||||
Reference in New Issue
Block a user