@freckle/tsconfig

中文文档
1.3.4发布于 2026/10/26MIT零依赖近 30 天下载 2312

Shared TypeScript compiler options for Freckle repositories

原始使用文档
文档目录6 节
  1. Where the base came from
  2. Why removeComments is Action-only
  3. Use
  4. What stays in your repo, and why it has to
  5. Overriding a flag
  6. Changing the base

@freckle/tsconfig

Shared TypeScript compiler options for Freckle repositories. Three files: a base both archetypes agree on, and one small overlay each.

FileUse inAdds
base.jsonnothing directlythe 13 shared flags
action.jsontypescript-github-action reposremoveComments
library.jsonjs-library reposdeclaration

Where the base came from

It is not a new opinion. It is the intersection of two clusters that converged on the same flags independently: all ten typescript-github-action repos are unanimous on these thirteen, and five js-library repos carry them byte-identically. Adopting the base changes nothing for either group.

Why removeComments is Action-only

It strips comments from .d.ts output, not just from .js. On a library that deletes every JSDoc block from the published types, so a consumer loses hover text, parameter hints and property documentation. Measured on a probe with declaration: true:

// without removeComments                  // with removeComments
/**                                        export declare function add(
 * Adds two numbers.                         a: number,
 * @param a the first number                 b: number
 * @returns the sum                        ): number;
 */                                        export type Point = {
export declare function add(                   x: number;
  a: number,                                   y: number;
  b: number                                };
): number;
export type Point = {
    /** horizontal offset */
    x: number;
};

Actions are unaffected: they do not set declaration, so there is no .d.ts, and the ncc bundle that ships is read by machines. The fleet already splits this way — removeComments is set in ten repos, all of them Actions and none of them libraries.

Do not hoist it into base.json.

Use

pnpm add -D @freckle/tsconfig
{
  "extends": "@freckle/tsconfig/action.json",
  "compilerOptions": {
    "rootDir": "./src",
    "outDir": "./lib",
    "types": ["node", "vitest/globals"]
  },
  "include": ["./src/**/*"]
}

What stays in your repo, and why it has to

Compiler flags only live here. extends resolves a relative path against the file that declares it, so a path written in this package would resolve inside node_modules/@freckle/tsconfig/, not in your repo. These keys must stay local:

  • rootDir, outDir, declarationDir, tsBuildInfoFile
  • include, exclude, files
  • baseUrl, paths, typeRoots

types is a list of package names rather than paths, so it would technically inherit — it stays local anyway because it says what a repo's tests and runtime pull in (node, vitest/globals, jquery), which is not a shared decision.

Overriding a flag

Set it in your own compilerOptions; the local value wins. Record why in the file, the way parser-js does for needing DOM in lib:

{
  "extends": "@freckle/tsconfig/library.json",
  "compilerOptions": {
    // Consumed in browser contexts, so DOM types are needed. Additive, not a
    // weakening of the shared set.
    "lib": ["ES2023", "DOM"]
  }
}

Note lib and types replace rather than merge, so an override has to restate the shared value alongside the addition.

Changing the base

Edit base.json here. Every consumer picks it up on its next dependency bump. A change to the base changes what the fleet type-checks, so it is a real decision rather than a formatting fix — say what breaks and what it catches.

版本与发布记录

@freckle/tsconfig 共发布 8 个版本,首次发布于 2026/09/22;过去 12 个月发布了 8 个版本。

版本发布日期距今
1.3.4latest2026/10/2621 天前
1.3.32026/10/1828 天前
1.3.22026/10/111 个月前
1.3.12026/10/041 个月前
1.3.02026/10/031 个月前
1.2.02026/09/291 个月前

关于 @freckle/tsconfig 的常见问题

@freckle/tsconfig 是什么?

Shared TypeScript compiler options for Freckle repositories

如何安装 @freckle/tsconfig?

在项目目录运行 npm install @freckle/tsconfig,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:typescript(>= 6.0.3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@freckle/tsconfig 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/freckle__tsconfig 是否存在。

@freckle/tsconfig 可以商用吗?

@freckle/tsconfig 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@freckle/tsconfig 的下载量有多少?

根据 npm 官方下载统计,@freckle/tsconfig 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,312 次,日均约 77 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@freckle/tsconfig 还在维护吗?

最新版本 1.3.4 发布于 2026/10/26(21 天前);至今共发布 8 个版本,其中过去 12 个月发布了 8 个;首次发布于 2026/09/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。