Skip to content

build: don't flag noop mixins in theme mixin rule #19558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
build: don't flag noop mixins in theme mixin rule
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.
  • Loading branch information
crisbeto committed Jun 7, 2020
commit 772a10d74f45821635c98b6ee118c91f94157943
8 changes: 2 additions & 6 deletions src/material-experimental/column-resize/_column-resize.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,9 @@
}
}

@mixin mat-column-resize-typography($config-or-theme) {
$config: mat-get-typography-config($config-or-theme);
}
@mixin mat-column-resize-typography($config-or-theme) {}

@mixin mat-column-resize-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin mat-column-resize-density($config-or-theme) {}

@mixin mat-column-resize-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
@import '../mdc-helpers/mdc-helpers';

@mixin mat-mdc-autocomplete-color($config-or-theme) {
$config: mat-get-color-config($config-or-theme);
@include mat-using-mdc-theme($config) {
// TODO: implement MDC-based autocomplete.
}
}
@mixin mat-mdc-autocomplete-color($config-or-theme) {}

@mixin mat-mdc-autocomplete-typography($config-or-theme) {
$config: mat-get-typography-config($config-or-theme);
@include mat-using-mdc-typography($config) {
// TODO: implement MDC-based autocomplete.
}
}
@mixin mat-mdc-autocomplete-typography($config-or-theme) {}

@mixin mat-mdc-autocomplete-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin mat-mdc-autocomplete-density($config-or-theme) {}

@mixin mat-mdc-autocomplete-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material-experimental/mdc-button/_button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,7 @@ $mat-button-state-target: '.mdc-button__ripple';
}
}

@mixin mat-mdc-fab-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin mat-mdc-fab-density($config-or-theme) {}

@mixin mat-mdc-fab-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material-experimental/mdc-card/_card-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@
}
}

@mixin mat-mdc-card-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin mat-mdc-card-density($config-or-theme) {}

@mixin mat-mdc-card-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material-experimental/mdc-input/_input-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
@include mat-using-mdc-typography($config) {}
}

@mixin mat-mdc-input-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin mat-mdc-input-density($config-or-theme) {}

@mixin mat-mdc-input-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material-experimental/mdc-menu/_menu-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@
}
}

@mixin mat-mdc-menu-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin mat-mdc-menu-density($config-or-theme) {}

@mixin mat-mdc-menu-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,9 @@
}
}

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

@mixin mat-mdc-progress-bar-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin mat-mdc-progress-bar-density($config-or-theme) {}

@mixin mat-mdc-progress-bar-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
14 changes: 2 additions & 12 deletions src/material-experimental/mdc-sidenav/_sidenav-theme.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
@import '../mdc-helpers/mdc-helpers';

@mixin mat-mdc-sidenav-color($config-or-theme) {
$config: mat-get-color-config($config-or-theme);
@include mat-using-mdc-theme($config) {
// TODO: implement MDC-based sidenav.
}
}
@mixin mat-mdc-sidenav-color($config-or-theme) {}

@mixin mat-mdc-sidenav-typography($config-or-theme) {
$config: mat-get-typography-config($config-or-theme);
@include mat-using-mdc-typography($config) {
// TODO: implement MDC-based sidenav.
}
}
@mixin mat-mdc-sidenav-typography($config-or-theme) {}

@mixin mat-mdc-sidenav-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
Expand Down
4 changes: 1 addition & 3 deletions src/material-experimental/mdc-slider/_slider-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
}
}

@mixin mat-mdc-slider-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin mat-mdc-slider-density($config-or-theme) {}

@mixin mat-mdc-slider-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
12 changes: 3 additions & 9 deletions src/material-experimental/mdc-snackbar/_snackbar-theme.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
@import '../mdc-helpers/mdc-helpers';

@mixin mat-mdc-snackbar-color($config-or-theme) {
$config: mat-get-color-config($config-or-theme);
}
@mixin mat-mdc-snackbar-color($config-or-theme) {}

@mixin mat-mdc-snackbar-typography($config-or-theme) {
$config: mat-get-typography-config($config-or-theme);
}
@mixin mat-mdc-snackbar-typography($config-or-theme) {}

@mixin mat-mdc-snackbar-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin mat-mdc-snackbar-density($config-or-theme) {}

@mixin mat-mdc-snackbar-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material-experimental/popover-edit/_popover-edit.scss
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@
}


@mixin mat-popover-edit-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin mat-popover-edit-density($config-or-theme) {}

