Skip to content

Commit 2ea223d

Browse files
committed
Fix stylelint violations across component pcss
Makes the full pcss tree pass stylelint (previously only changed files were linted in CI, so violations accumulated latent). Changes: - Remove 44 needless `stylelint-disable primer/spacing` comments that no longer suppress anything. - Auto-fix (stylelint --fix): rgba->rgb alias notation and hardcoded spacing that had an obvious token. - Scope-disable nesting-selector-no-missing-scoping-root on the @define-mixin blocks in layout.pcss and text_field.pcss; inside a mixin the & resolves at the include site, so the rule false-positives. - Real fixes: negative margins to calc()+base-size tokens (border_grid), text-overflow: initial to clip (collapsible_header), drop the redundant border-radius fallback (pagination). - Justified disables (with -- reasons) for intentional fork deviations and rule false positives: table border-collapse/style keywords, `.Page > svg` / description `a` type selectors, the container-query nested selectors, the legacy dotcom box-shadow, the yellow search-match highlight colors, and the visually-hidden `clip`.
1 parent 22f9fc0 commit 2ea223d

23 files changed

Lines changed: 35 additions & 52 deletions

app/components/primer/alpha/action_bar.pcss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,15 @@
4141
bottom: 50%;
4242
float: left;
4343
height: calc(var(--control-medium-size) / 2);
44-
/* stylelint-disable-next-line primer/spacing */
4544
margin: 0 var(--controlStack-medium-gap-condensed);
4645
border-left: var(--borderWidth-thin) solid var(--borderColor-muted);
4746
transform: translateY(-50%);
4847
}
4948

5049
.ActionBar--small .ActionBar-divider {
51-
/* stylelint-disable-next-line primer/spacing */
5250
margin: 0 var(--controlStack-small-gap-condensed);
5351
}
5452

5553
.ActionBar--large .ActionBar-divider {
56-
/* stylelint-disable-next-line primer/spacing */
5754
margin: 0 var(--controlStack-large-gap-condensed);
5855
}

app/components/primer/alpha/action_list.pcss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ nav-list {
301301
width: 100%;
302302
/* stylelint-disable-next-line primer/spacing */
303303
padding-block: var(--actionListContent-paddingBlock);
304-
/* stylelint-disable-next-line primer/spacing */
305304
padding-inline: var(--control-medium-paddingInline-condensed);
306305
color: var(--control-fgColor-rest);
307306
text-align: left;
@@ -319,7 +318,6 @@ nav-list {
319318

320319
/* column-gap persists with empty grid-areas, margin applies only when children exist */
321320
& > :not(:last-child) {
322-
/* stylelint-disable-next-line primer/spacing */
323321
margin-right: var(--control-medium-gap);
324322
}
325323

app/components/primer/alpha/banner.pcss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
/* is this used anywhere? could not find any use, but unsure */
7171
& .Banner-close {
7272
grid-area: close;
73-
/* stylelint-disable-next-line primer/spacing */
7473
margin-left: var(--controlStack-medium-gap-condensed);
7574
}
7675

app/components/primer/alpha/button_marketing.pcss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
vertical-align: middle;
1919
user-select: none;
2020
/* stylelint-disable-next-line primer/colors */
21-
background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 100%),
21+
background: linear-gradient(180deg, rgb(255, 255, 255, 0.15) 0%, rgb(255, 255, 255, 0) 100%),
2222
var(--color-mktg-btn-bg) !important;
2323
border: 0;
2424

@@ -37,7 +37,7 @@
3737
content: '';
3838

3939
/* stylelint-disable-next-line primer/colors */
40-
background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 100%) !important;
40+
background: linear-gradient(180deg, rgb(255, 255, 255, 0.15) 0%, rgb(255, 255, 255, 0) 100%) !important;
4141
border-radius: inherit;
4242
opacity: 0;
4343
transition: opacity 0.2s;
@@ -135,11 +135,11 @@
135135
color: #fff;
136136

137137
/* stylelint-disable-next-line primer/colors */
138-
background: linear-gradient(180deg, rgba(52, 183, 89, 0.15) 0%, rgba(46, 164, 79, 0) 100%), rgb(46, 164, 79) !important;
138+
background: linear-gradient(180deg, rgb(52, 183, 89, 0.15) 0%, rgb(46, 164, 79, 0) 100%), rgb(46, 164, 79) !important;
139139

140140
&::before {
141141
/* stylelint-disable-next-line primer/colors */
142-
background: linear-gradient(180deg, rgba(52, 183, 89, 0.15) 0%, rgba(46, 164, 79, 0) 100%) !important;
142+
background: linear-gradient(180deg, rgb(52, 183, 89, 0.15) 0%, rgb(46, 164, 79, 0) 100%) !important;
143143
}
144144

145145
/* fallback :focus state */

app/components/primer/alpha/layout.pcss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* Layout */
22

