Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
Mark inputFilePath as optional in findConfiguration()
Browse files Browse the repository at this point in the history
When `suppliedConfigFilePath` is passed to `findConfigurationPath()`, `inputFilePath` is completely ignored and should therefore be optional
  • Loading branch information
lumaxis committed Sep 2, 2017
1 parent 729694e commit aad0683
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/configuration.ts
Expand Up @@ -90,7 +90,7 @@ const BUILT_IN_CONFIG = /^tslint:(.*)$/;
* of the search for a configuration.
* @returns Load status for a TSLint configuration object
*/
export function findConfiguration(configFile: string | null, inputFilePath: string): IConfigurationLoadResult {
export function findConfiguration(configFile: string | null, inputFilePath?: string): IConfigurationLoadResult {
const configPath = findConfigurationPath(configFile, inputFilePath);
const loadResult: IConfigurationLoadResult = { path: configPath };

Expand All @@ -112,14 +112,14 @@ export function findConfiguration(configFile: string | null, inputFilePath: stri
* @returns An absolute path to a tslint.json file
* or undefined if neither can be found.
*/
export function findConfigurationPath(suppliedConfigFilePath: string | null, inputFilePath: string) {
export function findConfigurationPath(suppliedConfigFilePath: string | null, inputFilePath?: string) {
if (suppliedConfigFilePath != null) {
if (!fs.existsSync(suppliedConfigFilePath)) {
throw new FatalError(`Could not find config file at: ${path.resolve(suppliedConfigFilePath)}`);
} else {
return path.resolve(suppliedConfigFilePath);
}
} else {
} else if (inputFilePath) {
// convert to dir if it's a file or doesn't exist
let useDirName = false;
try {
Expand Down Expand Up @@ -149,10 +149,9 @@ export function findConfigurationPath(suppliedConfigFilePath: string | null, inp
return path.resolve(configFilePath);
}
}

// no path could be found
return undefined;
}
// no path could be found
return undefined;
}

/**
Expand Down

0 comments on commit aad0683

Please sign in to comment.