Skip to content

Commit ce01520

Browse files
Merge pull request #8 from edx/andya/sass-linter
Add Sass linting using rules from stylelint-config-edx
2 parents 1abc121 + 5b58e24 commit ce01520

File tree

5 files changed

+30
-18
lines changed

5 files changed

+30
-18
lines changed

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ preview: samples ## build the preview site
2929
aws s3 sync samples s3://${S3_PREVIEW_DOMAIN}/$(shell git rev-parse --abbrev-ref HEAD)
3030
@echo Preview generated to http://${S3_PREVIEW_DOMAIN}/$(shell git rev-parse --abbrev-ref HEAD)
3131

32-
test: clean samples ## run tests
32+
quality:
33+
./node_modules/stylelint/bin/stylelint.js sass/**/*.scss samples/**/*.scss
34+
35+
fix:
36+
./node_modules/stylelint/bin/stylelint.js sass/**/*.scss samples/**/*.scss --fix
37+
38+
test: clean quality samples ## run tests
3339

3440
xxx:
3541
echo $(shell git rev-parse --abbrev-ref HEAD)
36-

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"node-sass": "^4.5.3",
2323
"postcss": "^6.0.1",
2424
"postcss-cli": "^4.0.0",
25-
"postcss-rtlcss-combined": "^0.0.0"
25+
"postcss-rtlcss-combined": "^0.0.0",
26+
"stylelint-config-edx": "^1.0.0"
2627
}
2728
}

sass/edx/_variables.scss

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ $grid-breakpoints: (
160160
lg: 992px,
161161
xl: 1200px
162162
) !default;
163+
163164
@include _assert-ascending($grid-breakpoints, "$grid-breakpoints");
164165
@include _assert-starts-at-zero($grid-breakpoints);
165166

@@ -174,6 +175,7 @@ $container-max-widths: (
174175
lg: 960px,
175176
xl: 1140px
176177
) !default;
178+
177179
@include _assert-ascending($container-max-widths, "$container-max-widths");
178180

179181

