Skip to content

Commit f998ec7

Browse files
authored
Merge pull request #948 from sasstools/release/1.10.2
Prepare 1.10.2
2 parents 5da0c04 + 1ecf34d commit f998ec7

File tree

6 files changed

+119
-16
lines changed

6 files changed

+119
-16
lines changed

CHANGELOG.md

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

3+
## v1.10.2
4+
5+
**November 9th, 2016**
6+
7+
**Changes**
8+
* Reverted back to ESlint v2.x to prevent a breaking change in Node < v4
9+
10+
**Fixes**
11+
* Fixed an exception for partial idents in `space-around-operator` [#940](https://github.com/sasstools/sass-lint/pull/940)
12+
* Fixed an issue with negative numbers in `space-around-operator` [#945](https://github.com/sasstools/sass-lint/pull/945)
13+
14+
315
## v1.10.1
416

517
**November 7th, 2016**
618

719
**Fixes**
820

9-
* Fixed an issue with the `--no-exit` `-q` flag not being respected and unhandled errors/exceptions being thrown by the CLI
21+
* Fixed an issue with the `--no-exit` `-q` flag not being respected and unhandled errors/exceptions being thrown by the CLI
1022
* Fixed an issue with variable declarations showing as properties in the `no-duplicate-properties` rule [#937](https://github.com/sasstools/sass-lint/pull/936)
1123
* Fixed an issue with variable declarations showing as properties in the `declarations-before-nesting` rule [#937](https://github.com/sasstools/sass-lint/pull/936)
1224

lib/rules/space-around-operator.js

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,27 @@ var isNegativeNumber = function (operator, next, previous, doublePrevious) {
3535

3636
// Catch the following:
3737
// $foo: -20;
38-
if (!previous && !next.is('space')) {
39-
return true;
38+
// $foo: -#{$foo}
39+
// $foo: -($foo * 2)
40+
// $foo: -$foo
41+
if (next) {
42+
if (!previous || (previous.is('space') && doublePrevious && !doublePrevious.is('number'))) {
43+
if (
44+
next.is('number') ||
45+
next.is('interpolation') ||
46+
next.is('variable') ||
47+
next.is('parentheses')
48+
) {
49+
return true;
50+
}
51+
}
4052
}
4153

4254
// Catch the following:
4355
// .foo {
4456
// property: -16px;
4557
// }
46-
if (next.is('dimension') || next.is('percentage')) {
58+
if (next && (next.is('dimension') || next.is('percentage'))) {
4759
return true;
4860
}
4961

@@ -106,7 +118,7 @@ var isUnicode = function (operator, previous) {
106118
// @font-face {
107119
// unicode-range: U+26;
108120
// }
109-
if (previous.is('ident') && previous.content === 'U') {
121+
if (previous && previous.is('ident') && previous.content === 'U') {
110122
return true;
111123
}
112124
}
@@ -124,7 +136,7 @@ var isUnicode = function (operator, previous) {
124136
var isImport = function (operator, parent) {
125137
if (operator === '/') {
126138

127-
if (parent.is('atrule') && parent.contains('atkeyword')) {
139+
if (parent && parent.is('atrule') && parent.contains('atkeyword')) {
128140
var keyword = parent.first('atkeyword');
129141

130142
if (keyword.contains('ident')) {
@@ -140,6 +152,21 @@ var isImport = function (operator, parent) {
140152
return false;
141153
};
142154

155+
/**
156+
* Determine if operator is part an ident
157+
*
158+
* @param {string} operator - The operator
159+
* @param {Object} next - The next node
160+
* @param {Object} previous - The previous node
161+
* @returns {bool} true / false
162+
*/
163+
var isPartialIdent = function (operator, next, previous) {
164+
if (operator === '-') {
165+
return next && previous && previous.is('interpolation');
166+
}
167+
return false;
168+
};
169+
143170
/**
144171
* Determine if operator is exception
145172
*
@@ -169,6 +196,10 @@ var isException = function (operator, parent, i) {
169196
return true;
170197
}
171198

199+
if (isPartialIdent(operator, next, previous)) {
200+
return true;
201+
}
202+
172203
return false;
173204
};
174205

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sass-lint",
3-
"version": "1.10.1",
3+
"version": "1.10.2",
44
"description": "All Node Sass linter!",
55
"main": "index.js",
66
"scripts": {
@@ -29,7 +29,7 @@
2929
"homepage": "https://github.com/sasstools/sass-lint",
3030
"dependencies": {
3131
"commander": "^2.8.1",
32-
"eslint": "^3.9.1",
32+
"eslint": "^2.7.0",
3333
"front-matter": "2.1.0",
3434
"fs-extra": "^1.0.0",
3535
"glob": "^7.0.0",

tests/rules/space-around-operator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('space around operator - scss', function () {
2626
}
2727
]
2828
}, function (data) {
29-
lint.assert.equal(92, data.warningCount);
29+
lint.assert.equal(94, data.warningCount);
3030
done();
3131
});
3232
});
@@ -56,7 +56,7 @@ describe('space around operator - sass', function () {
5656
}
5757
]
5858
}, function (data) {
59-
lint.assert.equal(86, data.warningCount);
59+
lint.assert.equal(88, data.warningCount);
6060
done();
6161
});
6262
});

tests/sass/space-around-operator.sass

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ $qux: (2 +1)
333333
334334
$foo: scale-color($foo, $lightness: -14%)
335335

336+
$foobar: #{$foo}-#{$bar}
337+
$foobar: #{$foo}-4
338+
336339
.foo
337340
top: -10px
338341

@@ -474,13 +477,36 @@ h1
474477
unicode-range: U+26
475478
unicode-range: U+0-7F
476479
unicode-range: U+0025-00FF
477-
// TODO: Wildcard currently causes gonzales to fail
478-
// unicode-range: U+4??;
479-
// unicode-range: U+0025-00FF, U+4??;
480+
unicode-range: U+4??
481+
unicode-range: U+0025-00FF, U+4??
480482

481483
// Negative numbers
482484
.foo
483485
bottom: $var / -2
484486

485487
// Imports
486488
@import bar/foo
489+
490+
@if -1
491+
$bar: 1
492+
493+
@if -$foo
494+
$bar: 1
495+
496+
@if -#{$foo}
497+
$bar: 1
498+
499+
@if -($foo * 2)
500+
$bar: 1
501+
502+
@for $i from 0 through -1
503+
$bar: 1
504+
505+
@for $i from 0 through -$foo
506+
$bar: 1
507+
508+
@for $i from 0 through -#{$foo}
509+
$bar: 1
510+
511+
@for $i from 0 through -($foo * 2)
512+
$bar: 1

tests/sass/space-around-operator.scss

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ $norf: (5 % 2);
345345

346346
$foo: scale-color($foo, $lightness: -14%);
347347

348+
$foobar: #{$foo}-#{$bar};
349+
$foobar: #{$foo}-4;
350+
348351
.foo {
349352
top: -10px;
350353
}
@@ -492,9 +495,8 @@ $norf: (5 % 2);
492495
unicode-range: U+26;
493496
unicode-range: U+0-7F;
494497
unicode-range: U+0025-00FF;
495-
// TODO: Wildcard currently causes gonzales to fail
496-
// unicode-range: U+4??;
497-
// unicode-range: U+0025-00FF, U+4??;
498+
unicode-range: U+4??;
499+
unicode-range: U+0025-00FF, U+4??;
498500
}
499501

500502
// Negative numbers
@@ -504,3 +506,35 @@ $norf: (5 % 2);
504506

505507
// Imports
506508
@import 'bar/foo';
509+
510+
@if -1 {
511+
$bar: 1;
512+
}
513+
514+
@if -$foo {
515+
$bar: 1;
516+
}
517+
518+
@if -#{$foo} {
519+
$bar: 1;
520+
}
521+
522+
@if -($foo * 2) {
523+
$bar: 1;
524+
}
525+
526+
@for $i from 0 through -1 {
527+
$bar: 1;
528+
}
529+
530+
@for $i from 0 through -$foo {
531+
$bar: 1;
532+
}
533+
534+
@for $i from 0 through -#{$foo} {
535+
$bar: 1;
536+
}
537+
538+
@for $i from 0 through -($foo * 2) {
539+
$bar: 1;
540+
}

0 commit comments

Comments
 (0)