File tree 1 file changed +49
-37
lines changed
@commitlint/config-nx-scopes
1 file changed +49
-37
lines changed Original file line number Diff line number Diff line change @@ -21,52 +21,64 @@ As an example, the following code demonstrates how to select only applications t
21
21
In your .commitlintrc.js file:
22
22
23
23
``` javascript
24
- const {
25
- utils: {getProjects },
26
- } = require (' @commitlint/config-nx-scopes' );
27
-
28
- module .exports = {
29
- rules: {
30
- ' scope-enum' : async (ctx ) => [
31
- 2 ,
32
- ' always' ,
33
- [
34
- ... (await getProjects (
35
- ctx,
36
- ({name, projectType}) =>
37
- ! name .includes (' e2e' ) && projectType == ' application'
38
- )),
24
+ async function getConfig () {
25
+ const {
26
+ default: {
27
+ utils: {getProjects },
28
+ },
29
+ } = await import (' @commitlint/config-nx-scopes' );
30
+
31
+ return {
32
+ rules: {
33
+ ' scope-enum' : async (ctx ) => [
34
+ 2 ,
35
+ ' always' ,
36
+ [
37
+ ... (await getProjects (
38
+ ctx,
39
+ ({name, projectType}) =>
40
+ ! name .includes (' e2e' ) && projectType == ' application'
41
+ )),
42
+ ],
39
43
],
40
- ],
41
- },
42
- // . . .
43
- };
44
+ },
45
+ // . . .
46
+ };
47
+ }
48
+
49
+ module .exports = getConfig ();
44
50
```
45
51
46
52
Here is another example where projects tagged with 'stage: end-of-life ' are not allowed to be used as the scope for a commit.
47
53
48
54
In your .commitlintrc.js file:
49
55
50
56
``` javascript
51
- const {
52
- utils: {getProjects },
53
- } = require (' @commitlint/config-nx-scopes' );
54
-
55
- module .exports = {
56
- rules: {
57
- ' scope-enum' : async (ctx ) => [
58
- 2 ,
59
- ' always' ,
60
- [
61
- ... (await getProjects (
62
- ctx,
63
- ({tags}) => ! tags .includes (' stage:end-of-life' )
64
- )),
57
+ async function getConfig () {
58
+ const {
59
+ default: {
60
+ utils: {getProjects },
61
+ },
62
+ } = await import (' @commitlint/config-nx-scopes' );
63
+
64
+ return {
65
+ rules: {
66
+ ' scope-enum' : async (ctx ) => [
67
+ 2 ,
68
+ ' always' ,
69
+ [
70
+ ... (await getProjects (
71
+ ctx,
72
+ ({tags}) => ! tags .includes (' stage:end-of-life' )
73
+ )),
74
+ ],
65
75
],
66
- ],
67
- },
68
- // . . .
69
- };
76
+ },
77
+ // . . .
78
+ };
79
+ }
80
+
81
+ module .exports = getConfig ();
70
82
```
71
83
72
84
## Examples
You can’t perform that action at this time.
0 commit comments