diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 733e3158593df..83e808c46ce5c 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -523,6 +523,11 @@ namespace ts { for (const extension of supportedExtensions) { const filesInDirWithExtension = host.readDirectory(basePath, extension, exclude); for (const fileName of filesInDirWithExtension) { + // skip hidden file on unixy platform + if (isHiddenFile(fileName)) { + continue; + } + // .ts extension would read the .d.ts extension files too but since .d.ts is lower priority extension, // lets pick them when its turn comes up if (extension === ".ts" && fileExtensionIs(fileName, ".d.ts")) { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index cfdcb2b930c63..dee3118ccfed6 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -769,6 +769,10 @@ namespace ts { return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } + export function isHiddenFile(path: string): boolean { + return getBaseFileName(path)[0] === "."; + } + /** * List of supported extensions in order of file resolution precedence. */ @@ -781,7 +785,7 @@ namespace ts { } export function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions) { - if (!fileName) { return false; } + if (!fileName || isHiddenFile(fileName)) { return false; } for (const extension of getSupportedExtensions(compilerOptions)) { if (fileExtensionIs(fileName, extension)) {