Skip to content

Commit 3318877

Browse files
authored
build: add lint rule for unused Sass imports (#22454)
Since all the imports are namespaced now, it's trivial to figure out whether they're being used. These changes add a custom lint rule and fix all of the failures.
1 parent 55a2a6c commit 3318877

File tree

67 files changed

+93
-85
lines changed

Some content is hidden

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

67 files changed

+93
-85
lines changed

.stylelintrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"./tools/stylelint/no-top-level-ampersand-in-mixin.ts",
1111
"./tools/stylelint/theme-mixin-api.ts",
1212
"./tools/stylelint/no-import.ts",
13-
"./tools/stylelint/single-line-comment-only.ts"
13+
"./tools/stylelint/single-line-comment-only.ts",
14+
"./tools/stylelint/no-unused-import.ts"
1415
],
1516
"rules": {
1617
"material/no-prefixes": [true, {
@@ -20,6 +21,7 @@
2021
"material/theme-mixin-api": true,
2122
"material/selector-no-deep": true,
2223
"material/no-nested-mixin": true,
24+
"material/no-unused-import": true,
2325
"material/single-line-comment-only": [true, {
2426
"filePattern": "\\.scss$"
2527
}],

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use 'sass:map';
22
@use '../../material/core/style/variables';
33
@use '../../material/core/style/vendor-prefixes';
4-
@use '../../material/core/theming/palette';
54
@use '../../material/core/theming/theming';
65

76
@mixin color($config-or-theme) {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use '@material/menu-surface/mixins' as mdc-menu-surface;
22
@use '@material/list/mixins' as mdc-list;
33
@use '../../cdk/a11y';
4-
@use '../mdc-helpers/mdc-helpers';
54

65
@include mdc-menu-surface.core-styles($query: structure);
76

src/material-experimental/mdc-checkbox/checkbox.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@use '@material/checkbox' as mdc-checkbox;
2-
@use '@material/checkbox/checkbox-theme' as mdc-checkbox-theme;
32
@use '@material/form-field' as mdc-form-field;
43
@use '@material/ripple' as mdc-ripple;
54
@use 'sass:map';

src/material-experimental/mdc-form-field/_form-field-native-select.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use 'sass:map';
22
@use '../mdc-helpers/mdc-helpers';
3-
@use '../../material/core/theming/theming';
43
@use '../../cdk/a11y';
54
@use '../../material/core/theming/palette';
65
@use '@material/theme/theme-color' as mdc-theme-color;

src/material-experimental/mdc-form-field/_form-field-theme.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@use '@material/ripple/mixins' as mdc-ripple;
21
@use '@material/textfield' as mdc-textfield;
32
@use '@material/floating-label' as mdc-floating-label;
43
@use '@material/notched-outline' as mdc-notched-outline;

src/material-experimental/mdc-form-field/_mdc-text-field-textarea-overrides.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@use 'form-field-sizing';
2-
31
// MDCs default textarea styles cannot be used because they only apply if a special
42
// class is applied to the "mdc-text-field" wrapper. Since we cannot know whether the
53
// registered form-field control is a textarea and MDC by default does not have styles

src/material-experimental/mdc-helpers/_focus-indicators.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use 'sass:map';
22
@use '../../material/core/style/layout-common';
3-
@use '../../material/core/focus-indicators/focus-indicators';
43

54
/// Mixin that turns on strong focus indicators.
65
///

src/material-experimental/mdc-helpers/_mdc-helpers.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
@use '@material/feature-targeting' as mdc-feature-targeting;
66
@use '@material/typography' as mdc-typography;
7-
@use '@material/theme/functions' as mdc-theme-functions;
87
@use '@material/theme/theme-color' as mdc-theme-color;
98
@use 'sass:map';
10-
@use '../../material/core/style/layout-common';
119
@use '../../material/core/theming/theming';
1210
@use '../../material/core/typography/typography';
1311
@use '../../material/core/typography/typography-utils';

src/material-experimental/mdc-list/_interactive-list-theme.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use '@material/ripple' as mdc-ripple;
22
@use 'sass:map';
3-
@use '../mdc-helpers/mdc-helpers';
43
@use '../../material/core/theming/theming';
54

65
// Mixin that provides colors for the various states of an interactive list-item. MDC

0 commit comments

Comments
 (0)