@cpp-linter/clang-tidy
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