@@ -189,7 +191,7 @@ $container-max-widths: (
189191
// Define common padding and border radius sizes and more.
190192

191193
$line-height-lg: 1.5 !default;
192-
$line-height-sm: 1.0 !default;
194+
$line-height-sm: 1 !default;
193195

194196
$border-width: 1px !default;
195197
$border-color: theme-color("light") !default;
@@ -318,9 +320,9 @@ $input-btn-padding-x-lg: 1rem !default;
318320
$input-btn-line-height-lg: 1.5 !default;
319321

320322
$btn-font-weight: $font-weight-normal !default;
321-
$btn-box-shadow: inset 0 1px 0 rgba($theme-color-inverse,.15), 0 1px 1px rgba($theme-color-darkest,.075) !default;
323+
$btn-box-shadow: inset 0 1px 0 rgba($theme-color-inverse, .15), 0 1px 1px rgba($theme-color-darkest, .075) !default;
322324
$btn-focus-box-shadow: 0 0 0 3px rgba($theme-color-primary, .25) !default;
323-
$btn-active-box-shadow: inset 0 3px 5px rgba($theme-color-darkest,.125) !default;
325+
$btn-active-box-shadow: inset 0 3px 5px rgba($theme-color-darkest, .125) !default;
324326

325327
$btn-link-disabled-color: theme-colors("disabled") !default;
326328

@@ -340,9 +342,9 @@ $input-bg: theme-color("inverse") !default;
340342
$input-disabled-bg: theme-color("light") !default;
341343

342344
$input-color: theme-color("secondary") !default;
343-
$input-border-color: rgba($theme-color-darkest,.15) !default;
345+
$input-border-color: rgba($theme-color-darkest, .15) !default;
344346
$input-btn-border-width: $border-width !default; // For form controls and buttons
345-
$input-box-shadow: inset 0 1px 1px rgba($theme-color-darkest,.075) !default;
347+
$input-box-shadow: inset 0 1px 1px rgba($theme-color-darkest, .075) !default;
346348

347349
$input-border-radius: $border-radius !default;
348350
$input-border-radius-lg: $border-radius-lg !default;
@@ -477,10 +479,10 @@ $dropdown-min-width: 10rem !default;
477479
$dropdown-padding-y: .5rem !default;
478480
$dropdown-spacer: .125rem !default;
479481
$dropdown-bg: theme-color("inverse") !default;
480-
$dropdown-border-color: rgba($theme-color-darkest,.15) !default;
482+
$dropdown-border-color: rgba($theme-color-darkest, .15) !default;
481483
$dropdown-border-width: $border-width !default;
482484
$dropdown-divider-bg: theme-color("light") !default;
483-
$dropdown-box-shadow: 0 .5rem 1rem rgba($theme-color-darkest,.175) !default;
485+
$dropdown-box-shadow: 0 .5rem 1rem rgba($theme-color-darkest, .175) !default;
484486

485487
$dropdown-link-color: theme-color("darker") !default;
486488
$dropdown-link-hover-color: darken($theme-color-darker, 5%) !default;

sass/open-edx/_variables.scss

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Variables should follow the `$component-state-property-size` formula for
44
// consistent naming. Ex: $nav-link-disabled-color and $modal-content-box-shadow-xs.
55

6-
76
//
87
// Color system
98
//
@@ -159,6 +158,7 @@ $grid-breakpoints: (
159158
lg: 992px,
160159
xl: 1200px
161160
) !default;
161+
162162
@include _assert-ascending($grid-breakpoints, "$grid-breakpoints");
163163
@include _assert-starts-at-zero($grid-breakpoints);
164164

@@ -173,6 +173,7 @@ $container-max-widths: (
173173
lg: 960px,
174174
xl: 1140px
175175
) !default;
176+
176177
@include _assert-ascending($container-max-widths, "$container-max-widths");
177178

178179

@@ -188,7 +189,7 @@ $container-max-widths: (
188189
// Define common padding and border radius sizes and more.
189190

190191
$line-height-lg: 1.5 !default;
191-
$line-height-sm: 1.0 !default;
192+
$line-height-sm: 1 !default;
192193

193194
$border-width: 1px !default;
194195
$border-color: theme-color("light") !default;
@@ -317,9 +318,9 @@ $input-btn-padding-x-lg: 1rem !default;
317318
$input-btn-line-height-lg: 1.5 !default;
318319

319320
$btn-font-weight: $font-weight-normal !default;
320-
$btn-box-shadow: inset 0 1px 0 rgba($theme-color-inverse,.15), 0 1px 1px rgba($theme-color-darkest,.075) !default;
321+
$btn-box-shadow: inset 0 1px 0 rgba($theme-color-inverse, .15), 0 1px 1px rgba($theme-color-darkest, .075) !default;
321322
$btn-focus-box-shadow: 0 0 0 3px rgba($theme-color-primary, .25) !default;
322-
$btn-active-box-shadow: inset 0 3px 5px rgba($theme-color-darkest,.125) !default;
323+
$btn-active-box-shadow: inset 0 3px 5px rgba($theme-color-darkest, .125) !default;
323324

324325
$btn-link-disabled-color: theme-colors("disabled") !default;
325326

@@ -339,9 +340,9 @@ $input-bg: $white !default;
339340
$input-disabled-bg: theme-color("light") !default;
340341

341342
$input-color: $gray-700 !default;
342-
$input-border-color: rgba($theme-color-darkest,.15) !default;
343+
$input-border-color: rgba($theme-color-darkest, .15) !default;
343344
$input-btn-border-width: $border-width !default; // For form controls and buttons
344-
$input-box-shadow: inset 0 1px 1px rgba($theme-color-darkest,.075) !default;
345+
$input-box-shadow: inset 0 1px 1px rgba($theme-color-darkest, .075) !default;
345346

346347
$input-border-radius: $border-radius !default;
347348
$input-border-radius-lg: $border-radius-lg !default;
@@ -476,10 +477,10 @@ $dropdown-min-width: 10rem !default;
476477
$dropdown-padding-y: .5rem !default;
477478
$dropdown-spacer: .125rem !default;
478479
$dropdown-bg: $white !default;
479-
$dropdown-border-color: rgba($theme-color-darkest,.15) !default;
480+
$dropdown-border-color: rgba($theme-color-darkest, .15) !default;
480481
$dropdown-border-width: $border-width !default;
481482
$dropdown-divider-bg: theme-color("light") !default;
482-
$dropdown-box-shadow: 0 .5rem 1rem rgba($theme-color-darkest,.175) !default;
483+
$dropdown-box-shadow: 0 .5rem 1rem rgba($theme-color-darkest, .175) !default;
483484

484485
$dropdown-link-color: theme-color("darkest") !default;
485486
$dropdown-link-hover-color: darken($theme-color-darkest, 5%) !default;

stylelint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: 'stylelint-config-edx'
3+
};

0 commit comments

Comments
 (0)