Microsoft/TypeScript

How tsconfig exclude pattern should actually work

Open

#12,824 创建于 2016年12月10日

在 GitHub 查看
 (5 评论) (7 反应) (0 负责人)TypeScript (6,726 fork)batch import
Help WantedSuggestion

仓库指标

Star
 (48,455 star)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 9 个 PR)

描述

TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx)

Say we have a following structure to specially to test exclude pattern:

/node_modules
  /module/some.ts
nested/
  /node_modules
    /module/some.ts
  /deep-nested/
    /node_modules
      /module/some.ts

Will check this using tsc --listFiles

How exclude patterns work:

  1. "node_modules" - will exclude only /node_modules/module/some.ts
  2. "*/node_modules" (the same effect as /node_modules/") - will exclude only /nested/node_modules/module/some.ts
  3. "**/node_modules" - will exclude nothing
  4. "**/node_modules/*" - will exclude everything (also nested, deep-nested)

Some behaviour seem strange to me

  • why in case 3 it excludes nothing (considering case 2 works)?
  • by default (if exclude not specified) case 1 will be effective, shouldn't it be 4) which excludes node_modules in nested folders as well?

贡献者指南