3+
/* stylelint-disable nesting-selector-no-missing-scoping-root -- inside @define-mixin the & resolves at the @mixin include site, so there is a scoping root */
4+
35
@define-mixin flow-as-row {
46
grid-auto-flow: row;
57
grid-template-columns: 1fr !important;
@@ -104,7 +106,7 @@
104106

105107
grid-auto-flow: column;
106108
grid-template-columns: auto 0 minmax(0, calc(100% - var(--Layout-sidebar-width) - var(--Layout-gutter))); /* sidebar column, separator, main column */
107-
grid-gap: var(--Layout-gutter);
109+
gap: var(--Layout-gutter);
108110

109111
& .Layout-sidebar {
110112
grid-column: 1;

app/components/primer/alpha/menu.pcss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
/* A menu on the side of a page, defaults to left side. e.g. github.com/about */
44

55
.menu {
6-
/* stylelint-disable-next-line primer/spacing */
76
margin-bottom: var(--stack-gap-normal);
87
list-style: none;
98
background-color: var(--bgColor-default);
@@ -14,7 +13,6 @@
1413
.menu-item {
1514
position: relative;
1615
display: block;
17-
/* stylelint-disable-next-line primer/spacing */
1816
padding: var(--control-medium-paddingInline-condensed) var(--control-medium-paddingInline-spacious);
1917
color: var(--fgColor-default);
2018
border-bottom: var(--borderWidth-thin) solid var(--borderColor-default);
@@ -68,15 +66,13 @@
6866

6967
& .octicon {
7068
width: 16px;
71-
/* stylelint-disable-next-line primer/spacing */
7269
margin-right: var(--control-medium-gap);
7370
color: var(--fgColor-muted);
7471
text-align: center;
7572
}
7673

7774
& .Counter {
7875
float: right;
79-
/* stylelint-disable-next-line primer/spacing */
8076
margin-left: var(--control-small-gap);
8177
}
8278

@@ -87,7 +83,6 @@
8783

8884
& .avatar {
8985
float: left;
90-
/* stylelint-disable-next-line primer/spacing */
9186
margin-right: var(--control-small-gap);
9287
}
9388

@@ -100,7 +95,6 @@
10095

10196
.menu-heading {
10297
display: block;
103-
/* stylelint-disable-next-line primer/spacing */
10498
padding: var(--control-medium-paddingInline-condensed) var(--control-medium-paddingInline-spacious);
10599
margin-top: 0;
106100
margin-bottom: 0;

app/components/primer/alpha/segmented_control.pcss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@
111111
&::before {
112112
position: absolute;
113113
inset: 0 0 0 -1px;
114-
/* stylelint-disable-next-line primer/spacing */
115114
margin-top: var(--control-medium-paddingBlock);
116-
/* stylelint-disable-next-line primer/spacing */
117115
margin-bottom: var(--control-medium-paddingBlock);
118116
content: '';
119117
border-left: var(--borderWidth-thin) solid var(--borderColor-default);

app/components/primer/alpha/tab_nav.pcss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
/* Outer wrapper */
44
.tabnav {
55
margin-top: 0;
6-
/* stylelint-disable-next-line primer/spacing */
76
margin-bottom: var(--stack-gap-normal);
87
border-bottom: var(--borderWidth-thin) solid var(--borderColor-default);
98
}
@@ -24,7 +23,6 @@
2423
.tabnav-tab {
2524
display: inline-block;
2625
flex-shrink: 0;
27-
/* stylelint-disable-next-line primer/spacing */
2826
padding: var(--base-size-8) var(--control-medium-paddingInline-spacious);
2927
font-size: var(--text-body-size-medium);
3028
/* stylelint-disable-next-line primer/typography */
@@ -66,13 +64,11 @@
6664
}
6765

6866
& .octicon {
69-
/* stylelint-disable-next-line primer/spacing */
7067
margin-right: var(--control-small-gap);
7168
color: var(--fgColor-muted);
7269
}
7370

7471
& .Counter {
75-
/* stylelint-disable-next-line primer/spacing */
7672
margin-left: var(--control-small-gap);
7773
color: inherit;
7874
}
@@ -110,6 +106,5 @@ a.tabnav-extra:hover {
110106
** the buttons to be floated or inline-block. */
111107

112108
.tabnav-btn {
113-
/* stylelint-disable-next-line primer/spacing */
114109
margin-left: var(--controlStack-medium-gap-condensed);
115110
}

app/components/primer/alpha/text_field.pcss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* stylelint-disable max-nesting-depth */
33
/* stylelint-disable selector-max-specificity */
44
/* stylelint-disable primer/spacing */
5+
/* stylelint-disable nesting-selector-no-missing-scoping-root -- & inside @define-mixin resolves at the @mixin include site */
56

67
/* FormControl */
78

app/components/primer/alpha/tree_view.pcss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@
350350
/* stylelint-disable-next-line primer/spacing */
351351
margin: -1px;
352352
overflow: hidden;
353+
/* stylelint-disable-next-line property-no-deprecated -- `clip` is the widely-supported visually-hidden idiom; kept for older-browser screen-reader support */
353354
clip: rect(0, 0, 0, 0);
354355
white-space: nowrap;
355356
border-width: 0;

0 commit comments

Comments
 (0)