Skip to content

Commit b0eea7f

Browse files
asyncLizcopybara-github
authored andcommitted
chore: add commitlint config for scopes
PiperOrigin-RevId: 591061701
1 parent 4095c06 commit b0eea7f

File tree

3 files changed

+51
-3
lines changed

3 files changed

+51
-3
lines changed

.github/workflows/commitlint.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10+
- uses: actions/checkout@v3
1011
- uses: actions/setup-node@v3
1112
with:
1213
node-version: 18
14+
cache: npm
1315

14-
- run: npm install -g commitlint @commitlint/config-conventional
15-
- run: 'echo "${PR_TITLE}" | commitlint -x @commitlint/config-conventional'
16+
- run: npm install -g @commitlint/cli @commitlint/config-conventional
17+
- run: 'echo "${PR_TITLE}" | commitlint'
1618
env:
1719
PR_TITLE: ${{ github.event.pull_request.title }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node_modules
22
*.js
33
!web-test-runner.config.js
44
!css-to-ts.js
5+
!commitlint.config.js
56
*.css
67
*.css.ts
78
*.map
@@ -25,4 +26,4 @@ catalog/site/about/images
2526
catalog/*.tsbuildinfo
2627
catalog/stories/*/
2728
!catalog/stories/components/
28-
!catalog/src/types/**/*.d.ts
29+
!catalog/src/types/**/*.d.ts

commitlint.config.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* @license
3+
* Copyright 2023 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
export default {
8+
extends: ['@commitlint/config-conventional'],
9+
rules: {
10+
'scope-enum': [
11+
2,
12+
'always',
13+
[
14+
// Use "/" for multiple scopes: `fix(button/checkbox): subject"`
15+
// Omit scope for broad "all" changes.
16+
'button',
17+
'catalog',
18+
'checkbox',
19+
'chips',
20+
'color',
21+
'dialog',
22+
'divider',
23+
'elevation',
24+
'fab',
25+
'field',
26+
'focus',
27+
'icon',
28+
'iconbutton',
29+
'labs',
30+
'list',
31+
'menu',
32+
'progress',
33+
'radio',
34+
'ripple',
35+
'select',
36+
'slider',
37+
'switch',
38+
'tabs',
39+
'textfield',
40+
'tokens',
41+
'typography',
42+
],
43+
],
44+
},
45+
};

0 commit comments

Comments
 (0)