Skip to content

Commit d79f587

Browse files
committed
added scss lint
1 parent abe9917 commit d79f587

File tree

14 files changed

+317
-121
lines changed

14 files changed

+317
-121
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ Thumbs.db
4949
!CHANGELOG.md
5050
!composer.json
5151
!.gitkeep
52+
!.scss-lint.yml

assets/.scss-lint.yml

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
# Default application configuration that all configurations inherit from.
2+
3+
scss_files: "**/*.scss"
4+
plugin_directories: ['.scss-linters']
5+
6+
# List of gem names to load custom linters from (make sure they are already
7+
# installed)
8+
plugin_gems: []
9+
10+
# Default severity of all linters.
11+
severity: warning
12+
13+
linters:
14+
BangFormat:
15+
enabled: true
16+
space_before_bang: true
17+
space_after_bang: false
18+
19+
BemDepth:
20+
enabled: false
21+
max_elements: 1
22+
23+
BorderZero:
24+
enabled: true
25+
convention: zero # or `none`
26+
27+
ChainedClasses:
28+
enabled: false
29+
30+
ColorKeyword:
31+
enabled: true
32+
33+
ColorVariable:
34+
enabled: true
35+
36+
Comment:
37+
enabled: true
38+
style: silent
39+
40+
DebugStatement:
41+
enabled: true
42+
43+
DeclarationOrder:
44+
enabled: true
45+
46+
DisableLinterReason:
47+
enabled: false
48+
49+
DuplicateProperty:
50+
enabled: true
51+
52+
ElsePlacement:
53+
enabled: true
54+
style: same_line # or 'new_line'
55+
56+
EmptyLineBetweenBlocks:
57+
enabled: true
58+
ignore_single_line_blocks: true
59+
60+
EmptyRule:
61+
enabled: true
62+
63+
ExtendDirective:
64+
enabled: false
65+
66+
FinalNewline:
67+
enabled: true
68+
present: true
69+
70+
HexLength:
71+
enabled: true
72+
style: short # or 'long'
73+
74+
HexNotation:
75+
enabled: true
76+
style: lowercase # or 'uppercase'
77+
78+
HexValidation:
79+
enabled: true
80+
81+
IdSelector:
82+
enabled: true
83+
84+
ImportantRule:
85+
enabled: true
86+
87+
ImportPath:
88+
enabled: true
89+
leading_underscore: false
90+
filename_extension: false
91+
92+
Indentation:
93+
enabled: true
94+
allow_non_nested_indentation: false
95+
character: space # or 'tab'
96+
width: 2
97+
98+
LeadingZero:
99+
enabled: true
100+
style: exclude_zero # or 'include_zero'
101+
102+
MergeableSelector:
103+
enabled: true
104+
force_nesting: true
105+
106+
NameFormat:
107+
enabled: true
108+
allow_leading_underscore: true
109+
convention: hyphenated_lowercase # or 'camel_case', or 'snake_case', or a regex pattern
110+
111+
NestingDepth:
112+
enabled: true
113+
max_depth: 3
114+
ignore_parent_selectors: false
115+
116+
PlaceholderInExtend:
117+
enabled: true
118+
119+
PrivateNamingConvention:
120+
enabled: false
121+
prefix: _
122+
123+
PropertyCount:
124+
enabled: false
125+
include_nested: false
126+
max_properties: 10
127+
128+
PropertySortOrder:
129+
enabled: true
130+
ignore_unspecified: false
131+
min_properties: 2
132+
separate_groups: false
133+
134+
PropertySpelling:
135+
enabled: true
136+
extra_properties: []
137+
disabled_properties: []
138+
139+
PropertyUnits:
140+
enabled: true
141+
global: [
142+
'ch', 'em', 'ex', 'rem', # Font-relative lengths
143+
'cm', 'in', 'mm', 'pc', 'pt', 'px', 'q', # Absolute lengths
144+
'vh', 'vw', 'vmin', 'vmax', # Viewport-percentage lengths
145+
'fr', # Grid fractional lengths
146+
'deg', 'grad', 'rad', 'turn', # Angle
147+
'ms', 's', # Duration
148+
'Hz', 'kHz', # Frequency
149+
'dpi', 'dpcm', 'dppx', # Resolution
150+
'%'] # Other
151+
properties: {}
152+
153+
PseudoElement:
154+
enabled: true
155+
156+
QualifyingElement:
157+
enabled: true
158+
allow_element_with_attribute: false
159+
allow_element_with_class: false
160+
allow_element_with_id: false
161+
162+
SelectorDepth:
163+
enabled: true
164+
max_depth: 3
165+
166+
SelectorFormat:
167+
enabled: true
168+
convention: hyphenated_BEM # or 'classic_BEM', or 'hyphenated_lowercase', or 'snake_case', or 'camel_case', or a regex pattern
169+
170+
Shorthand:
171+
enabled: true
172+
allowed_shorthands: [1, 2, 3, 4]
173+
174+
SingleLinePerProperty:
175+
enabled: true
176+
allow_single_line_rule_sets: true
177+
178+
SingleLinePerSelector:
179+
enabled: true
180+
181+
SpaceAfterComma:
182+
enabled: true
183+
style: one_space # or 'no_space', or 'at_least_one_space'
184+
185+
SpaceAfterComment:
186+
enabled: false
187+
style: one_space # or 'no_space', or 'at_least_one_space'
188+
allow_empty_comments: true
189+
190+
SpaceAfterPropertyColon:
191+
enabled: true
192+
style: one_space # or 'no_space', or 'at_least_one_space', or 'aligned'
193+
194+
SpaceAfterPropertyName:
195+
enabled: true
196+
197+
SpaceAfterVariableColon:
198+
enabled: false
199+
style: one_space # or 'no_space', 'at_least_one_space' or 'one_space_or_newline'
200+
201+
SpaceAfterVariableName:
202+
enabled: true
203+
204+
SpaceAroundOperator:
205+
enabled: true
206+
style: one_space # or 'at_least_one_space', or 'no_space'
207+
208+
SpaceBeforeBrace:
209+
enabled: true
210+
style: space # or 'new_line'
211+
allow_single_line_padding: false
212+
213+
SpaceBetweenParens:
214+
enabled: true
215+
spaces: 0
216+
217+
StringQuotes:
218+
enabled: true
219+
style: single_quotes # or double_quotes
220+
221+
TrailingSemicolon:
222+
enabled: true
223+
224+
TrailingWhitespace:
225+
enabled: true
226+
227+
TrailingZero:
228+
enabled: false
229+
230+
TransitionAll:
231+
enabled: false
232+
233+
UnnecessaryMantissa:
234+
enabled: true
235+
236+
UnnecessaryParentReference:
237+
enabled: true
238+
239+
UrlFormat:
240+
enabled: true
241+
242+
UrlQuotes:
243+
enabled: true
244+
245+
VariableForProperty:
246+
enabled: false
247+
properties: []
248+
249+
VendorPrefix:
250+
enabled: true
251+
identifier_list: base
252+
additional_identifiers: []
253+
excluded_identifiers: []
254+
255+
ZeroUnit:
256+
enabled: true
257+
258+
Compass::*:
259+
enabled: false

