Skip to content

Commit 01bdb5a

Browse files
authored
Merge pull request #844 from sasstools/release/1.9.1
Release/1.9.1
2 parents 38d43ad + a6db796 commit 01bdb5a

13 files changed

+175
-61
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
# Sass Lint Changelog
22

3+
## v1.9.1
4+
5+
**August 25, 2016**
6+
7+
**Fixes**
8+
* Fixed an issue with nth selectors in the `no-mergeable-selectors` rule [#834](https://github.com/sasstools/sass-lint/issues/834)
9+
* Fixed an issue with atrule arguments containing functions in the `no-mergeable-selectors` rule [#826](https://github.com/sasstools/sass-lint/issues/826)
10+
* Fixed an issue with hex colors being ignored in the `shorthand-values` rule [#836](https://github.com/sasstools/sass-lint/pull/836)
11+
312
## v1.9.0
413

514
**August 18, 2016**
615

716
**Fixes**
8-
* Fixed an issue with teh indentation rule when it encountered at-rules with no block immediately preceeding a map [#779](https://github.com/sasstools/sass-lint/issues/779) [#783](https://github.com/sasstools/sass-lint/issues/783)
17+
* Fixed an issue with the indentation rule when it encountered at-rules with no block immediately preceding a map [#779](https://github.com/sasstools/sass-lint/issues/779) [#783](https://github.com/sasstools/sass-lint/issues/783)
918
* Fixed an issue in `single-lint-per-selector` where inline comments were seen as selectors [#789](https://github.com/sasstools/sass-lint/issues/789)
1019
* Fixed an issue with interpolation in placeholders within the `bem-depth` rule [#782](https://github.com/sasstools/sass-lint/issues/782)
1120
* Removed duplicated code from `no-mergeable-selectors` to helper methods

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,4 @@ Our AST is [Gonzales-PE](https://github.com/tonyganch/gonzales-pe/tree/dev). Eac
195195
* [Brackets](https://github.com/petetnt/brackets-sass-lint)
196196
* [IntelliJ IDEA, RubyMine, WebStorm, PhpStorm, PyCharm](https://github.com/idok/sass-lint-plugin)
197197
* [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=glen-84.sass-lint)
198+
* [Vim](https://github.com/gcorne/vim-sass-lint)

lib/rules/shorthand-values.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ var scanValue = function (node) {
8989
fullVal += '#{' + scanValue(val.content) + '}';
9090
}
9191

92+
else if (val.is('color')) {
93+
fullVal += '#' + val.content + '';
94+
}
95+
9296
else if (val.is('operator') || val.is('ident') || val.is('number') || val.is('unaryOperator')) {
9397
fullVal += val.content;
9498
}

lib/selector-helpers.js

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ var simpleIdents = [
1616
'attributeMatch'
1717
];
1818

19+
var subSelectors = [
20+
'parentSelectorExtension',
21+
'attributeName',
22+
'attributeValue',
23+
'dimension',
24+
'selector',
25+
'function'
26+
];
27+
1928
/**
2029
* Adds grammar around our content blocks to construct selectors with
2130
* more readable formats.
@@ -61,36 +70,44 @@ var constructSubSelector = function (val, prefix, suffix, constructSelector) {
6170
var constructSelector = function (val) {
6271
var content = null;
6372

64-
if (val.is('id')) {
65-
content = addGrammar(val, '#', '');
73+
if (val.is('arguments')) {
74+
content = constructSubSelector(val, '(', ')', constructSelector);
75+
}
76+
77+
else if (val.is('atkeyword')) {
78+
content = constructSubSelector(val, '@', '', constructSelector);
79+
}
80+
81+
else if (val.is('attributeSelector')) {
82+
content = constructSubSelector(val, '[', ']', constructSelector);
6683
}
6784

6885
else if (val.is('class')) {
6986
content = addGrammar(val, '.', '');
7087
}
7188

72-
else if (simpleIdents.indexOf(val.type) !== -1) {
73-
content = val.content;
89+
else if (val.is('id')) {
90+
content = addGrammar(val, '#', '');
7491
}
7592

76-
else if (val.is('arguments')) {
77-
content = constructSubSelector(val, '(', ')', constructSelector);
93+
else if (val.is('interpolation')) {
94+
content = constructSubSelector(val, '#{', '}', constructSelector);
7895
}
7996

80-
else if (val.is('attributeSelector')) {
81-
content = constructSubSelector(val, '[', ']', constructSelector);
97+
else if (val.is('nth')) {
98+
content = addGrammar(val, '(', ')');
8299
}
83100

84-
else if (val.is('atkeyword')) {
85-
content = constructSubSelector(val, '@', '', constructSelector);
101+
else if (val.is('nthSelector')) {
102+
content = constructSubSelector(val, ':', '', constructSelector);
86103
}
87104

88-
else if (val.is('placeholder')) {
89-
content = constructSubSelector(val, '%', '', constructSelector);
105+
else if (val.is('parentheses')) {
106+
content = constructSubSelector(val, '(', ')', constructSelector);
90107
}
91108

92-
else if (val.is('variable')) {
93-
content = constructSubSelector(val, '$', '', constructSelector);
109+
else if (val.is('placeholder')) {
110+
content = constructSubSelector(val, '%', '', constructSelector);
94111
}
95112

96113
else if (val.is('pseudoClass')) {
@@ -101,29 +118,22 @@ var constructSelector = function (val) {
101118
content = addGrammar(val, '::', '');
102119
}
103120

104-
else if (val.is('nth')) {
105-
content = addGrammar(val, '(', ')');
106-
}
107-
108-
else if (val.is('nthSelector')) {
109-
content = constructSubSelector(val, ':', '', constructSelector);
121+
else if (val.is('space')) {
122+
content = ' ';
110123
}
111124

112-
else if (val.is('parentheses')) {
113-
content = constructSubSelector(val, '(', ')', constructSelector);
125+
else if (val.is('variable')) {
126+
content = constructSubSelector(val, '$', '', constructSelector);
114127
}
115128

116-
else if (val.is('space')) {
117-
content = ' ';
129+
else if (simpleIdents.indexOf(val.type) !== -1) {
130+
content = val.content;
118131
}
119132

120-
else if (val.is('parentSelectorExtension') || val.is('attributeName') || val.is('attributeValue') || val.is('dimension')) {
133+
else if (subSelectors.indexOf(val.type) !== -1) {
121134
content = constructSubSelector(val, '', '', constructSelector);
122135
}
123136

124-
else if (val.is('interpolation')) {
125-
content = constructSubSelector(val, '#{', '}', constructSelector);
126-
}
127137
return content;
128138
};
129139

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sass-lint",
3-
"version": "1.9.0",
3+
"version": "1.9.1",
44
"description": "All Node Sass linter!",
55
"main": "index.js",
66
"scripts": {

tests/rules/no-mergeable-selectors.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('no mergeable selectors - scss', function () {
99
lint.test(file, {
1010
'no-mergeable-selectors': 1
1111
}, function (data) {
12-
lint.assert.equal(22, data.warningCount);
12+
lint.assert.equal(24, data.warningCount);
1313
done();
1414
});
1515
});
@@ -25,7 +25,7 @@ describe('no mergeable selectors - scss', function () {
2525
}
2626
]
2727
}, function (data) {
28-
lint.assert.equal(21, data.warningCount);
28+
lint.assert.equal(23, data.warningCount);
2929
done();
3030
});
3131
});
@@ -40,7 +40,7 @@ describe('no mergeable selectors - sass', function () {
4040
lint.test(file, {
4141
'no-mergeable-selectors': 1
4242
}, function (data) {
43-
lint.assert.equal(20, data.warningCount);
43+
lint.assert.equal(21, data.warningCount);
4444
done();
4545
});
4646
});
@@ -57,7 +57,7 @@ describe('no mergeable selectors - sass', function () {
5757
}
5858
]
5959
}, function (data) {
60-
lint.assert.equal(19, data.warningCount);
60+
lint.assert.equal(20, data.warningCount);
6161
done();
6262
});
6363
});

tests/rules/shorthand-values.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('shorthand values - scss', function () {
1212
lint.test(file, {
1313
'shorthand-values': 1
1414
}, function (data) {
15-
lint.assert.equal(76, data.warningCount);
15+
lint.assert.equal(77, data.warningCount);
1616
done();
1717
});
1818
});
@@ -44,7 +44,7 @@ describe('shorthand values - scss', function () {
4444
}
4545
]
4646
}, function (data) {
47-
lint.assert.equal(38, data.warningCount);
47+
lint.assert.equal(39, data.warningCount);
4848
done();
4949
});
5050
});
@@ -60,7 +60,7 @@ describe('shorthand values - scss', function () {
6060
}
6161
]
6262
}, function (data) {
63-
lint.assert.equal(45, data.warningCount);
63+
lint.assert.equal(46, data.warningCount);
6464
done();
6565
});
6666
});
@@ -92,7 +92,7 @@ describe('shorthand values - scss', function () {
9292
}
9393
]
9494
}, function (data) {
95-
lint.assert.equal(57, data.warningCount);
95+
lint.assert.equal(58, data.warningCount);
9696
done();
9797
});
9898
});
@@ -109,7 +109,7 @@ describe('shorthand values - scss', function () {
109109
}
110110
]
111111
}, function (data) {
112-
lint.assert.equal(64, data.warningCount);
112+
lint.assert.equal(65, data.warningCount);
113113
done();
114114
});
115115
});
@@ -126,7 +126,7 @@ describe('shorthand values - scss', function () {
126126
}
127127
]
128128
}, function (data) {
129-
lint.assert.equal(57, data.warningCount);
129+
lint.assert.equal(58, data.warningCount);
130130
done();
131131
});
132132
});
@@ -144,7 +144,7 @@ describe('shorthand values - scss', function () {
144144
}
145145
]
146146
}, function (data) {
147-
lint.assert.equal(76, data.warningCount);
147+
lint.assert.equal(77, data.warningCount);
148148
done();
149149
});
150150
});
@@ -161,7 +161,7 @@ describe('shorthand values - sass', function () {
161161
lint.test(file, {
162162
'shorthand-values': 1
163163
}, function (data) {
164-
lint.assert.equal(76, data.warningCount);
164+
lint.assert.equal(77, data.warningCount);
165165
done();
166166
});
167167
});
@@ -193,7 +193,7 @@ describe('shorthand values - sass', function () {
193193
}
194194
]
195195
}, function (data) {
196-
lint.assert.equal(38, data.warningCount);
196+
lint.assert.equal(39, data.warningCount);
197197
done();
198198
});
199199
});
@@ -209,7 +209,7 @@ describe('shorthand values - sass', function () {
209209
}
210210
]
211211
}, function (data) {
212-
lint.assert.equal(45, data.warningCount);
212+
lint.assert.equal(46, data.warningCount);
213213
done();
214214
});
215215
});
@@ -241,7 +241,7 @@ describe('shorthand values - sass', function () {
241241
}
242242
]
243243
}, function (data) {
244-
lint.assert.equal(57, data.warningCount);
244+
lint.assert.equal(58, data.warningCount);
245245
done();
246246
});
247247
});
@@ -258,7 +258,7 @@ describe('shorthand values - sass', function () {
258258
}
259259
]
260260
}, function (data) {
261-
lint.assert.equal(64, data.warningCount);
261+
lint.assert.equal(65, data.warningCount);
262262
done();
263263
});
264264
});
@@ -275,7 +275,7 @@ describe('shorthand values - sass', function () {
275275
}
276276
]
277277
}, function (data) {
278-
lint.assert.equal(57, data.warningCount);
278+
lint.assert.equal(58, data.warningCount);
279279
done();
280280
});
281281
});
@@ -293,7 +293,7 @@ describe('shorthand values - sass', function () {
293293
}
294294
]
295295
}, function (data) {
296-
lint.assert.equal(76, data.warningCount);
296+
lint.assert.equal(77, data.warningCount);
297297
done();
298298
});
299299
});

tests/sass/no-mergeable-selectors.sass

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,20 @@ ul ~ p
179179
.bar
180180
content: ''
181181

182+
// Issue #834 - selectors/typeselectors not properly recognised
183+
.fake-field
184+
tbody
185+
tr:nth-child(even)
186+
background: lighten($theme-color-primary, 50%)
187+
tr:nth-child(odd)
188+
background: #FFFFFF
189+
190+
.not-test
191+
&:not(:first-child)
192+
border-left: none
193+
194+
&:not(:first-child)
195+
border-left: 2px
182196

183197
.bar
184198
@media (max-width: 40em) and (min-width: 20em) and (orientation: landscape)
@@ -237,15 +251,3 @@ ul ~ p
237251
// opacity: 1
238252
239253
// Issue #703 - Interpolation in selector - ignored in Sass syntax for now due to gonzales issue
240-
241-
.navigation
242-
@media #{$media-query-lg-up}
243-
.nav-item
244-
display: inline-block
245-
@media #{$media-query-md-down}
246-
// should not merge with the media query above
247-
.nav-item
248-
display: block
249-
// should merge with the ruleset directly above
250-
.nav-item
251-
color: $blue

0 commit comments

Comments
 (0)