Fixing few code review comments
This commit is contained in:
parent
0fe282e719
commit
ce652dc7fb
|
@ -375,9 +375,14 @@ namespace ts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses non quoted strings separated by comma e.g. "a,b" would result in string array ["a", "b"]
|
||||||
|
* @param s
|
||||||
|
* @param existingValue
|
||||||
|
*/
|
||||||
function parseMultiValueStringArray(s: string, existingValue: string[]) {
|
function parseMultiValueStringArray(s: string, existingValue: string[]) {
|
||||||
let value: string[] = existingValue || [];
|
let value: string[] = existingValue || [];
|
||||||
let hasError: boolean;
|
let hasError = false;
|
||||||
let currentString = "";
|
let currentString = "";
|
||||||
if (s) {
|
if (s) {
|
||||||
for (let i = 0; i < s.length; i++) {
|
for (let i = 0; i < s.length; i++) {
|
||||||
|
@ -480,8 +485,7 @@ namespace ts {
|
||||||
}
|
}
|
||||||
// Check if the value asked was string[] and value provided was not string[]
|
// Check if the value asked was string[] and value provided was not string[]
|
||||||
else if (expectedType !== "string[]" ||
|
else if (expectedType !== "string[]" ||
|
||||||
typeof jsonValue !== "object" ||
|
!(jsonValue instanceof Array) ||
|
||||||
typeof jsonValue.length !== "number" ||
|
|
||||||
forEach(<string[]>jsonValue, individualValue => typeof individualValue !== "string")) {
|
forEach(<string[]>jsonValue, individualValue => typeof individualValue !== "string")) {
|
||||||
// Not expectedType
|
// Not expectedType
|
||||||
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType));
|
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType));
|
||||||
|
|
|
@ -14,10 +14,10 @@ namespace ts {
|
||||||
|
|
||||||
export const version = "1.7.0";
|
export const version = "1.7.0";
|
||||||
|
|
||||||
export function findConfigFile(searchPath: string, moduleResolutionHost: ModuleResolutionHost): string {
|
export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string {
|
||||||
let fileName = "tsconfig.json";
|
let fileName = "tsconfig.json";
|
||||||
while (true) {
|
while (true) {
|
||||||
if (moduleResolutionHost.fileExists(fileName)) {
|
if (fileExists(fileName)) {
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
let parentPath = getDirectoryPath(searchPath);
|
let parentPath = getDirectoryPath(searchPath);
|
||||||
|
|
|
@ -188,7 +188,7 @@ namespace ts {
|
||||||
}
|
}
|
||||||
else if (commandLine.fileNames.length === 0 && isJSONSupported()) {
|
else if (commandLine.fileNames.length === 0 && isJSONSupported()) {
|
||||||
let searchPath = normalizePath(sys.getCurrentDirectory());
|
let searchPath = normalizePath(sys.getCurrentDirectory());
|
||||||
configFileName = findConfigFile(searchPath, sys);
|
configFileName = findConfigFile(searchPath, sys.fileExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandLine.fileNames.length === 0 && !configFileName) {
|
if (commandLine.fileNames.length === 0 && !configFileName) {
|
||||||
|
|
|
@ -195,7 +195,7 @@ class ProjectRunner extends RunnerBase {
|
||||||
assert(!inputFiles || inputFiles.length === 0, "cannot specify input files and project option together");
|
assert(!inputFiles || inputFiles.length === 0, "cannot specify input files and project option together");
|
||||||
}
|
}
|
||||||
else if (!inputFiles || inputFiles.length === 0) {
|
else if (!inputFiles || inputFiles.length === 0) {
|
||||||
configFileName = ts.findConfigFile("", { fileExists, readFile: getSourceFileText });
|
configFileName = ts.findConfigFile("", fileExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configFileName) {
|
if (configFileName) {
|
||||||
|
|
Loading…
Reference in a new issue