assets/Gulpfile.js renamed to assets/gulpfile.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ const cleancss = require('gulp-clean-css');
88
const concat = require('gulp-concat');
99
const rename = require('gulp-rename');
1010
const uglify = require('gulp-uglify');
11+
const scsslint = require('gulp-scss-lint');
1112

1213
/**
1314
* Here we set a prefix for our compiled and stylesheet and scripts.
1415
* Note that this should be the same as the `$themeHandlePrefix` in `func-script.php` and `func-style.php`.
1516
*/
16-
const themePrefix = 'theme-name';
17+
const themePrefix = 'ucl';
1718

1819
/**
1920
* Asset paths.
@@ -25,12 +26,20 @@ const jsSrcFiles = [
2526
`${jsSrcDir}/scripts/common.js`,
2627
];
2728

29+
/**
30+
* Scss lint
31+
*/
32+
gulp.task('scss-lint', function() {
33+
return gulp.src(scssSrc)
34+
.pipe(scsslint());
35+
});
36+
2837
/**
2938
* Task for styles.
3039
*
3140
* Scss files are compiled and sent over to `assets/css/`.
3241
*/
33-
gulp.task('css', function () {
42+
gulp.task('css', ['scss-lint'], function () {
3443
gulp.src(scssSrc)
3544
.pipe(sass().on('error', sass.logError))
3645
.pipe(autoprefixer({ cascade : false }))
@@ -61,3 +70,8 @@ gulp.task('watch', function () {
6170
gulp.watch(scssSrc, ['css']);
6271
gulp.watch(jsSrcFiles, ['js']);
6372
});
73+
74+
/**
75+
* Default task
76+
*/
77+
gulp.task('default', ['css', 'js'] );

assets/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@
1212
"babel-core": "^6.26.3",
1313
"babel-preset-env": "^1.7.0",
1414
"babel-preset-es2015": "^6.24.1",
15-
"bootstrap-scss": "^4.3.1",
15+
"bootstrap-scss": "^4.4.1",
1616
"gulp": "^3.9.1",
1717
"gulp-autoprefixer": "^6.0.0",
1818
"gulp-babel": "^7.0.1",
1919
"gulp-clean-css": "^4.0.0",
2020
"gulp-concat": "^2.6.1",
2121
"gulp-rename": "^1.4.0",
2222
"gulp-sass": "^4.0.2",
23+
"gulp-scss-lint": "^1.0.0",
2324
"gulp-uglify": "^3.0.1",
2425
"gulp-uncss": "^1.0.6",
25-
"node-sass": "^4.11.0"
26+
"node-sass": "^4.13.1"
2627
},
2728
"dependencies": {
2829
"babel-polyfill": "^6.26.0"

assets/scss/layout/_footer.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
.footer {
2-
3-
}

assets/scss/layout/_header.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
.header {
2-
3-
}

assets/scss/layout/_main.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
.main {
2-
3-
}

assets/scss/layout/_nav.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
.nav {
2-
3-
}

assets/scss/mixins/_fonts.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// --------------------------------------------------
22
// font size
33

4-
@function calculateRem($size) {
5-
$remSize: $size / 18px;
6-
@return $remSize * 1rem;
4+
@function calculate-rem($size) {
5+
$rem-size: $size / 16px;
6+
@return $rem-size * 1rem;
77
}
88

99
@mixin font-size($size) {
10-
font-size: $size;
11-
font-size: calculateRem($size);
10+
font-size: calculate-rem($size);
1211
}
1312

1413
// --------------------------------------------------

0 commit comments

Comments
 (0)