stylelint-scss
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -0,1 +1,10 @@ | ||
# 1.2.0 | ||
- Added: `partial-no-import` rule. | ||
- Added: `media-feature-value-dollar-variable` rule. | ||
- Added: `at-import-partial-extension-blacklist` rule. | ||
- Added: `at-import-partial-extension-whitelist` rule. | ||
- Deprecated: `at-import-no-partial-extension` rule. | ||
- Fixed: `dollar-variable-no-missing-interpolation` was throwing an error on older Node.js versions. | ||
# 1.1.1 | ||
@@ -2,0 +11,0 @@ |
@@ -26,2 +26,6 @@ "use strict"; | ||
result.warn("The 'at-import-no-partial-extension' rule has been deprecated, " + "and will be removed in '2.0'. Instead, use 'at-import-partial-extension-blacklist' or 'at-import-partial-extension-whitelist' rules.", { | ||
stylelintType: "deprecation" | ||
}); | ||
function checkPathForUnderscore(path, decl) { | ||
@@ -45,3 +49,3 @@ // Stripping trailing quotes and whitespaces, if any | ||
if (options.ignoreExtensions.some(function (ignoredExt) { | ||
// the extension matches on of the ignored strings or Regexps | ||
// the extension matches one of the ignored strings or Regexps | ||
return (0, _lodash.isString)(ignoredExt) && ignoredExt === extension || (0, _lodash.isRegExp)(ignoredExt) && extension.search(ignoredExt) !== -1; | ||
@@ -61,6 +65,6 @@ })) { | ||
root.walkAtRules("import", function (decl) { | ||
root.walkAtRules("import", function (atRule) { | ||
// Processing comma-separated lists of import paths | ||
decl.params.split(",").forEach(function (path) { | ||
checkPathForUnderscore(path, decl); | ||
atRule.params.split(",").forEach(function (path) { | ||
checkPathForUnderscore(path, atRule); | ||
}); | ||
@@ -67,0 +71,0 @@ }); |
@@ -24,3 +24,3 @@ "use strict"; | ||
if (!isSassVar(prop) || vars.includes(prop)) { | ||
if (!isSassVar(prop) || (0, _lodash.includes)(vars, prop)) { | ||
return; | ||
@@ -46,6 +46,6 @@ } | ||
if (isAtSupports(node) || isCustomIdentProp(node)) { | ||
return stringVars.includes(value); | ||
return (0, _lodash.includes)(stringVars, value); | ||
} | ||
if (isCustomIdentAtRule(node)) { | ||
return vars.includes(value); | ||
return (0, _lodash.includes)(vars, value); | ||
} | ||
@@ -95,2 +95,4 @@ return false; | ||
var _lodash = require("lodash"); | ||
var _stylelint = require("stylelint"); | ||
@@ -125,7 +127,7 @@ | ||
function isCustomIdentAtRule(node) { | ||
return isAtRule(node.type) && customIdentAtRules.includes(node.name); | ||
return isAtRule(node.type) && (0, _lodash.includes)(customIdentAtRules, node.name); | ||
} | ||
function isCustomIdentProp(node) { | ||
return customIdentProps.includes(node.prop); | ||
return (0, _lodash.includes)(customIdentProps, node.prop); | ||
} | ||
@@ -132,0 +134,0 @@ |
@@ -23,2 +23,10 @@ "use strict"; | ||
var _atImportPartialExtensionBlacklist = require("./at-import-partial-extension-blacklist"); | ||
var _atImportPartialExtensionBlacklist2 = _interopRequireDefault(_atImportPartialExtensionBlacklist); | ||
var _atImportPartialExtensionWhitelist = require("./at-import-partial-extension-whitelist"); | ||
var _atImportPartialExtensionWhitelist2 = _interopRequireDefault(_atImportPartialExtensionWhitelist); | ||
var _atMixinNoArgumentlessCallParentheses = require("./at-mixin-no-argumentless-call-parentheses"); | ||
@@ -40,2 +48,10 @@ | ||
var _mediaFeatureValueDollarVariable = require("./media-feature-value-dollar-variable"); | ||
var _mediaFeatureValueDollarVariable2 = _interopRequireDefault(_mediaFeatureValueDollarVariable); | ||
var _partialNoImport = require("./partial-no-import"); | ||
var _partialNoImport2 = _interopRequireDefault(_partialNoImport); | ||
var _percentPlaceholderPattern = require("./percent-placeholder-pattern"); | ||
@@ -56,2 +72,4 @@ | ||
"at-import-no-partial-leading-underscore": _atImportNoPartialLeadingUnderscore2.default, | ||
"at-import-partial-extension-blacklist": _atImportPartialExtensionBlacklist2.default, | ||
"at-import-partial-extension-whitelist": _atImportPartialExtensionWhitelist2.default, | ||
"at-mixin-no-argumentless-call-parentheses": _atMixinNoArgumentlessCallParentheses2.default, | ||
@@ -61,4 +79,6 @@ "at-mixin-pattern": _atMixinPattern2.default, | ||
"dollar-variable-pattern": _dollarVariablePattern2.default, | ||
"media-feature-value-dollar-variable": _mediaFeatureValueDollarVariable2.default, | ||
"percent-placeholder-pattern": _percentPlaceholderPattern2.default, | ||
"partial-no-import": _partialNoImport2.default, | ||
"selector-no-redundant-nesting-selector": _selectorNoRedundantNestingSelector2.default | ||
}; |
{ | ||
"name": "stylelint-scss", | ||
"description": "A collection of SCSS specific rules for stylelint", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"author": "Krister Kari", | ||
@@ -28,2 +28,3 @@ "babel": { | ||
"npmpub": "^3.0.3", | ||
"postcss": "^5.0.21", | ||
"postcss-scss": "^0.1.7", | ||
@@ -30,0 +31,0 @@ "replace": "^0.3.0", |
@@ -12,4 +12,4 @@ # at-extend-no-missing-placeholder | ||
@extend %bar | ||
// ↑ | ||
// This is a placeholder selector | ||
// ↑ | ||
// This is a placeholder selector | ||
} | ||
@@ -16,0 +16,0 @@ ``` |
@@ -26,2 +26,9 @@ import { isRegExp, isString } from "lodash" | ||
result.warn(( | ||
"The 'at-import-no-partial-extension' rule has been deprecated, " | ||
+ "and will be removed in '2.0'. Instead, use 'at-import-partial-extension-blacklist' or 'at-import-partial-extension-whitelist' rules." | ||
), { | ||
stylelintType: "deprecation", | ||
}) | ||
function checkPathForUnderscore(path, decl) { | ||
@@ -47,3 +54,3 @@ // Stripping trailing quotes and whitespaces, if any | ||
if (options.ignoreExtensions.some(ignoredExt => { | ||
// the extension matches on of the ignored strings or Regexps | ||
// the extension matches one of the ignored strings or Regexps | ||
return isString(ignoredExt) && ignoredExt === extension || | ||
@@ -62,6 +69,6 @@ isRegExp(ignoredExt) && extension.search(ignoredExt) !== -1 | ||
root.walkAtRules("import", decl => { | ||
root.walkAtRules("import", atRule => { | ||
// Processing comma-separated lists of import paths | ||
decl.params.split(",").forEach(path => { | ||
checkPathForUnderscore(path, decl) | ||
atRule.params.split(",").forEach(path => { | ||
checkPathForUnderscore(path, atRule) | ||
}) | ||
@@ -68,0 +75,0 @@ }) |
@@ -5,6 +5,8 @@ # at-import-no-partial-extension | ||
**Deprecated. Use [`at-import-partial-extension-blacklist`](/src/rules/at-import-partial-extension-blacklist/README.md) or [`at-import-partial-extension-whitelist`](/src/rules/at-import-partial-extension-whitelist/README.md) instead** | ||
```scss | ||
@import "path/to/file.scss" | ||
/** ↑ | ||
* Disallow this */ | ||
* Disallow this */ | ||
``` | ||
@@ -11,0 +13,0 @@ |
@@ -8,3 +8,3 @@ # at-import-no-partial-leading-underscore | ||
/** ↑ | ||
* Disallow this */ | ||
* Disallow this */ | ||
``` | ||
@@ -11,0 +11,0 @@ |
@@ -8,3 +8,3 @@ # at-mixin-no-argumentless-call-parentheses | ||
/** ↑ | ||
* Such mixin calls */ | ||
* Such mixin calls */ | ||
``` | ||
@@ -11,0 +11,0 @@ |
@@ -0,1 +1,2 @@ | ||
import { includes } from "lodash" | ||
import { utils } from "stylelint" | ||
@@ -33,7 +34,7 @@ import { namespace } from "../../utils" | ||
function isCustomIdentAtRule(node) { | ||
return isAtRule(node.type) && customIdentAtRules.includes(node.name) | ||
return isAtRule(node.type) && includes(customIdentAtRules, node.name) | ||
} | ||
function isCustomIdentProp(node) { | ||
return customIdentProps.includes(node.prop) | ||
return includes(customIdentProps, node.prop) | ||
} | ||
@@ -69,3 +70,3 @@ | ||
if (!isSassVar(prop) || vars.includes(prop)) { | ||
if (!isSassVar(prop) || includes(vars, prop)) { | ||
return | ||
@@ -89,6 +90,6 @@ } | ||
if (isAtSupports(node) || isCustomIdentProp(node)) { | ||
return stringVars.includes(value) | ||
return includes(stringVars, value) | ||
} | ||
if (isCustomIdentAtRule(node)) { | ||
return vars.includes(value) | ||
return includes(vars, value) | ||
} | ||
@@ -95,0 +96,0 @@ return false |
@@ -9,5 +9,5 @@ # dollar-variable-no-missing-interpolation | ||
animation-name: $var; | ||
// ↑ | ||
// This variable needs to be interpolated | ||
// because its value is a string | ||
// ↑ | ||
// This variable needs to be interpolated | ||
// because its value is a string | ||
} | ||
@@ -14,0 +14,0 @@ ``` |
@@ -5,2 +5,4 @@ import atExtendNoMissingPlaceholder from "./at-extend-no-missing-placeholder" | ||
import atImportNoPartialLeadingUnderscore from "./at-import-no-partial-leading-underscore" | ||
import atImportPartialExtensionBlacklist from "./at-import-partial-extension-blacklist" | ||
import atImportPartialExtensionWhitelist from "./at-import-partial-extension-whitelist" | ||
import atMixinNoArgumentlessCallParentheses from "./at-mixin-no-argumentless-call-parentheses" | ||
@@ -10,2 +12,4 @@ import atMixinPattern from "./at-mixin-pattern" | ||
import dollarVariablePattern from "./dollar-variable-pattern" | ||
import mediaFeatureValueDollarVariable from "./media-feature-value-dollar-variable" | ||
import partialNoImport from "./partial-no-import" | ||
import percentPlaceholderPattern from "./percent-placeholder-pattern" | ||
@@ -19,2 +23,4 @@ import selectorNoRedundantNestingSelector from "./selector-no-redundant-nesting-selector" | ||
"at-import-no-partial-leading-underscore": atImportNoPartialLeadingUnderscore, | ||
"at-import-partial-extension-blacklist": atImportPartialExtensionBlacklist, | ||
"at-import-partial-extension-whitelist": atImportPartialExtensionWhitelist, | ||
"at-mixin-no-argumentless-call-parentheses": atMixinNoArgumentlessCallParentheses, | ||
@@ -24,4 +30,6 @@ "at-mixin-pattern": atMixinPattern, | ||
"dollar-variable-pattern": dollarVariablePattern, | ||
"media-feature-value-dollar-variable": mediaFeatureValueDollarVariable, | ||
"percent-placeholder-pattern": percentPlaceholderPattern, | ||
"partial-no-import": partialNoImport, | ||
"selector-no-redundant-nesting-selector": selectorNoRedundantNestingSelector, | ||
} |
@@ -6,5 +6,5 @@ # percent-placeholder-pattern | ||
```scss | ||
%foobar { display: flex; } | ||
/** ↑ | ||
* The pattern of this */ | ||
%foobar { display: flex; } | ||
/** ↑ | ||
* The pattern of this */ | ||
``` | ||
@@ -11,0 +11,0 @@ |
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
82879
61
1663
14