Skip to content

Commit f1a3ad7

Browse files
lgriffeeaaronccasanovachloerice
authored
Enable custom-property-disallowed-list in stylelint-polaris (#8973)
### WHY are these changes introduced? Follow up to #8968 ### WHAT is this pull request doing? Adds the `custom-property-disallowed-list` plugin to the `stylelint-polaris` config to disallow a collection of Polaris v10 custom properties prior to the v11 release. --------- Co-authored-by: Aaron Casanova <[email protected]> Co-authored-by: Chloe Rice <[email protected]>
1 parent 3bc87ce commit f1a3ad7

21 files changed

+367
-102
lines changed

.changeset/khaki-walls-wash.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@shopify/stylelint-polaris': major
3+
'@shopify/polaris': minor
4+
'polaris.shopify.com': minor
5+
---
6+
7+
Enabled the `custom-property-disallowed-list` rule and added deprecated v10 custom properties.

polaris-react/src/components/AlphaFilters/AlphaFilters.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163

164164
.AddFilterActivatorMultiple {
165165
position: sticky;
166-
z-index: var(--p-z-1);
166+
z-index: var(--p-z-index-1);
167167
top: 0;
168168
right: 0;
169169
display: flex;
@@ -227,7 +227,7 @@
227227
.MultiplePinnedFilterClearAll {
228228
transform: translateX(-8px);
229229
position: relative;
230-
z-index: var(--p-z-1);
230+
z-index: var(--p-z-index-1);
231231
margin-left: 0;
232232
padding-right: var(--p-space-4);
233233
}

polaris-react/src/components/AlphaTabs/AlphaTabs.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
&:not([aria-disabled='true']):active {
102102
background-color: var(--p-color-bg-active);
103103
color: var(--p-color-text);
104-
z-index: var(--p-z-1);
104+
z-index: var(--p-z-index-1);
105105
}
106106

107107
path {
@@ -257,7 +257,7 @@
257257

258258
&:not([aria-disabled='true']):active {
259259
background-color: var(--p-color-bg-active);
260-
z-index: var(--p-z-1);
260+
z-index: var(--p-z-index-1);
261261
}
262262

263263
&[aria-disabled='true'] {

polaris-react/src/components/IndexFilters/IndexFilters.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ $spinner-size: 20px;
2020
z-index: var(--p-z-index-1);
2121
top: 56px;
2222
width: 100vw;
23-
box-shadow: var(--p-shadow-top-bar);
23+
box-shadow: var(--p-shadow-sm);
2424
}
2525

2626
.IndexFilters.IndexFiltersStickyFlush {

polaris-react/src/components/TopBar/components/Menu/tests/Menu.test.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,6 @@ describe('<Menu />', () => {
121121
expect(menu).toContainReactComponent(Message);
122122
});
123123

124-
describe('isFullHeight', () => {
125-
it('passes isFullHeight to popover as false if menu is not provided a message', () => {
126-
const {message, ...rest} = defaultProps;
127-
const menu = mountWithApp(<Menu {...rest} open />);
128-
129-
expect(menu).toContainReactComponent(Popover, {fullHeight: false});
130-
});
131-
132-
it('passes isFullHeight to popover as true if menu is provided a message', () => {
133-
const menu = mountWithApp(<Menu {...defaultProps} open />);
134-
135-
expect(menu).toContainReactComponent(Popover, {
136-
fullHeight: true,
137-
});
138-
});
139-
});
140-
141124
describe('accessibilityLabel', () => {
142125
it('passes accessibilityLabel to the popover activator', () => {
143126
const menu = mountWithApp(
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: colors/custom-property-disallowed-list
3+
description: Disallows use of legacy color custom properties.
4+
keywords:
5+
- stylelint
6+
- colors
7+
- colors rules
8+
---
9+
10+
```diff
11+
// Do
12+
+ color: var(--p-color-text-caution);
13+
// Don't
14+
- color: var(--p-text-warning);
15+
```

polaris.shopify.com/content/tools/stylelint-polaris/rules/colors-global-disallowed-list.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
---
22
title: colors/global-disallowed-list
3-
description: Disallows use of legacy color custom properties and mixin map data.
3+
description: Disallows use of legacy color Sass APIs.
44
keywords:
55
- stylelint
66
- colors
77
- colors rules
88
---
99

10-
Disallows use of legacy custom properties.
11-
12-
```diff
13-
// Do
14-
+ border: transparent;
15-
// Don't
16-
- border: var(--p-override-transparent);
17-
```
18-
19-
Disallows use of legacy mixin map data.
20-
2110
```diff
2211
// Don't
2312
- @type map $filter-palette-data: $polaris-color-filters;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: depth/custom-property-disallowed-list
3+
description: Disallows use of legacy shadow custom properties.
4+
keywords:
5+
- stylelint
6+
- depth
7+
- depth rules
8+
---
9+
10+
```diff
11+
// Do
12+
+ box-shadow: var(--p-shadow-md);
13+
// Don't
14+
- box-shadow: var(--p-shadow-deep)
15+
```
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
---
22
title: depth/global-disallowed-list
3-
description: Disallows use of legacy shadow custom properties and Sass mixin data.
3+
description: Disallows use of legacy depth Sass APIs.
44
keywords:
55
- stylelint
66
- depth
77
- depth rules
88
---
99

1010
```diff
11-
// Do
12-
+ box-shadow: var(--p-shadow-card);
1311
// Don't
14-
- box-shadow: var(--p-card-shadow);
12+
- @type map $depth-data: $shadows-data;
1513
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: layout/custom-property-disallowed-list
3+
description: Disallows use of legacy layout custom properties.
4+
keywords:
5+
- stylelint
6+
- layout
7+
- layout rules
8+
---
9+
10+
```diff
11+
// Do
12+
+ <Checkbox />
13+
// Don't
14+
- height: var(--p-choice-size);
15+
```

0 commit comments

Comments
 (0)