Repository: TypeScript
Issue: Option in TSConfig to include hidden/dot files
Labels: Suggestion,Awaiting More Feedback

# Suggestion

<!--
  Please fill in each section completely. Thank you!
-->

## 🔍 Search Terms

<!--
  💡 Did you know? TypeScript has over 2,000 open suggestions!
  🔎 Please search thoroughly before logging new feature requests as most common ideas already have a proposal in progress.
  The "Common Feature Requests" section of the FAQ lists many popular requests: https://github.com/Microsoft/TypeScript/wiki/FAQ#common-feature-requests

  Replace the text below:
-->

hidden, dot, dotfile, include, tsconfig.

## ✅ Viability Checklist

<!--
   Suggestions that don't meet all these criteria are very, very unlikely to be accepted.
   We always recommend reviewing the TypeScript design goals before investing time writing
   a proposal for ideas outside the scope of the project.
-->
My suggestion meets these guidelines:

* [X] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [X] This wouldn't change the runtime behavior of existing JavaScript code
* [X] This could be implemented without emitting different JS based on the types of the expressions
* [X] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [X] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).


## ⭐ Suggestion

<!-- A summary of what you'd like to see added or changed -->
Add an option in TSConfig to include hidden files (and hidden directories) in [`include`](https://www.typescriptlang.org/tsconfig#include) and [`exclude`](https://www.typescriptlang.org/tsconfig#exclude) options.

```JSON
{
    "hidden": true,
    "include": ["**/*"],
}
```

Other alternative names for `hidden`:

- `dot` like in:
  - [node-glob](https://github.com/isaacs/node-glob#options): _Include `.dot` files in normal matches and `globstar` matches. Note that an explicit dot in a portion of the pattern will always match dot files._
  - [globby](https://github.com/sindresorhus/globby#options) and [fast-glob](https://github.com/mrmlnc/fast-glob#dot): _Allow patterns to match entries that begin with a period (`.`)._
  - [tinyglobby](https://github.com/SuperchupuDev/tinyglobby#options): _Whether to allow entries starting with a dot._
- `dotfiles` like in [express](http://expressjs.com/en/5x/api.html#express.static) and [serve-static](https://github.com/expressjs/serve-static/#dotfiles) (it used [`hidden`](https://github.com/expressjs/serve-static/blob/HEAD/HISTORY.md#200-beta1--2022-02-05) before): _Determines how dotfiles (files or directories that begin with a dot “.”) are treated._
- `includeDot` and `excludeDot` by silverwind: [#49555 (comment)](https://github.com/microsoft/TypeScript/issues/49555#issuecomment-1721976975)

## 📃 Motivating Example

<!--
  If you were announcing this feature in a blog post, what's a short explanation that shows
  a developer why this feature improves the language?
-->
Proposal for wildcard documentation:

> `include` and `exclude` support wildcard characters to make glob patterns:
>
> - `*` matches zero or more characters (excluding directory separators _and hidden file if `hidden` is set to false_)
> - `?` matches any one character (excluding directory separators)
> - `**/` matches any directory nested to any level _(excluding hidden directory if `hidden` is set to false)_

## 💻 Use Cases

<!--
  What do you want to use this for?
  What shortcomings exist with current approaches?
  What workarounds are you using in the meantime?
-->

I want to scan all files in my project, even hidden files and files in a hidden directory. I use this TSConfig (⚠️ which doesn't list files in two hidden directories, e.g. `.foo/.bar/baz.ts`):

```JSON
{
    "include": [
        "**/*",
        "**/.*",
        "**/.*/**/*",
        "**/.*/**/.*"
    ]
}
```

## 🔗 Related Issues

- https://github.com/microsoft/TypeScript/issues/36922