stylelint-scss
Advanced tools
Comparing version 3.17.2 to 3.18.0
@@ -0,1 +1,6 @@ | ||
# 3.18.0 | ||
- Added: `selector-no-redundant-nesting-selector` add `ignoreKeywords` option to ignore certain keywords that can be used in [Less](http://lesscss.org) or some other non-Scss syntax. | ||
- Fixed: `comment-no-loud` fix a bug where the rule was only checking for comments that were in the beginning of the file. | ||
# 3.17.2 | ||
@@ -2,0 +7,0 @@ |
@@ -46,3 +46,5 @@ "use strict"; | ||
var regex = new RegExp(/^[ \t\n]*\/\*/); | ||
return regex.test(comment.source.input.css); | ||
var splitComment = comment.source.input.css.split("\n"); | ||
var commentFirstLine = splitComment[comment.source.start.line - 1]; | ||
return regex.test(commentFirstLine); | ||
} | ||
@@ -49,0 +51,0 @@ |
@@ -11,4 +11,10 @@ "use strict"; | ||
var _optionsMatches = _interopRequireDefault(require("stylelint/lib/utils/optionsMatches")); | ||
var _lodash = require("lodash"); | ||
var _utils = require("../../utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var ruleName = (0, _utils.namespace)("selector-no-redundant-nesting-selector"); | ||
@@ -23,6 +29,12 @@ exports.ruleName = ruleName; | ||
function _default(actual) { | ||
function _default(actual, options) { | ||
return function (root, result) { | ||
var validOptions = _stylelint.utils.validateOptions(result, ruleName, { | ||
actual: actual | ||
}, { | ||
actual: options, | ||
possible: { | ||
ignoreKeywords: [_lodash.isString, _lodash.isRegExp] | ||
}, | ||
optional: true | ||
}); | ||
@@ -40,3 +52,3 @@ | ||
if (prev) { | ||
if (prev || (0, _utils.hasNestedSibling)(node)) { | ||
return; | ||
@@ -57,3 +69,3 @@ } | ||
if (nextNext && (nextNext.type === "combinator" || nextNext.type === "nesting")) { | ||
if ((0, _utils.isType)(nextNext, "tag") && (0, _optionsMatches["default"])(options, "ignoreKeywords", nextNext.value.trim()) || (0, _utils.isType)(nextNext, "combinator")) { | ||
return; | ||
@@ -60,0 +72,0 @@ } |
@@ -174,2 +174,14 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "hasNestedSibling", { | ||
enumerable: true, | ||
get: function get() { | ||
return _hasNestedSibling["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "isType", { | ||
enumerable: true, | ||
get: function get() { | ||
return _isType["default"]; | ||
} | ||
}); | ||
@@ -232,2 +244,6 @@ var _addEmptyLineBefore = require("./addEmptyLineBefore"); | ||
var _hasNestedSibling = _interopRequireDefault(require("./hasNestedSibling")); | ||
var _isType = _interopRequireDefault(require("./isType")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } |
{ | ||
"name": "stylelint-scss", | ||
"description": "A collection of SCSS specific rules for stylelint", | ||
"version": "3.17.2", | ||
"version": "3.18.0", | ||
"author": "Krister Kari", | ||
@@ -6,0 +6,0 @@ "babel": { |
@@ -62,1 +62,55 @@ # selector-no-redundant-nesting-selector | ||
``` | ||
## Options | ||
`ignoreKeywords`: `["/regex/", /regex/, "string"]` | ||
if you are using Less or some other non-SCSS syntax, the warnings can be disabled by using `ignoreKeywords` option. | ||
For example, you need to ignore the `when` keyword in `less`: | ||
```js | ||
{ | ||
rules: { | ||
'scss/selector-no-redundant-nesting-selector', [true, { ignoreKeywords: ['when'] }], | ||
}, | ||
} | ||
``` | ||
The following patterns are *not* considered warnings: | ||
```less | ||
@theme: ~'dark'; | ||
p { | ||
& when (@theme = dark) { | ||
color: #000; | ||
} | ||
& when not(@theme = dark) { | ||
color: #fff; | ||
} | ||
} | ||
``` | ||
Conversely, if you do not use the `ignoreKeywords` option: | ||
```js | ||
{ | ||
rules: { | ||
'scss/selector-no-redundant-nesting-selector', true, | ||
}, | ||
} | ||
``` | ||
The following patterns are considered warnings: | ||
```less | ||
@theme: ~'dark'; | ||
p { | ||
& when (@theme = dark) { | ||
color: #000; | ||
} | ||
& when not(@theme = dark) { | ||
color: #fff; | ||
} | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
359469
160
6340