
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
@commitlint/config-nx-scopes
Advanced tools
Shareable commitlint config enforcing nx project names as scopes
Lint your nx project commits
Shareable commitlint config enforcing nx project and workspace names as scopes.
Use with @commitlint/cli and @commitlint/prompt-cli.
npm install --save-dev @commitlint/config-nx-scopes @commitlint/cli
echo "module.exports = {extends: ['@commitlint/config-nx-scopes']};" > commitlint.config.js
You can filter projects by providing a filter function as the second parameter to getProjects(). The function will be called with an object containing each projects' name, projectType, and tags. Simply return a boolean to indicate whether the project should be included or not.
As an example, the following code demonstrates how to select only applications that are not end-to-end tests.
In your .commitlintrc.js file:
async function getConfig() {
const {
default: {
utils: { getProjects },
},
} = await import("@commitlint/config-nx-scopes");
return {
rules: {
"scope-enum": async (ctx) => [
2,
"always",
[
...(await getProjects(
ctx,
({ name, projectType }) =>
!name.includes("e2e") && projectType == "application",
)),
],
],
},
// . . .
};
}
module.exports = getConfig();
Here is another example where projects tagged with 'stage:end-of-life' are not allowed to be used as the scope for a commit.
In your .commitlintrc.js file:
async function getConfig() {
const {
default: {
utils: { getProjects },
},
} = await import("@commitlint/config-nx-scopes");
return {
rules: {
"scope-enum": async (ctx) => [
2,
"always",
[
...(await getProjects(
ctx,
({ tags }) => !tags.includes("stage:end-of-life"),
)),
],
],
},
// . . .
};
}
module.exports = getConfig();
❯ cat commitlint.config.js
{
extends: ['@commitlint/config-nx-scopes']
}
❯ tree packages
packages
├── api
├── app
└── web
❯ echo "build(api): change something in api's build" | commitlint
â§— input: build(api): change something in api's build
âś” found 0 problems, 0 warnings
❯ echo "test(foo): this won't pass" | commitlint
â§— input: test(foo): this won't pass
âś– scope must be one of [api, app, web] [scope-enum]
âś– found 1 problems, 0 warnings
❯ echo "ci: do some general maintenance" | commitlint
â§— input: ci: do some general maintenance
âś” found 0 problems, 0 warnings
Consult Rules reference for a list of available rules.
FAQs
Shareable commitlint config enforcing nx project names as scopes
The npm package @commitlint/config-nx-scopes receives a total of 37,683 weekly downloads. As such, @commitlint/config-nx-scopes popularity was classified as popular.
We found that @commitlint/config-nx-scopes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.