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 6.1.0 to 6.2.0

src/rules/at-import-partial-extension-allowed-list/index.js

14

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

@@ -24,14 +24,14 @@ "repository": "stylelint-scss/stylelint-scss",

"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"github-contributors-list": "^1.2.5",
"husky": "^8.0.3",
"husky": "^9.0.11",
"jest": "^29.7.0",
"jest-preset-stylelint": "^7.0.0",
"lint-staged": "^14.0.1",
"np": "^9.2.0",
"postcss": "^8.4.31",
"np": "^10.0.0",
"postcss": "^8.4.35",
"postcss-less": "^6.0.0",
"postcss-scss": "^4.0.9",
"prettier": "^3.2.4",
"stylelint": "^16.2.0"
"prettier": "^3.2.5",
"stylelint": "^16.2.1"
},

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

@@ -84,4 +84,4 @@ # stylelint-scss

- [`at-import-partial-extension`](./src/rules/at-import-partial-extension/README.md): Require or disallow extension in `@import` commands (Autofixable).
- [`at-import-partial-extension-blacklist`](./src/rules/at-import-partial-extension-blacklist/README.md): Specify a blacklist of disallowed file extensions for partial names in `@import` commands.
- [`at-import-partial-extension-whitelist`](./src/rules/at-import-partial-extension-whitelist/README.md): Specify a whitelist of allowed file extensions for partial names in `@import` commands.
- [`at-import-partial-extension-allowed-list`](./src/rules/at-import-partial-extension-allowed-list/README.md): Specify a list of allowed file extensions for partial names in `@import` commands.
- [`at-import-partial-extension-disallowed-list`](./src/rules/at-import-partial-extension-disallowed-list/README.md): Specify a list of disallowed file extensions for partial names in `@import` commands.

@@ -200,2 +200,4 @@ ### `@`-mixin

