diff --git a/@commitlint/config-nx-scopes/readme.md b/@commitlint/config-nx-scopes/readme.md index 489b09c9ff..67b9fd1ce4 100644 --- a/@commitlint/config-nx-scopes/readme.md +++ b/@commitlint/config-nx-scopes/readme.md @@ -12,9 +12,11 @@ npm install --save-dev @commitlint/config-nx-scopes @commitlint/cli echo "module.exports = {extends: ['@commitlint/config-nx-scopes']};" > commitlint.config.js ``` -## Filtering projects by type +## Filtering projects -You can filter projects by type by specifying the project type parameter. +You can filter projects by defining a filter function as the second parameter to the getProjects function. The function will be called with the each projects' `name`, `type`, and `tags`. You can 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: @@ -28,9 +30,15 @@ module.exports = { 'scope-enum': async (ctx) => [ 2, 'always', - [...(await getProjects(ctx, 'application'))], // ⬅ or 'library' + [ + ...(await getProjects( + ctx, + ({name, type}) => !name.includes('e2e') && type == 'application' + )), + ], ], }, + // . . . }; ```