Skip to content

Commit bb0ae2f

Browse files
committed
Fixed formatting
1 parent 7a214bd commit bb0ae2f

File tree

4 files changed

+35
-46
lines changed

4 files changed

+35
-46
lines changed

src/compiler/commandLineParser.ts

+32-42
Original file line numberDiff line numberDiff line change
@@ -2372,9 +2372,9 @@ export function convertToObjectWorker(
23722372
}
23732373
reportInvalidOptionValue(option && isString(option.type) && option.type !== "string" && (option.type !== "listOrElement" || (isString(option.element.type) && option.element.type !== "string")));
23742374
const text = (valueExpression as StringLiteral).text;
2375-
if (option) {
2376-
Debug.assert(option.type !== "listOrElement" || option.element.type === "string", "Only string or array of string is handled for now");
2377-
}
2375+
if (option) {
2376+
Debug.assert(option.type !== "listOrElement" || option.element.type === "string", "Only string or array of string is handled for now");
2377+
}
23782378
if (option && !isString(option.type)) {
23792379
const customOption = option as CommandLineOptionOfCustomType;
23802380
// Validate custom option type
@@ -2584,16 +2584,6 @@ function matchesSpecs(path: string, includeSpecs: readonly string[] | undefined,
25842584
}
25852585

25862586
function getCustomTypeMapOfCommandLineOption(optionDefinition: CommandLineOption): Map<string, string | number> | undefined {
2587-
// if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean" || optionDefinition.type === "object") {
2588-
// // this is of a type CommandLineOptionOfPrimitiveType
2589-
// return undefined;
2590-
// }
2591-
// else if (optionDefinition.type === "list" || optionDefinition.type === "listOrElement") {
2592-
// return getCustomTypeMapOfCommandLineOption(optionDefinition.element);
2593-
// }
2594-
// else {
2595-
// return optionDefinition.type;
2596-
// }
25972587
switch (optionDefinition.type) {
25982588
case "string":
25992589
case "number":
@@ -3298,33 +3288,33 @@ function parseOwnConfigOfJsonSourceFile(
32983288
switch (key) {
32993289
case "extends":
33003290
const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
3301-
if (isString(value)) {
3302-
extendedConfigPath = getExtendsConfigPath(
3303-
value,
3304-
host,
3305-
newBase,
3306-
errors,
3307-
(message, arg0) =>
3308-
createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0)
3309-
);
3310-
}
3311-
else {
3312-
extendedConfigPath = [];
3313-
for (let index = 0; index < (value as unknown[]).length; index++) {
3314-
const fileName = (value as unknown[])[index];
3315-
if (isString(fileName)) {
3316-
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
3317-
fileName,
3318-
host,
3319-
newBase,
3320-
errors,
3321-
(message, arg0) =>
3322-
createDiagnosticForNodeInSourceFile(sourceFile, (valueNode as ArrayLiteralExpression).elements[index], message, arg0)
3323-
));
3324-
}
3291+
if (isString(value)) {
3292+
extendedConfigPath = getExtendsConfigPath(
3293+
value,
3294+
host,
3295+
newBase,
3296+
errors,
3297+
(message, arg0) =>
3298+
createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0)
3299+
);
3300+
}
3301+
else {
3302+
extendedConfigPath = [];
3303+
for (let index = 0; index < (value as unknown[]).length; index++) {
3304+
const fileName = (value as unknown[])[index];
3305+
if (isString(fileName)) {
3306+
extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(
3307+
fileName,
3308+
host,
3309+
newBase,
3310+
errors,
3311+
(message, arg0) =>
3312+
createDiagnosticForNodeInSourceFile(sourceFile, (valueNode as ArrayLiteralExpression).elements[index], message, arg0)
3313+
));
33253314
}
33263315
}
3327-
return;
3316+
}
3317+
return;
33283318
}
33293319
},
33303320
onSetUnknownOptionKeyValueInRoot(key: string, keyNode: PropertyName, _value: CompilerOptionsValue, _valueNode: Expression) {
@@ -3399,7 +3389,7 @@ function getExtendedConfig(
33993389
resolutionStack: string[],
34003390
errors: Push<Diagnostic>,
34013391
extendedConfigCache: Map<string, ExtendedConfigCacheEntry> | undefined,
3402-
result: ExtendsResult
3392+
result: ExtendsResult
34033393
): ParsedTsconfig | undefined {
34043394
const path = host.useCaseSensitiveFileNames ? extendedConfigPath : toFileNameLowerCase(extendedConfigPath);
34053395
let value: ExtendedConfigCacheEntry | undefined;
@@ -3422,10 +3412,10 @@ function getExtendedConfig(
34223412
(result.extendedSourceFiles ??= new Set()).add(extendedResult.fileName);
34233413
if (extendedResult.extendedSourceFiles) {
34243414
for (const extenedSourceFile of extendedResult.extendedSourceFiles) {
3425-
result.extendedSourceFiles.add(extenedSourceFile);
3415+
result.extendedSourceFiles.add(extenedSourceFile);
34263416
}
34273417
}
3428-
}
3418+
}
34293419
if (extendedResult.parseDiagnostics.length) {
34303420
errors.push(...extendedResult.parseDiagnostics);
34313421
return undefined;
@@ -3538,7 +3528,7 @@ export function convertJsonOption(opt: CommandLineOption, value: any, basePath:
35383528
function normalizeOptionValue(option: CommandLineOption, basePath: string, value: any): CompilerOptionsValue {
35393529
if (isNullOrUndefined(value)) return undefined;
35403530
if (option.type === "listOrElement" && !isArray(value)) return normalizeOptionValue(option.element, basePath, value);
3541-
else if (option.type === "list" || option.type === "listOrElement") {
3531+
else if (option.type === "list" || option.type === "listOrElement") {
35423532
const listOption = option;
35433533
if (listOption.element.isFilePath || !isString(listOption.element.type)) {
35443534
return filter(map(value, v => normalizeOptionValue(listOption.element, basePath, v)), v => listOption.listPreserveFalsyValues ? true : !!v) as CompilerOptionsValue;

src/compiler/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6960,7 +6960,7 @@ export interface CreateProgramOptions {
69606960
/** @internal */
69616961
export interface CommandLineOptionBase {
69626962
name: string;
6963-
type: "string" | "number" | "boolean" | "object" | "list" | "listOrElement" | Map<string, number | string> ; // a value of a primitive type, or an object literal mapping named values to actual values
6963+
type: "string" | "number" | "boolean" | "object" | "list" | "listOrElement" | Map<string, number | string>; // a value of a primitive type, or an object literal mapping named values to actual values
69646964
isFilePath?: boolean; // True if option value is a path or fileName
69656965
shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help'
69666966
description?: DiagnosticMessage; // The message describing what the command line switch does.

src/executeCommandLine/executeCommandLine.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ function generateOptionOutput(sys: System, option: CommandLineOption, rightAlign
406406
}
407407
return possibleValues;
408408
}
409-
}
410409
}
410+
}
411411

412412
function generateGroupOptionOutput(sys: System, optionsList: readonly CommandLineOption[]) {
413413
let maxLength = 0;

src/services/getEditsForFileRename.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ function updateTsconfigFiles(program: Program, changeTracker: textChanges.Change
120120
if (foundExactMatch || propertyName !== "include" || !isArrayLiteralExpression(property.initializer)) return;
121121
const includes = mapDefined(property.initializer.elements, e => isStringLiteral(e) ? e.text : undefined);
122122
if (includes.length === 0) return;
123-
const matchers = getFileMatcherPatterns(
124-
configDir, /*excludes*/[], includes, useCaseSensitiveFileNames, currentDirectory);
123+
const matchers = getFileMatcherPatterns(configDir, /*excludes*/[], includes, useCaseSensitiveFileNames, currentDirectory);
125124
// If there isn't some include for this, add a new one.
126125
if (getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames).test(oldFileOrDirPath) &&
127126
!getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames).test(newFileOrDirPath)) {

0 commit comments

Comments
 (0)