- [`at-import-no-partial-leading-underscore`](https://github.com/stylelint-scss/stylelint-scss/blob/v5.2.1/src/rules/at-import-no-partial-leading-underscore/README.md): Disallow leading underscore in partial names in `@import`.
- [`at-import-partial-extension-blacklist`](https://github.com/stylelint-scss/stylelint-scss/blob/v6.1.0/src/rules/at-import-partial-extension-blacklist/README.md): Specify a blacklist of disallowed file extensions for partial names in `@import` commands.
- [`at-import-partial-extension-whitelist`](https://github.com/stylelint-scss/stylelint-scss/blob/v6.1.0/src/rules/at-import-partial-extension-whitelist/README.md): Specify a whitelist of allowed file extensions for partial names in `@import` commands.

@@ -246,4 +248,4 @@ ## Help out

<tr>
<th align="center"><a href="https://github.com/pamelalozano16"><img alt="pamelalozano16" src="https://avatars.githubusercontent.com/u/30474787?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/joseph118"><img alt="joseph118" src="https://avatars.githubusercontent.com/u/6863655?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/pamelalozano16"><img alt="pamelalozano16" src="https://avatars.githubusercontent.com/u/30474787?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/stof"><img alt="stof" src="https://avatars.githubusercontent.com/u/439401?v=4&s=80" width="80"></a></th>

@@ -256,4 +258,4 @@ <th align="center"><a href="https://github.com/niksy"><img alt="niksy" src="https://avatars.githubusercontent.com/u/389286?v=4&s=80" width="80"></a></th>

<tbody><tr>
<td align="center"><a href="https://github.com/pamelalozano16">pamelalozano16</a></td>
<td align="center"><a href="https://github.com/joseph118">joseph118</a></td>
<td align="center"><a href="https://github.com/pamelalozano16">pamelalozano16</a></td>
<td align="center"><a href="https://github.com/stof">stof</a></td>

@@ -288,2 +290,3 @@ <td align="center"><a href="https://github.com/niksy">niksy</a></td>

<tr>
<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/kevindew"><img alt="kevindew" src="https://avatars.githubusercontent.com/u/282717?v=4&s=80" width="80"></a></th>

@@ -294,6 +297,6 @@ <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/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>
</tr>
</thead>
<tbody><tr>
<td align="center"><a href="https://github.com/evilebottnawi">evilebottnawi</a></td>
<td align="center"><a href="https://github.com/kevindew">kevindew</a></td>

@@ -304,3 +307,2 @@ <td align="center"><a href="https://github.com/thibaudcolas">thibaudcolas</a></td>

<td align="center"><a href="https://github.com/xboy2012">xboy2012</a></td>
<td align="center"><a href="https://github.com/chalkygames123">chalkygames123</a></td>
</tr>

@@ -311,2 +313,3 @@ </tbody></table>

<tr>
<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>

@@ -317,6 +320,6 @@ <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>

<th align="center"><a href="https://github.com/freezy-sk"><img alt="freezy-sk" src="https://avatars.githubusercontent.com/u/661637?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/YodaDaCoda"><img alt="YodaDaCoda" src="https://avatars.githubusercontent.com/u/365349?v=4&s=80" width="80"></a></th>
</tr>
</thead>
<tbody><tr>
<td align="center"><a href="https://github.com/chalkygames123">chalkygames123</a></td>
<td align="center"><a href="https://github.com/FloEdelmann">FloEdelmann</a></td>

@@ -327,3 +330,2 @@ <td align="center"><a href="https://github.com/bjankord">bjankord</a></td>

<td align="center"><a href="https://github.com/freezy-sk">freezy-sk</a></td>
<td align="center"><a href="https://github.com/YodaDaCoda">YodaDaCoda</a></td>
</tr>

@@ -334,2 +336,3 @@ </tbody></table>

<tr>
<th align="center"><a href="https://github.com/YodaDaCoda"><img alt="YodaDaCoda" src="https://avatars.githubusercontent.com/u/365349?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/wlewis-formative"><img alt="wlewis-formative" src="https://avatars.githubusercontent.com/u/91909230?v=4&s=80" width="80"></a></th>

@@ -340,6 +343,6 @@ <th align="center"><a href="https://github.com/kersh"><img alt="kersh" src="https://avatars.githubusercontent.com/u/621330?v=4&s=80" width="80"></a></th>

<th align="center"><a href="https://github.com/sajadtorkamani"><img alt="sajadtorkamani" src="https://avatars.githubusercontent.com/u/9380313?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/paulgv"><img alt="paulgv" src="https://avatars.githubusercontent.com/u/4895885?v=4&s=80" width="80"></a></th>
</tr>
</thead>
<tbody><tr>
<td align="center"><a href="https://github.com/YodaDaCoda">YodaDaCoda</a></td>
<td align="center"><a href="https://github.com/wlewis-formative">wlewis-formative</a></td>

@@ -350,3 +353,2 @@ <td align="center"><a href="https://github.com/kersh">kersh</a></td>

<td align="center"><a href="https://github.com/sajadtorkamani">sajadtorkamani</a></td>
<td align="center"><a href="https://github.com/paulgv">paulgv</a></td>
</tr>

@@ -357,2 +359,4 @@ </tbody></table>

<tr>
<th align="center"><a href="https://github.com/paulgv"><img alt="paulgv" src="https://avatars.githubusercontent.com/u/4895885?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/01taylop"><img alt="01taylop" src="https://avatars.githubusercontent.com/u/727360?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/nlydv"><img alt="nlydv" src="https://avatars.githubusercontent.com/u/39429628?v=4&s=80" width="80"></a></th>

@@ -362,7 +366,7 @@ <th align="center"><a href="https://github.com/manovotny"><img alt="manovotny" src="https://avatars.githubusercontent.com/u/446260?v=4&s=80" width="80"></a></th>

<th align="center"><a href="https://github.com/stormwarning"><img alt="stormwarning" src="https://avatars.githubusercontent.com/u/999825?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/jantimon"><img alt="jantimon" src="https://avatars.githubusercontent.com/u/4113649?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/guoyunhe"><img alt="guoyunhe" src="https://avatars.githubusercontent.com/u/5836790?v=4&s=80" width="80"></a></th>
</tr>
</thead>
<tbody><tr>
<td align="center"><a href="https://github.com/paulgv">paulgv</a></td>
<td align="center"><a href="https://github.com/01taylop">01taylop</a></td>
<td align="center"><a href="https://github.com/nlydv">nlydv</a></td>

@@ -372,4 +376,2 @@ <td align="center"><a href="https://github.com/manovotny">manovotny</a></td>

<td align="center"><a href="https://github.com/stormwarning">stormwarning</a></td>
<td align="center"><a href="https://github.com/jantimon">jantimon</a></td>
<td align="center"><a href="https://github.com/guoyunhe">guoyunhe</a></td>
</tr>

@@ -380,2 +382,4 @@ </tbody></table>

<tr>
<th align="center"><a href="https://github.com/jantimon"><img alt="jantimon" src="https://avatars.githubusercontent.com/u/4113649?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/guoyunhe"><img alt="guoyunhe" src="https://avatars.githubusercontent.com/u/5836790?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/G-Rath"><img alt="G-Rath" src="https://avatars.githubusercontent.com/u/3151613?v=4&s=80" width="80"></a></th>

@@ -385,7 +389,7 @@ <th align="center"><a href="https://github.com/EvanHahn"><img alt="EvanHahn" src="https://avatars.githubusercontent.com/u/777712?v=4&s=80" width="80"></a></th>

<th align="center"><a href="https://github.com/diego-codes"><img alt="diego-codes" src="https://avatars.githubusercontent.com/u/5973294?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/Deimos"><img alt="Deimos" src="https://avatars.githubusercontent.com/u/9033?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/Calme1709"><img alt="Calme1709" src="https://avatars.githubusercontent.com/u/30140939?v=4&s=80" width="80"></a></th>
</tr>
</thead>
<tbody><tr>
<td align="center"><a href="https://github.com/jantimon">jantimon</a></td>
<td align="center"><a href="https://github.com/guoyunhe">guoyunhe</a></td>
<td align="center"><a href="https://github.com/G-Rath">G-Rath</a></td>

@@ -395,4 +399,2 @@ <td align="center"><a href="https://github.com/EvanHahn">EvanHahn</a></td>

<td align="center"><a href="https://github.com/diego-codes">diego-codes</a></td>
<td align="center"><a href="https://github.com/Deimos">Deimos</a></td>
<td align="center"><a href="https://github.com/Calme1709">Calme1709</a></td>
</tr>

@@ -403,2 +405,4 @@ </tbody></table>

<tr>
<th align="center"><a href="https://github.com/Deimos"><img alt="Deimos" src="https://avatars.githubusercontent.com/u/9033?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/Calme1709"><img alt="Calme1709" src="https://avatars.githubusercontent.com/u/30140939?v=4&s=80" width="80"></a></th>
<th align="center"><a href="https://github.com/SterlingVix"><img alt="SterlingVix" src="https://avatars.githubusercontent.com/u/7531113?v=4&s=80" width="80"></a></th>

@@ -408,2 +412,4 @@ </tr>

<tbody><tr>
<td align="center"><a href="https://github.com/Deimos">Deimos</a></td>
<td align="center"><a href="https://github.com/Calme1709">Calme1709</a></td>
<td align="center"><a href="https://github.com/SterlingVix">SterlingVix</a></td>

@@ -410,0 +416,0 @@ </tr>

@@ -72,6 +72,8 @@ "use strict";

options.ignoreFunctions.some(f => {
const interpolationRegex = /^#{/;
const funcName = node.value.replace(interpolationRegex, "");
const isRegex = /^\/.*\//.test(f);
if (!isRegex) {
return f === node.value;
return f === funcName;
}

@@ -81,3 +83,3 @@

return new RegExp(parts[1], parts[2] || "").test(node.value);
return new RegExp(parts[1], parts[2] || "").test(funcName);
});

@@ -84,0 +86,0 @@

@@ -28,3 +28,3 @@ "use strict";

"'at-import-no-partial-leading-underscore' has been deprecated, " +
"and will be removed in '6.0'. Use 'load-no-partial-leading-underscore' instead.",
"and will be removed in '7.0'. Use 'load-no-partial-leading-underscore' instead.",
{

@@ -31,0 +31,0 @@ stylelintType: "deprecation",

@@ -16,3 +16,4 @@ "use strict";

const meta = {
url: ruleUrl(ruleName)
url: ruleUrl(ruleName),
deprecated: true
};

@@ -33,2 +34,12 @@

result.warn(
"'at-import-partial-extension-blacklist' has been deprecated, " +
"and will be removed in '7.0'. Use 'at-import-partial-extension-disallowed-list' instead.",
{
stylelintType: "deprecation",
stylelintReference:
"https://github.com/stylelint-scss/stylelint-scss/blob/v6.1.0/src/rules/at-import-partial-extension-blacklist/README.md"
}
);
function checkPathForUnderscore(path, decl) {

@@ -35,0 +46,0 @@ // Stripping trailing quotes and whitespaces, if any

@@ -16,3 +16,4 @@ "use strict";

const meta = {
url: ruleUrl(ruleName)
url: ruleUrl(ruleName),
deprecated: true
};

@@ -33,2 +34,12 @@

result.warn(
"'at-import-partial-extension-whitelist' has been deprecated, " +
"and will be removed in '7.0'. Use 'at-import-partial-extension-allowed-list' instead.",
{
stylelintType: "deprecation",
stylelintReference:
"https://github.com/stylelint-scss/stylelint-scss/blob/v6.1.0/src/rules/at-import-partial-extension-whitelist/README.md"
}
);
function checkPathForUnderscore(path, decl) {

@@ -35,0 +46,0 @@ // Stripping trailing quotes and whitespaces, if any

@@ -36,2 +36,6 @@ "use strict";

if (atrule.name !== "else") {
atrule.raws.afterName = "";
}
atrule.params = [...new Set(groups)].join(" ");

@@ -38,0 +42,0 @@ }

@@ -9,2 +9,3 @@ "use strict";

const ruleUrl = require("../../utils/ruleUrl");
const hasInterpolation = require("../../utils/hasInterpolation");

@@ -127,8 +128,13 @@ const ruleToCheckAgainst = "function-no-unknown";

valueParser(decl.value).walk(valueNode => {
const { type, value: funcName } = valueNode;
const { type, value } = valueNode;
if (type !== "function" || funcName.trim() === "") return;
if (type !== "function" || value.trim() === "") return;
const interpolationRegex = /^#{/;
const funcName = value.replace(interpolationRegex, "");
const namespace = extractNamespaceFromFunction(funcName);
if (!namespace) return;
if (!namespace && !hasInterpolation(decl.value)) return;
if (atUseNamespaces.has(namespace)) return;

@@ -135,0 +141,0 @@

@@ -18,3 +18,5 @@ "use strict";

"load-no-partial-leading-underscore": require("./load-no-partial-leading-underscore"),
"at-import-partial-extension-allowed-list": require("./at-import-partial-extension-allowed-list"),
"at-import-partial-extension-blacklist": require("./at-import-partial-extension-blacklist"),
"at-import-partial-extension-disallowed-list": require("./at-import-partial-extension-disallowed-list"),
"at-import-partial-extension-whitelist": require("./at-import-partial-extension-whitelist"),

@@ -21,0 +23,0 @@ "at-import-partial-extension": require("./at-import-partial-extension"),

@@ -19,6 +19,11 @@ "use strict";

function extractFunctionName(inputString) {
const matches = inputString.matchAll(/(?:\s*([\w$]+)\s*)?\(/g);
return [...matches].flat();
const matches = [...inputString.matchAll(/(?:\s*([\w\-$]+)\s*)?\(/g)].flat();
return matches;
}
function getPrivateMembers(inputString) {
const matches = inputString.match(/([$%]*[-_]+[\w\d-_]+)/g);
return matches;
}
function rule(primaryOption) {

@@ -41,6 +46,8 @@ return (root, result) => {

// Skip for files using @import.
let hasImport = false;
root.walkAtRules("import", () => (hasImport = true));
if (hasImport) return;
root.walk(node => {
// Skip for files using @import
if (node.type === "atrule" && node.name === "import") return;
// Private placeholder selectors

@@ -88,25 +95,41 @@ const isPrivatePlaceholderSelector =

if (isPrivateMixin) {
privateMembers.mixins.set(node.params, node);
const match = extractFunctionName(node.params);
privateMembers.mixins.set(
match.length < 2 ? node.params : match[1],
node
);
}
});
root.walkAtRules(node => {
if (node.name === "extend" && privateMembers.selectors.has(node.params)) {
privateMembers.selectors.delete(node.params);
root.walk(node => {
if (node.type === "atrule" || node.type === "rule") {
const value = node.type === "rule" ? node.selector : node.params;
const valuePrivateMembers = getPrivateMembers(value);
if (valuePrivateMembers) {
valuePrivateMembers.forEach(privateMember => {
if (privateMembers.mixins.get(privateMember) !== node)
privateMembers.mixins.delete(privateMember);
if (
privateMembers.selectors.get(privateMember) !== node &&
node.type === "atrule"
)
privateMembers.selectors.delete(privateMember);
if (privateMembers.variables.get(privateMember) !== node)
privateMembers.variables.delete(privateMember);
if (privateMembers.functions.get(privateMember) !== node)
privateMembers.functions.delete(privateMember);
});
}
}
if (node.name === "include" && privateMembers.mixins.has(node.params)) {
privateMembers.mixins.delete(node.params);
}
});
root.walkDecls(decls => {
const hasFunctions = extractFunctionName(decls.value);
hasFunctions.forEach(func => {
if (privateMembers.functions.has(func)) {
privateMembers.functions.delete(func);
}
});
if (privateMembers.variables.has(decls.value)) {
privateMembers.variables.delete(decls.value);
const valuePrivateMembers = getPrivateMembers(decls.value);
if (valuePrivateMembers) {
valuePrivateMembers.forEach(privateMember => {
if (privateMembers.variables.get(privateMember) !== decls)
privateMembers.variables.delete(privateMember);
if (privateMembers.functions.get(privateMember) !== decls)
privateMembers.functions.delete(privateMember);
});
}

@@ -113,0 +136,0 @@ });

@@ -163,3 +163,3 @@ "use strict";

const dataURIRegex = /^url\(\s*['"]?data:.+['"]?\s*\)/;
const dataURIRegex = /url\(\s*['"]?data:.+['"]?\s*\)/;

@@ -166,0 +166,0 @@ root.walk(item => {

@@ -10,3 +10,3 @@ "use strict";

module.exports = function (string) {
return /@{.+?}/.test(string);
return /@{[\s\S]*?}/.test(string);
};

@@ -9,3 +9,3 @@ "use strict";

module.exports = function (string) {
return /\$\(.+?\)/.test(string);
return /\$\([\s\S]*?\)/.test(string);
};

@@ -9,3 +9,3 @@ "use strict";

module.exports = function (string) {
return /#{.+?}/.test(string);
return /#{[\s\S]*?}/.test(string);
};

@@ -388,7 +388,11 @@ "use strict";

if (
isInsideFunctionCall_.is &&
((isValueWithUnitAfter_.is && !isValueWithUnitAfter_.opsBetween) ||
(isNumberAfter_.is && !isNumberAfter_.opsBetween))
) {
/*
e.g.
$fooBar: #{color.scale(
#000000,
$lightness: -50%,
$alpha: -50%
)};
*/
if (isInsideFunctionCall_.is) {
return "sign";

@@ -744,3 +748,3 @@ }

if (beforeMatch && beforeMatch[0] && after.search(/^[^(,]+\)/) !== -1) {
if (beforeMatch && beforeMatch[0] && after.search(/^[^(]+\)/g) !== -1) {
result.is = true;

@@ -747,0 +751,0 @@ result.fn = beforeMatch[1];

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