@mixin mat-popover-edit-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
8 changes: 2 additions & 6 deletions src/material/autocomplete/_autocomplete-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,9 @@
}
}

@mixin mat-autocomplete-typography($config-or-theme) {
$config: mat-get-typography-config($config-or-theme);
}
@mixin mat-autocomplete-typography($config-or-theme) {}

@mixin _mat-autocomplete-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-autocomplete-density($config-or-theme) {}

@mixin mat-autocomplete-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
5 changes: 1 addition & 4 deletions src/material/badge/_badge-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,7 @@ $mat-badge-large-size: $mat-badge-default-size + 6;
}
}

@mixin _mat-badge-density($config-or-theme) {

$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-badge-density($config-or-theme) {}

@mixin mat-badge-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/bottom-sheet/_bottom-sheet-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
}
}

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

@mixin mat-bottom-sheet-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/button/_button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ $_mat-button-ripple-opacity: 0.1;
}
}

@mixin _mat-button-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-button-density($config-or-theme) {}

@mixin mat-button-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/card/_card-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
}
}

@mixin _mat-card-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-card-density($config-or-theme) {}

@mixin mat-card-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/checkbox/_checkbox-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@
}
}

@mixin _mat-checkbox-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-checkbox-density($config-or-theme) {}

@mixin mat-checkbox-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/chips/_chips-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ $mat-chip-remove-font-size: 18px;
}
}

@mixin _mat-chips-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-chips-density($config-or-theme) {}

@mixin mat-chips-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/core/option/_optgroup-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
}
}

@mixin _mat-optgroup-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-optgroup-density($config-or-theme) {}

@mixin mat-optgroup-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/core/option/_option-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
}
}

@mixin _mat-option-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-option-density($config-or-theme) {}

@mixin mat-option-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,9 @@
}
}

@mixin mat-pseudo-checkbox-typography($config-or-theme) {
$config: mat-get-typography-config($config-or-theme);
}
@mixin _mat-pseudo-checkbox-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin mat-pseudo-checkbox-typography($config-or-theme) {}

@mixin _mat-pseudo-checkbox-density($config-or-theme) {}

@mixin mat-pseudo-checkbox-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/datepicker/_datepicker-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,7 @@ $mat-calendar-weekday-table-font-size: 11px !default;
}
}

@mixin _mat-datepicker-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-datepicker-density($config-or-theme) {}

@mixin mat-datepicker-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/dialog/_dialog-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
}
}

@mixin _mat-dialog-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-dialog-density($config-or-theme) {}

@mixin mat-dialog-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
8 changes: 2 additions & 6 deletions src/material/divider/_divider-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@
}
}

@mixin mat-divider-typography($config-or-theme) {
$config: mat-get-typography-config($config-or-theme);
}
@mixin mat-divider-typography($config-or-theme) {}

@mixin _mat-divider-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-divider-density($config-or-theme) {}

@mixin mat-divider-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/form-field/_form-field-fill-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ $mat-form-field-fill-dedupe: 0;
}
}

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

@mixin mat-form-field-fill-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/form-field/_form-field-legacy-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ $mat-form-field-legacy-dedupe: 0;
}
}

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

@mixin mat-form-field-legacy-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
4 changes: 1 addition & 3 deletions src/material/form-field/_form-field-outline-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ $mat-form-field-outline-dedupe: 0;
}
}

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

@mixin mat-form-field-outline-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
8 changes: 2 additions & 6 deletions src/material/form-field/_form-field-standard-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@
}
}

@mixin mat-form-field-standard-typography($config-or-theme) {
$config: mat-get-typography-config($config-or-theme);
}
@mixin mat-form-field-standard-typography($config-or-theme) {}

@mixin _mat-form-field-standard-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-form-field-standard-density($config-or-theme) {}

@mixin mat-form-field-standard-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
8 changes: 2 additions & 6 deletions src/material/grid-list/_grid-list-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@


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

@mixin mat-grid-list-typography($config-or-theme) {
$config: mat-get-typography-config($config-or-theme);
Expand All @@ -19,9 +17,7 @@
}
}

@mixin _mat-grid-list-density($config-or-theme) {
$density-scale: mat-get-density-config($config-or-theme);
}
@mixin _mat-grid-list-density($config-or-theme) {}

@mixin mat-grid-list-theme($theme-or-color-config) {
$theme: _mat-legacy-get-theme($theme-or-color-config);
Expand Down
Loading