Skip to content

Commit 4caf1d6

Browse files
committed
Ensure findConfigPathForFolder() parameter is a folder
1 parent 39ac514 commit 4caf1d6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

eslint-plugin/src/ConfigCache.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,19 @@ export class ConfigCache {
2828
* Node.js equivalent of performance.now().
2929
*/
3030
private static _getTimeInMs(): number {
31-
throw new Error('oops');
3231
const [seconds, nanoseconds] = process.hrtime();
3332
return seconds * 1000 + nanoseconds / 1000000;
3433
}
3534

3635
public static getForSourceFile(sourceFilePath: string): TSDocConfigFile {
36+
const sourceFileFolder: string = path.dirname(path.resolve(sourceFilePath));
37+
3738
// First, determine the file to be loaded. If not found, the configFilePath will be an empty string.
38-
const configFilePath: string = TSDocConfigFile.findConfigPathForFolder(sourceFilePath);
39+
const configFilePath: string = TSDocConfigFile.findConfigPathForFolder(sourceFileFolder);
3940

4041
// If configFilePath is an empty string, then we'll use the folder of sourceFilePath as our cache key
4142
// (instead of an empty string)
42-
const cacheKey: string = configFilePath || path.dirname(sourceFilePath);
43+
const cacheKey: string = configFilePath || (sourceFileFolder + '/');
4344
Debug.log(`Cache key: "${cacheKey}"`);
4445

4546
const nowMs: number = ConfigCache._getTimeInMs();

0 commit comments

Comments
 (0)