Skip to content

Commit 227e568

Browse files
authored
build: don't flag noop mixins in theme mixin rule (#19558)
The `theme-mixin-api` rule flags any mixin that doesn't include a variable that extracts the config. This can be annoying for noop placeholder mixins since we have to declare a variable that won't be used. These changes add an exception for mixins that are empty or only contain comment nodes.
1 parent 100cdd2 commit 227e568

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+81
-205
lines changed

src/material-experimental/column-resize/_column-resize.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,9 @@
9797
}
9898
}
9999

100-
@mixin mat-column-resize-typography($config-or-theme) {
101-
$config: mat-get-typography-config($config-or-theme);
102-
}
100+
@mixin mat-column-resize-typography($config-or-theme) {}
103101

104-
@mixin mat-column-resize-density($config-or-theme) {
105-
$density-scale: mat-get-density-config($config-or-theme);
106-
}
102+
@mixin mat-column-resize-density($config-or-theme) {}
107103

108104
@mixin mat-column-resize-theme($theme-or-color-config) {
109105
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material-experimental/mdc-autocomplete/_autocomplete-theme.scss

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
11
@import '../mdc-helpers/mdc-helpers';
22

3-
@mixin mat-mdc-autocomplete-color($config-or-theme) {
4-
$config: mat-get-color-config($config-or-theme);
5-
@include mat-using-mdc-theme($config) {
6-
// TODO: implement MDC-based autocomplete.
7-
}
8-
}
3+
@mixin mat-mdc-autocomplete-color($config-or-theme) {}
94

10-
@mixin mat-mdc-autocomplete-typography($config-or-theme) {
11-
$config: mat-get-typography-config($config-or-theme);
12-
@include mat-using-mdc-typography($config) {
13-
// TODO: implement MDC-based autocomplete.
14-
}
15-
}
5+
@mixin mat-mdc-autocomplete-typography($config-or-theme) {}
166

17-
@mixin mat-mdc-autocomplete-density($config-or-theme) {
18-
$density-scale: mat-get-density-config($config-or-theme);
19-
}
7+
@mixin mat-mdc-autocomplete-density($config-or-theme) {}
208

219
@mixin mat-mdc-autocomplete-theme($theme-or-color-config) {
2210
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material-experimental/mdc-button/_button-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,7 @@ $mat-button-state-target: '.mdc-button__ripple';
258258
}
259259
}
260260

261-
@mixin mat-mdc-fab-density($config-or-theme) {
262-
$density-scale: mat-get-density-config($config-or-theme);
263-
}
261+
@mixin mat-mdc-fab-density($config-or-theme) {}
264262

265263
@mixin mat-mdc-fab-theme($theme-or-color-config) {
266264
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material-experimental/mdc-card/_card-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@
4848
}
4949
}
5050

51-
@mixin mat-mdc-card-density($config-or-theme) {
52-
$density-scale: mat-get-density-config($config-or-theme);
53-
}
51+
@mixin mat-mdc-card-density($config-or-theme) {}
5452

5553
@mixin mat-mdc-card-theme($theme-or-color-config) {
5654
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material-experimental/mdc-input/_input-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
@include mat-using-mdc-typography($config) {}
1111
}
1212

13-
@mixin mat-mdc-input-density($config-or-theme) {
14-
$density-scale: mat-get-density-config($config-or-theme);
15-
}
13+
@mixin mat-mdc-input-density($config-or-theme) {}
1614

1715
@mixin mat-mdc-input-theme($theme-or-color-config) {
1816
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material-experimental/mdc-menu/_menu-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@
5252
}
5353
}
5454

55-
@mixin mat-mdc-menu-density($config-or-theme) {
56-
$density-scale: mat-get-density-config($config-or-theme);
57-
}
55+
@mixin mat-mdc-menu-density($config-or-theme) {}
5856

5957
@mixin mat-mdc-menu-theme($theme-or-color-config) {
6058
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material-experimental/mdc-progress-bar/_progress-bar-theme.scss

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,9 @@
2929
}
3030
}
3131

