Skip to content

tsc should ignore hidden files by default #6861

Closed
@evmar

Description

@evmar

On Unixy platforms, tsc should by default not attempt to compile files that begin with a dot (hereafter called "hidden files"). These files are intended to be hidden, and in practice any file that has a name like .foo.ts is always a temporary file written by an editor while saving.

Currently, when you run tsc --watch in a directory and hit save in emacs, tsc picks up the hidden temporary file and attempts to compile it, resulting in duplicate definition errors (between the temporary file and the real source file). And it's surprisingly annoying to work around this problem -- you can't use a glob in your tsconfig.json excludes section, so you instead must enumerate each source file in a files section.

It is pretty standard on Unixes to ignore hidden files. For example the shell "*" ignores hidden files by default, as seen in the output of commands like ls * .

I cannot think of any circumstance where someone would want to bring in a hidden file to their compilation, but if they did perhaps they could do so manually via the files section -- it's definitely the sort of thing you ought to need to opt in to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do thisSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions