@cpp-linter/clang-tidy

中文文档
23.1.5发布于 2026/11/08MITTypeScriptCommonJS零依赖构建来源已验证近 30 天下载 3567

clang-tidy, the C/C++ linter from LLVM, as a static binary with its builtin headers (LLVM 23.1.5).

原始使用文档
文档目录3 节
  1. How it is installed
  2. From Node.js
  3. Where the binaries come from

@cpp-linter/clang-tidy

part of cpp-linter

clang-tidy 23.1.5 as a static binary, for Linux, macOS and Windows on x64 and arm64. It comes with clang's builtin headers (stddef.h, stdarg.h and the others), so it works without an LLVM install.

npm install --save-dev @cpp-linter/clang-tidy@23
# with build/compile_commands.json
npx clang-tidy -p build src/main.cpp
# without a compilation database
npx clang-tidy src/main.cpp -- -std=c++17

The npm version is the LLVM version: @cpp-linter/clang-tidy@23 always installs the newest LLVM 23 release. Older LLVM majors are under the Versions tab, such as @cpp-linter/clang-tidy@18.

clang-tidy also needs the headers of your C++ standard library (libstdc++, libc++ or the Windows SDK), which come with your compiler. For lint checks in pull requests, see cpp-linter.

How it is installed

This package has one optional dependency per platform, such as @cpp-linter/clang-tidy-linux-x64, and npm installs only the one for your machine. Nothing is downloaded or run at install time, so it works with --ignore-scripts, pnpm, Yarn, offline caches and private registry mirrors.

From Node.js

const clangTidy = require('@cpp-linter/clang-tidy');

clangTidy.binaryPath(); // absolute path of the clang-tidy binary
clangTidy.run(['--version']); // runs it and returns the exit code

Where the binaries come from

They are built from the LLVM source by cpp-linter/clang-tools-static-binaries, with a GitHub build attestation for every file. Before publishing, the release workflow checks each binary's sha512 and attestation, and the packages are published from GitHub Actions with npm provenance.

Website · Source · Issues · Discussions

版本与发布记录

@cpp-linter/clang-tidy 共发布 23 个版本,首次发布于 2026/10/23;过去 12 个月发布了 23 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
23.1.5latest2026/11/083 天前
13.0.12026/11/029 天前
14.0.62026/11/029 天前
15.0.72026/11/029 天前
16.0.62026/11/029 天前
19.1.72026/11/029 天前

其他发布通道:llvm-22 → 22.1.8,llvm-17 → 17.0.6,llvm-12 → 12.0.1,llvm-21 → 21.1.8,llvm-20 → 20.1.8,llvm-18 → 18.1.8。

关于 @cpp-linter/clang-tidy 的常见问题

@cpp-linter/clang-tidy 是什么?

clang-tidy, the C/C++ linter from LLVM, as a static binary with its builtin headers (LLVM 23.1.5).

如何安装 @cpp-linter/clang-tidy?

在项目目录运行 npm install @cpp-linter/clang-tidy,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 clang-tidy,可以用 npx clang-tidy 直接运行。

@cpp-linter/clang-tidy 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cpp-linter/clang-tidy 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@cpp-linter/clang-tidy 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cpp-linter/clang-tidy 可以商用吗?

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

@cpp-linter/clang-tidy 的下载量有多少?

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

@cpp-linter/clang-tidy 还在维护吗?

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