32-
@mixin mat-mdc-progress-bar-typography($config-or-theme) {
33-
$config: mat-get-typography-config($config-or-theme)
34-
// No typography for this component.
35-
}
32+
@mixin mat-mdc-progress-bar-typography($config-or-theme) {}
3633

37-
@mixin mat-mdc-progress-bar-density($config-or-theme) {
38-
$density-scale: mat-get-density-config($config-or-theme);
39-
}
34+
@mixin mat-mdc-progress-bar-density($config-or-theme) {}
4035

4136
@mixin mat-mdc-progress-bar-theme($theme-or-color-config) {
4237
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material-experimental/mdc-sidenav/_sidenav-theme.scss

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
@import '../mdc-helpers/mdc-helpers';
22

3-
@mixin mat-mdc-sidenav-color($config-or-theme) {
4-
$config: mat-get-color-config($config-or-theme);
5-
@include mat-using-mdc-theme($config) {
6-
// TODO: implement MDC-based sidenav.
7-
}
8-
}
3+
@mixin mat-mdc-sidenav-color($config-or-theme) {}
94

10-
@mixin mat-mdc-sidenav-typography($config-or-theme) {
11-
$config: mat-get-typography-config($config-or-theme);
12-
@include mat-using-mdc-typography($config) {
13-
// TODO: implement MDC-based sidenav.
14-
}
15-
}
5+
@mixin mat-mdc-sidenav-typography($config-or-theme) {}
166

177
@mixin mat-mdc-sidenav-density($config-or-theme) {
188
$density-scale: mat-get-density-config($config-or-theme);

src/material-experimental/mdc-slider/_slider-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
}
2626
}
2727

28-
@mixin mat-mdc-slider-density($config-or-theme) {
29-
$density-scale: mat-get-density-config($config-or-theme);
30-
}
28+
@mixin mat-mdc-slider-density($config-or-theme) {}
3129

3230
@mixin mat-mdc-slider-theme($theme-or-color-config) {
3331
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material-experimental/mdc-snackbar/_snackbar-theme.scss

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
@import '../mdc-helpers/mdc-helpers';
22

3-
@mixin mat-mdc-snackbar-color($config-or-theme) {
4-
$config: mat-get-color-config($config-or-theme);
5-
}
3+
@mixin mat-mdc-snackbar-color($config-or-theme) {}
64

7-
@mixin mat-mdc-snackbar-typography($config-or-theme) {
8-
$config: mat-get-typography-config($config-or-theme);
9-
}
5+
@mixin mat-mdc-snackbar-typography($config-or-theme) {}
106

11-
@mixin mat-mdc-snackbar-density($config-or-theme) {
12-
$density-scale: mat-get-density-config($config-or-theme);
13-
}
7+
@mixin mat-mdc-snackbar-density($config-or-theme) {}
148

159
@mixin mat-mdc-snackbar-theme($theme-or-color-config) {
1610
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material-experimental/popover-edit/_popover-edit.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@
150150
}
151151

152152

153-
@mixin mat-popover-edit-density($config-or-theme) {
154-
$density-scale: mat-get-density-config($config-or-theme);
155-
}
153+
@mixin mat-popover-edit-density($config-or-theme) {}
156154

157155
@mixin mat-popover-edit-theme($theme-or-color-config) {
158156
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/autocomplete/_autocomplete-theme.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,9 @@
2727
}
2828
}
2929

30-
@mixin mat-autocomplete-typography($config-or-theme) {
31-
$config: mat-get-typography-config($config-or-theme);
32-
}
30+
@mixin mat-autocomplete-typography($config-or-theme) {}
3331

34-
@mixin _mat-autocomplete-density($config-or-theme) {
35-
$density-scale: mat-get-density-config($config-or-theme);
36-
}
32+
@mixin _mat-autocomplete-density($config-or-theme) {}
3733

3834
@mixin mat-autocomplete-theme($theme-or-color-config) {
3935
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/badge/_badge-theme.scss

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,7 @@ $mat-badge-large-size: $mat-badge-default-size + 6;
206206
}
207207
}
208208

209-
@mixin _mat-badge-density($config-or-theme) {
210-
211-
$density-scale: mat-get-density-config($config-or-theme);
212-
}
209+
@mixin _mat-badge-density($config-or-theme) {}
213210

214211
@mixin mat-badge-theme($theme-or-color-config) {
215212
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/bottom-sheet/_bottom-sheet-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
}
2424
}
2525

26-
@mixin _mat-bottom-sheet-density($config-or-theme) {
27-
$density-scale: mat-get-density-config($config-or-theme);
28-
}
26+
@mixin _mat-bottom-sheet-density($config-or-theme) {}
2927

3028
@mixin mat-bottom-sheet-theme($theme-or-color-config) {
3129
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/button/_button-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,7 @@ $_mat-button-ripple-opacity: 0.1;
173173
}
174174
}
175175

176-
@mixin _mat-button-density($config-or-theme) {
177-
$density-scale: mat-get-density-config($config-or-theme);
178-
}
176+
@mixin _mat-button-density($config-or-theme) {}
179177

180178
@mixin mat-button-theme($theme-or-color-config) {
181179
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/card/_card-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@
4949
}
5050
}
5151

52-
@mixin _mat-card-density($config-or-theme) {
53-
$density-scale: mat-get-density-config($config-or-theme);
54-
}
52+
@mixin _mat-card-density($config-or-theme) {}
5553

5654
@mixin mat-card-theme($theme-or-color-config) {
5755
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/checkbox/_checkbox-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@
108108
}
109109
}
110110

111-
@mixin _mat-checkbox-density($config-or-theme) {
112-
$density-scale: mat-get-density-config($config-or-theme);
113-
}
111+
@mixin _mat-checkbox-density($config-or-theme) {}
114112

115113
@mixin mat-checkbox-theme($theme-or-color-config) {
116114
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/chips/_chips-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ $mat-chip-remove-font-size: 18px;
100100
}
101101
}
102102

103-
@mixin _mat-chips-density($config-or-theme) {
104-
$density-scale: mat-get-density-config($config-or-theme);
105-
}
103+
@mixin _mat-chips-density($config-or-theme) {}
106104

107105
@mixin mat-chips-theme($theme-or-color-config) {
108106
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/core/option/_optgroup-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
}
2424
}
2525

26-
@mixin _mat-optgroup-density($config-or-theme) {
27-
$density-scale: mat-get-density-config($config-or-theme);
28-
}
26+
@mixin _mat-optgroup-density($config-or-theme) {}
2927

3028
@mixin mat-optgroup-theme($theme-or-color-config) {
3129
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/core/option/_option-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@
5757
}
5858
}
5959

60-
@mixin _mat-option-density($config-or-theme) {
61-
$density-scale: mat-get-density-config($config-or-theme);
62-
}
60+
@mixin _mat-option-density($config-or-theme) {}
6361

6462
@mixin mat-option-theme($theme-or-color-config) {
6563
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,9 @@
5959
}
6060
}
6161

62-
@mixin mat-pseudo-checkbox-typography($config-or-theme) {
63-
$config: mat-get-typography-config($config-or-theme);
64-
}
65-
@mixin _mat-pseudo-checkbox-density($config-or-theme) {
66-
$density-scale: mat-get-density-config($config-or-theme);
67-
}
62+
@mixin mat-pseudo-checkbox-typography($config-or-theme) {}
63+
64+
@mixin _mat-pseudo-checkbox-density($config-or-theme) {}
6865

6966
@mixin mat-pseudo-checkbox-theme($theme-or-color-config) {
7067
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/datepicker/_datepicker-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@ $mat-calendar-weekday-table-font-size: 11px !default;
220220
}
221221
}
222222

223-
@mixin _mat-datepicker-density($config-or-theme) {
224-
$density-scale: mat-get-density-config($config-or-theme);
225-
}
223+
@mixin _mat-datepicker-density($config-or-theme) {}
226224

227225
@mixin mat-datepicker-theme($theme-or-color-config) {
228226
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/dialog/_dialog-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
}
2525
}
2626

27-
@mixin _mat-dialog-density($config-or-theme) {
28-
$density-scale: mat-get-density-config($config-or-theme);
29-
}
27+
@mixin _mat-dialog-density($config-or-theme) {}
3028

3129
@mixin mat-dialog-theme($theme-or-color-config) {
3230
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/divider/_divider-theme.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@
1515
}
1616
}
1717

18-
@mixin mat-divider-typography($config-or-theme) {
19-
$config: mat-get-typography-config($config-or-theme);
20-
}
18+
@mixin mat-divider-typography($config-or-theme) {}
2119

22-
@mixin _mat-divider-density($config-or-theme) {
23-
$density-scale: mat-get-density-config($config-or-theme);
24-
}
20+
@mixin _mat-divider-density($config-or-theme) {}
2521

2622
@mixin mat-divider-theme($theme-or-color-config) {
2723
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/form-field/_form-field-fill-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ $mat-form-field-fill-dedupe: 0;
102102
}
103103
}
104104

105-
@mixin _mat-form-field-fill-density($config-or-theme) {
106-
$density-scale: mat-get-density-config($config-or-theme);
107-
}
105+
@mixin _mat-form-field-fill-density($config-or-theme) {}
108106

109107
@mixin mat-form-field-fill-theme($theme-or-color-config) {
110108
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/form-field/_form-field-legacy-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ $mat-form-field-legacy-dedupe: 0;
175175
}
176176
}
177177

178-
@mixin _mat-form-field-legacy-density($config-or-theme) {
179-
$density-scale: mat-get-density-config($config-or-theme);
180-
}
178+
@mixin _mat-form-field-legacy-density($config-or-theme) {}
181179

182180
@mixin mat-form-field-legacy-theme($theme-or-color-config) {
183181
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/form-field/_form-field-outline-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ $mat-form-field-outline-dedupe: 0;
132132
}
133133
}
134134

135-
@mixin _mat-form-field-outline-density($config-or-theme) {
136-
$density-scale: mat-get-density-config($config-or-theme);
137-
}
135+
@mixin _mat-form-field-outline-density($config-or-theme) {}
138136

139137
@mixin mat-form-field-outline-theme($theme-or-color-config) {
140138
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/form-field/_form-field-standard-theme.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,9 @@
2525
}
2626
}
2727

28-
@mixin mat-form-field-standard-typography($config-or-theme) {
29-
$config: mat-get-typography-config($config-or-theme);
30-
}
28+
@mixin mat-form-field-standard-typography($config-or-theme) {}
3129

32-
@mixin _mat-form-field-standard-density($config-or-theme) {
33-
$density-scale: mat-get-density-config($config-or-theme);
34-
}
30+
@mixin _mat-form-field-standard-density($config-or-theme) {}
3531

3632
@mixin mat-form-field-standard-theme($theme-or-color-config) {
3733
$theme: _mat-legacy-get-theme($theme-or-color-config);

src/material/grid-list/_grid-list-theme.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77

88
// Include this empty mixin for consistency with the other components.
9-
@mixin mat-grid-list-color($config-or-theme) {
10-
$config: mat-get-color-config($config-or-theme);
11-
}
9+
@mixin mat-grid-list-color($config-or-theme) {}
1210

1311
@mixin mat-grid-list-typography($config-or-theme) {
1412
$config: mat-get-typography-config($config-or-theme);
@@ -19,9 +17,7 @@
1917
}
2018
}
2119

22-
@mixin _mat-grid-list-density($config-or-theme) {
23-
$density-scale: mat-get-density-config($config-or-theme);
24-
}
20+
@mixin _mat-grid-list-density($config-or-theme) {}
2521

2622
@mixin mat-grid-list-theme($theme-or-color-config) {
2723
$theme: _mat-legacy-get-theme($theme-or-color-config);

0 commit comments

Comments
 (0)