@cpp-linter/clang-format
clang-format 23.1.5 as a static binary, for Linux, macOS and Windows on x64 and arm64.
npm install --save-dev @cpp-linter/clang-format@23
npx clang-format -i src/*.cpp
# check only, for CI
npx clang-format --dry-run --Werror src/*.cpp
The npm version is the LLVM version. clang-format output changes between LLVM major versions, so pin one: @cpp-linter/clang-format@23 always installs the newest LLVM 23 release. Older LLVM majors are under the Versions tab, such as @cpp-linter/clang-format@18.
How it is installed
This package has one optional dependency per platform, such as @cpp-linter/clang-format-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 clangFormat = require('@cpp-linter/clang-format');
clangFormat.binaryPath(); // absolute path of the clang-format binary
clangFormat.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