stylelint-scss
Advanced tools
Comparing version 6.2.1 to 6.3.0
{ | ||
"name": "stylelint-scss", | ||
"description": "A collection of SCSS-specific rules for Stylelint", | ||
"version": "6.2.1", | ||
"version": "6.3.0", | ||
"author": "Krister Kari", | ||
@@ -16,3 +16,3 @@ "repository": "stylelint-scss/stylelint-scss", | ||
"dependencies": { | ||
"known-css-properties": "^0.29.0", | ||
"known-css-properties": "^0.30.0", | ||
"postcss-media-query-parser": "^0.2.3", | ||
@@ -31,3 +31,3 @@ "postcss-resolve-nested-selector": "^0.1.1", | ||
"lint-staged": "^14.0.1", | ||
"np": "^10.0.0", | ||
"np": "^10.0.5", | ||
"postcss": "^8.4.35", | ||
@@ -37,3 +37,3 @@ "postcss-less": "^6.0.0", | ||
"prettier": "^3.2.5", | ||
"stylelint": "^16.2.1" | ||
"stylelint": "^16.5.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "files": [ |
@@ -91,2 +91,3 @@ # stylelint-scss | ||
- [`at-mixin-named-arguments`](./src/rules/at-mixin-named-arguments/README.md): Require named parameters in at-mixin call rule. | ||
- [`at-mixin-no-risky-nesting-selector`](./src/rules/at-mixin-no-risky-nesting-selector/README.md): Disallow risky nesting selectors within a mixin. | ||
- [`at-mixin-parentheses-space-before`](./src/rules/at-mixin-parentheses-space-before/README.md): Require or disallow a space before `@mixin` parentheses (Autofixable). | ||
@@ -288,2 +289,3 @@ - [`at-mixin-pattern`](./src/rules/at-mixin-pattern/README.md): Specify a pattern for Sass/SCSS-like mixin names. | ||
<th align="center"><a href="https://github.com/evilebottnawi"><img alt="evilebottnawi" src="https://avatars.githubusercontent.com/u/23334705?v=4&s=80" width="80"></a></th> | ||
<th align="center"><a href="https://github.com/FloEdelmann"><img alt="FloEdelmann" src="https://avatars.githubusercontent.com/u/202916?v=4&s=80" width="80"></a></th> | ||
<th align="center"><a href="https://github.com/kevindew"><img alt="kevindew" src="https://avatars.githubusercontent.com/u/282717?v=4&s=80" width="80"></a></th> | ||
@@ -293,3 +295,2 @@ <th align="center"><a href="https://github.com/thibaudcolas"><img alt="thibaudcolas" src="https://avatars.githubusercontent.com/u/877585?v=4&s=80" width="80"></a></th> | ||
<th align="center"><a href="https://github.com/vseventer"><img alt="vseventer" src="https://avatars.githubusercontent.com/u/638323?v=4&s=80" width="80"></a></th> | ||
<th align="center"><a href="https://github.com/xboy2012"><img alt="xboy2012" src="https://avatars.githubusercontent.com/u/7540144?v=4&s=80" width="80"></a></th> | ||
</tr> | ||
@@ -299,2 +300,3 @@ </thead> | ||
<td align="center"><a href="https://github.com/evilebottnawi">evilebottnawi</a></td> | ||
<td align="center"><a href="https://github.com/FloEdelmann">FloEdelmann</a></td> | ||
<td align="center"><a href="https://github.com/kevindew">kevindew</a></td> | ||
@@ -304,3 +306,2 @@ <td align="center"><a href="https://github.com/thibaudcolas">thibaudcolas</a></td> | ||
<td align="center"><a href="https://github.com/vseventer">vseventer</a></td> | ||
<td align="center"><a href="https://github.com/xboy2012">xboy2012</a></td> | ||
</tr> | ||
@@ -311,4 +312,4 @@ </tbody></table> | ||
<tr> | ||
<th align="center"><a href="https://github.com/xboy2012"><img alt="xboy2012" src="https://avatars.githubusercontent.com/u/7540144?v=4&s=80" width="80"></a></th> | ||
<th align="center"><a href="https://github.com/chalkygames123"><img alt="chalkygames123" src="https://avatars.githubusercontent.com/u/5608239?v=4&s=80" width="80"></a></th> | ||
<th align="center"><a href="https://github.com/FloEdelmann"><img alt="FloEdelmann" src="https://avatars.githubusercontent.com/u/202916?v=4&s=80" width="80"></a></th> | ||
<th align="center"><a href="https://github.com/bjankord"><img alt="bjankord" src="https://avatars.githubusercontent.com/u/633148?v=4&s=80" width="80"></a></th> | ||
@@ -321,4 +322,4 @@ <th align="center"><a href="https://github.com/AndyOGo"><img alt="AndyOGo" src="https://avatars.githubusercontent.com/u/914443?v=4&s=80" width="80"></a></th> | ||
<tbody><tr> | ||
<td align="center"><a href="https://github.com/xboy2012">xboy2012</a></td> | ||
<td align="center"><a href="https://github.com/chalkygames123">chalkygames123</a></td> | ||
<td align="center"><a href="https://github.com/FloEdelmann">FloEdelmann</a></td> | ||
<td align="center"><a href="https://github.com/bjankord">bjankord</a></td> | ||
@@ -325,0 +326,0 @@ <td align="center"><a href="https://github.com/AndyOGo">AndyOGo</a></td> |
@@ -27,2 +27,3 @@ "use strict"; | ||
"at-mixin-pattern": require("./at-mixin-pattern"), | ||
"at-mixin-no-risky-nesting-selector": require("./at-mixin-no-risky-nesting-selector"), | ||
"at-rule-conditional-no-parentheses": require("./at-rule-conditional-no-parentheses"), | ||
@@ -29,0 +30,0 @@ "at-root-no-redundant": require("./at-root-no-redundant"), |
@@ -28,3 +28,3 @@ "use strict"; | ||
const mixins = {}; | ||
let mixins = {}; | ||
@@ -35,2 +35,11 @@ root.walkAtRules("mixin", atRule => { | ||
if (mixins[mixinName]) { | ||
const areInDifferentScopes = | ||
mixins[mixinName].parent !== atRule.parent && | ||
mixins[mixinName].parent.type !== "root" && | ||
atRule.parent.type !== "root"; | ||
if (areInDifferentScopes) { | ||
return; | ||
} | ||
utils.report({ | ||
@@ -43,6 +52,13 @@ message: messages.rejected(mixinName), | ||
}); | ||
// cleanup after reporting | ||
delete mixins[mixinName]; | ||
} | ||
mixins[mixinName] = true; | ||
mixins[mixinName] = { | ||
parent: atRule.parent | ||
}; | ||
}); | ||
// cleanup after walking mixins | ||
mixins = {}; | ||
}; | ||
@@ -49,0 +65,0 @@ } |
@@ -5,2 +5,3 @@ "use strict"; | ||
const { utils } = require("stylelint"); | ||
const getAtRuleParams = require("../../utils/getAtRuleParams"); | ||
const namespace = require("../../utils/namespace"); | ||
@@ -177,3 +178,11 @@ const ruleUrl = require("../../utils/ruleUrl"); | ||
root.walkDecls(decl => { | ||
valueParser(decl.value).walk(node => { | ||
checkValue(decl, decl.value); | ||
}); | ||
root.walkAtRules(atRule => { | ||
const params = getAtRuleParams(atRule); | ||
checkValue(atRule, params); | ||
}); | ||
function checkValue(parentNode, value) { | ||
valueParser(value).walk(node => { | ||
const cleanValue = node.value.replace(interpolationPrefix, ""); | ||
@@ -189,3 +198,3 @@ | ||
message: messages.rejected(cleanValue), | ||
node: decl, | ||
node: parentNode, | ||
word: cleanValue, | ||
@@ -197,3 +206,3 @@ result, | ||
}); | ||
}); | ||
} | ||
}; | ||
@@ -200,0 +209,0 @@ } |
@@ -28,2 +28,17 @@ "use strict"; | ||
function matchUnderscores(inputString) { | ||
return inputString.replaceAll("_", "-"); | ||
} | ||
function isWithinMixin(node) { | ||
let parent = node.parent; | ||
while (parent) { | ||
if (parent.type === "atrule" && parent.name === "mixin") { | ||
return true; | ||
} | ||
parent = parent.parent; | ||
} | ||
return false; | ||
} | ||
function rule(primaryOption) { | ||
@@ -64,3 +79,3 @@ return (root, result) => { | ||
if (!privateMembers.selectors.has(selector)) { | ||
privateMembers.selectors.set(selector, node); | ||
privateMembers.selectors.set(matchUnderscores(selector), node); | ||
} | ||
@@ -73,5 +88,6 @@ }); | ||
node.type === "decl" && | ||
(node.prop.startsWith("$-") || node.prop.startsWith("$_")); | ||
(node.prop.startsWith("$-") || node.prop.startsWith("$_")) && | ||
!isWithinMixin(node); | ||
if (isPrivateVariable) { | ||
privateMembers.variables.set(node.prop, node); | ||
privateMembers.variables.set(matchUnderscores(node.prop), node); | ||
} | ||
@@ -87,3 +103,3 @@ | ||
if (match.length < 2) return; | ||
privateMembers.functions.set(match[1], node); | ||
privateMembers.functions.set(matchUnderscores(match[1]), node); | ||
} | ||
@@ -99,3 +115,3 @@ | ||
privateMembers.mixins.set( | ||
match.length < 2 ? node.params : match[1], | ||
matchUnderscores(match.length < 2 ? node.params : match[1]), | ||
node | ||
@@ -112,2 +128,3 @@ ); | ||
valuePrivateMembers.forEach(privateMember => { | ||
privateMember = matchUnderscores(privateMember); | ||
if (privateMembers.mixins.get(privateMember) !== node) | ||
@@ -133,2 +150,3 @@ privateMembers.mixins.delete(privateMember); | ||
valuePrivateMembers.forEach(privateMember => { | ||
privateMember = matchUnderscores(privateMember); | ||
if (privateMembers.variables.get(privateMember) !== decls) | ||
@@ -143,6 +161,6 @@ privateMembers.variables.delete(privateMember); | ||
for (const types in privateMembers) { | ||
for (const [key, value] of privateMembers[types].entries()) { | ||
for (const [key, node] of privateMembers[types].entries()) { | ||
utils.report({ | ||
message: messages.expected(key), | ||
node: value, | ||
node, | ||
result, | ||
@@ -149,0 +167,0 @@ ruleName |
@@ -199,7 +199,8 @@ "use strict"; | ||
if (item.type === "atrule") { | ||
// @forward, @use and @at-root | ||
// @forward, @use, @at-root, and @scope | ||
if ( | ||
item.name === "forward" || | ||
item.name === "use" || | ||
item.name === "at-root" | ||
item.name === "at-root" || | ||
item.name === "scope" | ||
) { | ||
@@ -206,0 +207,0 @@ return; |
@@ -10,2 +10,3 @@ "use strict"; | ||
const ruleUrl = require("../../utils/ruleUrl"); | ||
const hasInterpolation = require("../../utils/hasInterpolation"); | ||
const properties = require("known-css-properties").all; | ||
@@ -71,2 +72,3 @@ | ||
prop.startsWith("--") || | ||
hasInterpolation(prop) || | ||
(!shouldCheckPrefixed && vendorPrefix(prop)) || | ||
@@ -73,0 +75,0 @@ optionsMatches(secondaryOptions, "ignoreProperties", prop) |
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
297230
121
8583
404
+ Addedknown-css-properties@0.30.0(transitive)
- Removedknown-css-properties@0.29.0(transitive)
Updatedknown-css-properties@^0.30.0