Skip to content

Commit 39b14c9

Browse files
MartijnCuppensXhmikosR
authored andcommitted
Blacklist border-radius property (use mixin instead) (#27900)
1 parent 6a5a1b0 commit 39b14c9

14 files changed

+40
-35
lines changed

.stylelintrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,14 @@
261261
"fill",
262262
"stroke"
263263
],
264-
"property-blacklist": ["transition"],
264+
"property-blacklist": [
265+
"border-radius",
266+
"border-top-left-radius",
267+
"border-top-right-radius",
268+
"border-bottom-right-radius",
269+
"border-bottom-left-radius",
270+
"transition"
271+
],
265272
"property-no-vendor-prefix": true,
266273
"rule-empty-line-before": null,
267274
"scss/at-function-named-arguments": "never",

scss/_card.scss

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,12 @@
200200

201201
.card-img-top,
202202
.card-header {
203+
// stylelint-disable-next-line property-blacklist
203204
border-top-right-radius: 0;
204205
}
205206
.card-img-bottom,
206207
.card-footer {
208+
// stylelint-disable-next-line property-blacklist
207209
border-bottom-right-radius: 0;
208210
}
209211
}
@@ -213,10 +215,12 @@
213215

214216
.card-img-top,
215217
.card-header {
218+
// stylelint-disable-next-line property-blacklist
216219
border-top-left-radius: 0;
217220
}
218221
.card-img-bottom,
219222
.card-footer {
223+
// stylelint-disable-next-line property-blacklist
220224
border-bottom-left-radius: 0;
221225
}
222226
}
@@ -283,24 +287,22 @@
283287

284288
&:not(:first-of-type) {
285289
.card-header:first-child {
286-
border-radius: 0;
290+
@include border-radius(0);
287291
}
288292

289293
&:not(:last-of-type) {
290294
border-bottom: 0;
291-
border-radius: 0;
295+
@include border-radius(0);
292296
}
293297
}
294298

295299
&:first-of-type {
296300
border-bottom: 0;
297-
border-bottom-right-radius: 0;
298-
border-bottom-left-radius: 0;
301+
@include border-bottom-radius(0);
299302
}
300303

301304
&:last-of-type {
302-
border-top-left-radius: 0;
303-
border-top-right-radius: 0;
305+
@include border-top-radius(0);
304306
}
305307

306308
.card-header {

scss/_custom-forms.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144

145145
.custom-radio {
146146
.custom-control-label::before {
147+
// stylelint-disable-next-line property-blacklist
147148
border-radius: $custom-radio-indicator-border-radius;
148149
}
149150

@@ -173,6 +174,7 @@
173174
left: -($custom-switch-width + $custom-control-gutter);
174175
width: $custom-switch-width;
175176
pointer-events: all;
177+
// stylelint-disable-next-line property-blacklist
176178
border-radius: $custom-switch-indicator-border-radius;
177179
}
178180

@@ -182,6 +184,7 @@
182184
width: $custom-switch-indicator-size;
183185
height: $custom-switch-indicator-size;
184186
background-color: $custom-control-indicator-border-color;
187+
// stylelint-disable-next-line property-blacklist
185188
border-radius: $custom-switch-indicator-border-radius;
186189
@include transition(transform .15s ease-in-out, $custom-forms-transition);
187190
}
@@ -220,11 +223,7 @@
220223
background: $custom-select-background;
221224
background-color: $custom-select-bg;
222225
border: $custom-select-border-width solid $custom-select-border-color;
223-
@if $enable-rounded {
224-
border-radius: $custom-select-border-radius;
225-
} @else {
226-
border-radius: 0;
227-
}
226+
@include border-radius($custom-select-border-radius, 0);
228227
@include box-shadow($custom-select-box-shadow);
229228
appearance: none;
230229

scss/_forms.scss

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@
1818
border: $input-border-width solid $input-border-color;
1919

2020
// Note: This has no effect on <select>s in some browsers, due to the limited stylability of `<select>`s in CSS.
21-
@if $enable-rounded {
22-
// Manually use the if/else instead of the mixin to account for iOS override
23-
border-radius: $input-border-radius;
24-
} @else {
25-
// Otherwise undo the iOS default
26-
border-radius: 0;
27-
}
21+
@include border-radius($input-border-radius, 0);
2822

