Socket
Socket
Sign inDemoInstall

stylelint-scss

Package Overview
Dependencies
Maintainers
3
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylelint-scss - npm Package Compare versions

Comparing version 5.3.1 to 5.3.2

10

package.json
{
"name": "stylelint-scss",
"description": "A collection of SCSS-specific rules for Stylelint",
"version": "5.3.1",
"version": "5.3.2",
"author": "Krister Kari",

@@ -20,3 +20,3 @@ "repository": "stylelint-scss/stylelint-scss",

"devDependencies": {
"eslint": "^8.52.0",
"eslint": "^8.54.0",
"github-contributors-list": "^1.2.5",

@@ -27,8 +27,8 @@ "husky": "^8.0.3",

"lint-staged": "^14.0.1",
"np": "^8.0.4",
"np": "^9.0.0",
"postcss": "^8.4.31",
"postcss-less": "^6.0.0",
"postcss-scss": "^4.0.9",
"prettier": "^3.0.3",
"stylelint": "^15.7.0"
"prettier": "^3.1.0",
"stylelint": "^15.11.0"
},

@@ -35,0 +35,0 @@ "files": [

@@ -42,5 +42,4 @@ "use strict";

node.params
.replace(/#{.*}/g, "")
.split(",")
.every(param => param.includes("&")) ||
.every(elem => elem.replace(/#{.*}/g, "").includes("&")) ||
isWithinKeyframes(node)

@@ -47,0 +46,0 @@ ) {

@@ -26,5 +26,5 @@ "use strict";

function isNamespacedFunction(fn) {
const namespacedFunc = /^\w+\.\w+$/;
return namespacedFunc.test(fn);
function extractNamespaceFromFunction(fn) {
const matched = fn.match(/^(\w+)\.\w+$/);
return matched ? matched[1] : undefined;
}

@@ -82,2 +82,10 @@

const atUseNamespaces = new Set();
root.walkAtRules(/^use$/i, atRule => {
const { nodes } = valueParser(atRule.params);
atUseNamespaces.add(getAtUseNamespace(nodes));
});
const namespaceWarnings = new Set();
utils.checkAgainstRule(

@@ -90,40 +98,56 @@ {

warning => {
const { node, index } = warning;
const { node: decl } = warning;
// NOTE: Using `valueParser` is necessary for extracting a function name. This may be a performance waste.
valueParser(node.value).walk(valueNode => {
valueParser(decl.value).walk(valueNode => {
const { type, value: funcName } = valueNode;
if (type !== "function" || funcName.trim() === "") {
return;
}
if (type !== "function" || funcName.trim() === "") return;
if (isNamespacedFunction(funcName)) {
const atUseNamespaces = [];
// TODO: For backward compatibility with Stylelint 15.7.0 or less.
// We can remove this code when dropping support for old version.
const namespace = extractNamespaceFromFunction(funcName);
if (namespace && atUseNamespaces.has(namespace)) return;
root.walkAtRules(/^use$/i, atRule => {
const { nodes } = valueParser(atRule.params);
atUseNamespaces.push(getAtUseNamespace(nodes));
});
if (ignoreFunctionsAsSet.has(funcName)) return;
if (atUseNamespaces.length) {
const [namespace] = funcName.split(".");
if (atUseNamespaces.includes(namespace)) {
return;
}
}
}
utils.report({
message: messages.rejected(funcName),
ruleName,
result,
node: decl,
word: funcName
});
if (!ignoreFunctionsAsSet.has(funcName)) {
utils.report({
message: messages.rejected(funcName),
ruleName,
result,
node,
index
});
}
namespaceWarnings.add(warning);
});
}
);
// NOTE: Since Stylelint 15.8.0, the built-in `function-no-unknown` rule has ignored SCSS functions with namespace.
// See https://github.com/stylelint/stylelint/releases/tag/15.8.0
// See https://github.com/stylelint/stylelint/pull/6921
if (namespaceWarnings.size === 0) {
root.walkDecls(decl => {
valueParser(decl.value).walk(valueNode => {
const { type, value: funcName } = valueNode;
if (type !== "function" || funcName.trim() === "") return;
const namespace = extractNamespaceFromFunction(funcName);
if (!namespace) return;
if (atUseNamespaces.has(namespace)) return;
if (ignoreFunctionsAsSet.has(funcName)) return;
utils.report({
message: messages.rejected(funcName),
ruleName,
result,
node: decl,
word: funcName
});
});
});
}
};

@@ -130,0 +154,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc