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);

0 commit comments

Comments
 (0)