docs/guides/getting-started.md
Install @commitlint/cli and a @commitlint/config-* / commitlint-config-* of your choice as devDependency and configure commitlint to use it.
::: code-group
npm install -D @commitlint/cli @commitlint/config-conventional
yarn add -D @commitlint/cli @commitlint/config-conventional
pnpm add -D @commitlint/cli @commitlint/config-conventional
bun add -d @commitlint/cli @commitlint/config-conventional
deno add -D npm:@commitlint/cli npm:@commitlint/config-conventional
:::
Configure commitlint to use conventional config
::: code-group
echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
# Here we use the node command to avoid encoding issue on Windows.
node -e "fs.writeFileSync('commitlint.config.js', process.argv[1])" "export default { extends: ['@commitlint/config-conventional'] };"
:::
[!WARNING] Node v24 changes the way that modules are loaded, and this includes the commitlint config file. If your project does not contain a
package.json, commitlint may fail to load the config, resulting in aPlease add rules to your commitlint.config.jserror message. This can be fixed by doing either of the following:
- Add a
package.jsonfile, declaring your project as an ES6 module. This can be done easily by runningnpm init es6.- Rename the config file from
commitlint.config.jstocommitlint.config.mjs.
Refer to configuration documentation for more information.