Skip to content

Commit 8cbc988

Browse files
authored
Add stylelint for SCSS linting (#8647)
* Add stylelint Adds stylelint and configures it to lint SCSS files with a very conservative rule set. * Make "npm run lint" run its tasks concurrently
1 parent ea64a0f commit 8cbc988

File tree

97 files changed

+1633
-633
lines changed

Some content is hidden

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

97 files changed

+1633
-633
lines changed

.stylelintrc.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "stylelint-config-wordpress",
3+
"rules": {
4+
"at-rule-empty-line-before": null,
5+
"at-rule-no-unknown": null,
6+
"comment-empty-line-before": null,
7+
"declaration-block-no-duplicate-properties": null,
8+
"declaration-property-unit-whitelist": null,
9+
"font-weight-notation": null,
10+
"max-line-length": null,
11+
"no-descending-specificity": null,
12+
"no-duplicate-selectors": null,
13+
"rule-empty-line-before": null,
14+
"selector-class-pattern": null,
15+
"value-keyword-case": null
16+
}
17+
}

core-blocks/button/editor.scss

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

3939
.editor-url-input__suggestions {
4040
width: $blocks-button__link-input-width - $icon-button-size - $icon-button-size;
41-
z-index: z-index( '.core-blocks-button__inline-link .editor-url-input__suggestions' );
41+
z-index: z-index(".core-blocks-button__inline-link .editor-url-input__suggestions");
4242
}
4343

4444
> .dashicon {
@@ -49,7 +49,7 @@
4949
color: $dark-gray-100;
5050
}
5151

52-
.editor-url-input input[type=text]::placeholder {
52+
.editor-url-input input[type="text"]::placeholder {
5353
color: $dark-gray-100;
5454
}
5555

core-blocks/button/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ $blocks-button__line-height: $big-font-size + 6px;
1313
font-size: $big-font-size;
1414
line-height: $blocks-button__line-height;
1515
margin: 0;
16-
padding: ( $blocks-button__height - $blocks-button__line-height ) / 2 24px;
16+
padding: ($blocks-button__height - $blocks-button__line-height) / 2 24px;
1717
text-align: center;
1818
text-decoration: none;
1919
white-space: normal;
@@ -80,7 +80,7 @@ $blocks-button__line-height: $big-font-size + 6px;
8080
}
8181

8282
&.has-very-light-gray-background-color {
83-
border-color: #eeeeee;
83+
border-color: #eee;
8484
}
8585

8686
&.has-cyan-bluish-gray-background-color {

core-blocks/code/editor.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
font-family: $editor-html-font;
33
font-size: $text-editor-font-size;
44
color: $dark-gray-800;
5-
padding: .8em 1.6em;
5+
padding: 0.8em 1.6em;
66
border: $border-width solid $light-gray-500;
77
border-radius: 4px;
88
}
@@ -33,7 +33,7 @@
3333
cursor: default;
3434
}
3535

36-
&> span {
36+
& > span {
3737
border: $border-width solid transparent;
3838
padding: 0 6px;
3939
box-sizing: content-box;

core-blocks/code/theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
font-family: $editor-html-font;
33
font-size: $text-editor-font-size;
44
color: $dark-gray-800;
5-
padding: .8em 1.6em;
5+
padding: 0.8em 1.6em;
66
border: 1px solid $light-gray-500;
77
border-radius: 4px;
88
}

core-blocks/cover-image/editor.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
margin: 0 -2px;
1111
border-radius: 2px;
1212
box-shadow: none;
13-
background: rgba( 255, 255, 255, 0.3 );
13+
background: rgba(255, 255, 255, 0.3);
1414
}
1515

1616
.editor-rich-text strong {
@@ -25,7 +25,7 @@
2525
justify-content: flex-start;
2626
}
2727

28-
&.has-right-content .editor-rich-text__inline-toolbar{
28+
&.has-right-content .editor-rich-text__inline-toolbar {
2929
justify-content: flex-end;
3030
}
3131
}

core-blocks/cover-image/style.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@
5353
}
5454

5555
&.has-background-dim::before {
56-
content: '';
56+
content: "";
5757
position: absolute;
5858
top: 0;
5959
left: 0;
6060
bottom: 0;
6161
right: 0;
62-
background-color: rgba( $black, 0.5 );
62+
background-color: rgba($black, 0.5);
6363
}
6464

6565
@for $i from 1 through 10 {
6666
&.has-background-dim.has-background-dim-#{ $i * 10 }::before {
67-
background-color: rgba( $black, $i * 0.1 );
67+
background-color: rgba($black, $i * 0.1);
6868
}
6969
}
7070