2923
@include box-shadow($input-box-shadow);
3024
@include transition($input-transition);

scss/_reboot.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ label {
297297
//
298298
// Details at https://github.com/twbs/bootstrap/issues/24093
299299
button {
300+
// stylelint-disable-next-line property-blacklist
300301
border-radius: 0;
301302
}
302303

scss/_spinners.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
vertical-align: text-bottom;
1414
border: $spinner-border-width solid currentColor;
1515
border-right-color: transparent;
16+
// stylelint-disable-next-line property-blacklist
1617
border-radius: 50%;
1718
animation: spinner-border .75s linear infinite;
1819
}
@@ -42,6 +43,7 @@
4243
height: $spinner-height;
4344
vertical-align: text-bottom;
4445
background-color: currentColor;
46+
// stylelint-disable-next-line property-blacklist
4547
border-radius: 50%;
4648
opacity: 0;
4749
animation: spinner-grow .75s linear infinite;

scss/mixins/_border-radius.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
// stylelint-disable property-blacklist
12
// Single side border-radius
23

3-
@mixin border-radius($radius: $border-radius) {
4+
@mixin border-radius($radius: $border-radius, $fallback-border-radius: false) {
45
@if $enable-rounded {
56
border-radius: $radius;
67
}
8+
@else if $fallback-border-radius != false {
9+
border-radius: $fallback-border-radius;
10+
}
711
}
812

913
@mixin border-top-radius($radius) {

scss/mixins/_buttons.scss

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,5 @@
103103
font-size: $font-size;
104104
line-height: $line-height;
105105
// Manually declare to provide an override to the browser default
106-
@if $enable-rounded {
107-
border-radius: $border-radius;
108-
} @else {
109-
border-radius: 0;
110-
}
106+
@include border-radius($border-radius, 0);
111107
}

scss/utilities/_borders.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// stylelint-disable declaration-no-important
1+
// stylelint-disable property-blacklist, declaration-no-important
22

33
//
44
// Border

site/docs/4.2/assets/scss/_ads.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
@include media-breakpoint-up(sm) {
2525
max-width: 330px;
26-
border-radius: 4px;
26+
@include border-radius(4px);
2727
}
2828
}
2929

site/docs/4.2/assets/scss/_brand.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
overflow: hidden;
1111
color: $bd-purple;
1212
background-color: #f9f9f9;
13-
border-radius: .25rem;
13+
@include border-radius;
1414

1515
.inverse {
1616
color: $white;
@@ -79,7 +79,7 @@
7979
height: 4rem;
8080
margin-right: .25rem;
8181
margin-left: .25rem;
82-
border-radius: .25rem;
82+
@include border-radius;
8383

8484
@include media-breakpoint-up(md) {
8585
width: 6rem;

site/docs/4.2/assets/scss/_callouts.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
margin-bottom: 1.25rem;
99
border: 1px solid #eee;
1010
border-left-width: .25rem;
11-
border-radius: .25rem;
11+
@include border-radius;
1212

1313
h4 {
1414
margin-top: 0;
@@ -20,7 +20,7 @@
2020
}
2121

2222
code {
23-
border-radius: .25rem;
23+
@include border-radius;
2424
}
2525

2626
+ .bd-callout {

site/docs/4.2/assets/scss/_clipboard-js.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
cursor: pointer;
2929
background-color: transparent;
3030
border: 0;
31-
border-radius: .25rem;
31+
@include border-radius;
3232

3333
&:hover {
3434
color: $white;

site/docs/4.2/assets/scss/_component-examples.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,22 @@
8787
height: 3rem;
8888
margin-bottom: .5rem;
8989
background-color: lighten($blue, 50%);
90-
border-radius: .25rem;
90+
@include border-radius;
9191
}
9292

9393
.bd-example-container-sidebar {
9494
float: right;
9595
width: 4rem;
9696
height: 8rem;
9797
background-color: lighten($blue, 25%);
98-
border-radius: .25rem;
98+
@include border-radius;
9999
}
100100

101101
.bd-example-container-body {
102102
height: 8rem;
103103
margin-right: 4.5rem;
104104
background-color: lighten($bd-purple, 25%);
105-
border-radius: .25rem;
105+
@include border-radius;
106106
}
107107

108108
.bd-example-container-fluid {

0 commit comments

Comments
 (0)