core-blocks/file/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
&:active {
2727
box-shadow: none;
2828
color: $white;
29-
opacity: .85;
29+
opacity: 0.85;
3030
text-decoration: none;
3131
}
3232
}

core-blocks/freeform/editor.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
margin: 15px auto;
111111
outline: 0;
112112
cursor: default;
113-
border: 2px dashed rgb( 186, 186, 186 );
113+
border: 2px dashed rgb(186, 186, 186);
114114
}
115115
}
116116

@@ -132,17 +132,17 @@
132132

133133

134134
div[data-type="core/freeform"] .editor-block-contextual-toolbar + div {
135-
margin-top: 0;
136-
padding-top: 0;
135+
margin-top: 0;
136+
padding-top: 0;
137137
}
138138

139139
.freeform-toolbar {
140140
width: auto;
141141
margin: 0 #{ -$parent-block-padding };
142142
position: sticky;
143-
z-index: z-index( '.freeform-toolbar' );
143+
z-index: z-index(".freeform-toolbar");
144144
top: $block-padding;
145-
transform: translateY( -$block-padding );
145+
transform: translateY(-$block-padding);
146146
}
147147

148148
.freeform-toolbar:empty {
@@ -153,7 +153,7 @@ div[data-type="core/freeform"] .editor-block-contextual-toolbar + div {
153153
&::before {
154154
font-family: $default-font;
155155
font-size: $default-font-size;
156-
content: attr( data-placeholder );
156+
content: attr(data-placeholder);
157157
color: #555d66;
158158
line-height: 37px;
159159
padding: $block-padding;

core-blocks/gallery/editor.scss

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
.wp-block-gallery.components-placeholder {
2-
margin: 0px;
2+
margin: 0;
33
}
44

55
// Allow gallery items to go edge to edge.
6-
.gutenberg .wp-block-gallery:not( .components-placeholder ) {
6+
.gutenberg .wp-block-gallery:not(.components-placeholder) {
77
margin-left: -8px;
88
margin-right: -8px;
99
}
1010

1111
// Don't use negative margins when full-wide.
12-
.gutenberg [data-align="full"] .wp-block-gallery:not( .components-placeholder ) {
12+
.gutenberg [data-align="full"] .wp-block-gallery:not(.components-placeholder) {
1313
margin-left: auto;
1414
margin-right: auto;
1515
}
1616

1717
.blocks-gallery-item {
1818

1919
.is-selected {
20-
outline: 4px solid theme( primary );
20+
outline: 4px solid theme(primary);
2121
outline-offset: -4px;
2222
}
2323

@@ -32,13 +32,13 @@
3232
overflow-y: auto;
3333
}
3434

35-
.editor-rich-text figcaption:not( [data-is-placeholder-visible="true"] ) {
35+
.editor-rich-text figcaption:not([data-is-placeholder-visible="true"]) {
3636
position: relative;
3737
overflow: hidden;
3838
}
3939

4040
.is-selected .editor-rich-text {
41-
width: calc( 100% - 8px );
41+
width: calc(100% - 8px);
4242
left: 4px;
4343
margin-top: -4px;
4444

@@ -84,9 +84,9 @@
8484
position: absolute;
8585
top: 0;
8686
right: 0;
87-
background-color: theme( primary );
87+
background-color: theme(primary);
8888
display: inline-flex;
89-
z-index: z-index( '.core-blocks-gallery-item__inline-menu' );
89+
z-index: z-index(".core-blocks-gallery-item__inline-menu");
9090

9191
.components-button {
9292
color: $white;
@@ -105,16 +105,18 @@
105105
position: absolute;
106106
top: 50%;
107107
left: 50%;
108-
transform: translate( -50%, -50% );
108+
transform: translate(-50%, -50%);
109109
}
110110

111111
// IE11 doesn't support object-fit or flex very well, so we inline-block.
112-
@media all and ( -ms-high-contrast: none ) {
113-
*::-ms-backdrop, .blocks-gallery-item {
112+
@media all and (-ms-high-contrast: none) {
113+
*::-ms-backdrop,
114+
.blocks-gallery-item {
114115
display: inline-block;
115116
}
116117

117-
*::-ms-backdrop, .blocks-gallery-item img {
118+
*::-ms-backdrop,
119+
.blocks-gallery-item img {
118120
width: 100%;
119121
}
120-
}
122+
}

0 commit comments

Comments
 (0)