Socket
Socket
Sign inDemoInstall

stylelint-scss

Package Overview
Dependencies
Maintainers
3
Versions
110
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.5.1 to 6.6.0

13

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

@@ -20,11 +20,12 @@ "repository": "stylelint-scss/stylelint-scss",

"postcss-media-query-parser": "^0.2.3",
"postcss-resolve-nested-selector": "^0.1.4",
"postcss-selector-parser": "^6.1.1",
"postcss-resolve-nested-selector": "^0.1.6",
"postcss-selector-parser": "^6.1.2",
"postcss-value-parser": "^4.2.0"
},
"devDependencies": {
"common-tags": "^1.8.2",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"github-contributors-list": "^1.2.5",
"husky": "^9.1.4",
"husky": "^9.1.5",
"jest": "^29.7.0",

@@ -34,7 +35,7 @@ "jest-preset-stylelint": "^7.1.0",

"np": "^10.0.7",
"postcss": "^8.4.40",
"postcss": "^8.4.45",
"postcss-less": "^6.0.0",
"postcss-scss": "^4.0.9",
"prettier": "^3.3.3",
"stylelint": "^16.8.1"
"stylelint": "^16.9.0"
},

@@ -41,0 +42,0 @@ "files": [

@@ -15,3 +15,8 @@ "use strict";

const { utils } = require("stylelint");
const { isFunctionCall } = require("../../utils/validateTypes");
const findOperators = require("../../utils/sassValueParser");
const {
parseFunctionArguments
} = require("../../utils/parseFunctionArguments");
const {
isDollarVar,

@@ -37,3 +42,3 @@ isIfStatement,

const SYNTAX_PROPERTY = /^syntax$/i;
const SYNTAX_DESCRIPTOR = /^syntax$/i;

@@ -45,3 +50,12 @@ function extractFunctionName(inputString) {

function hasDollarVarArg(functionCall) {
for (const i of parseFunctionArguments(functionCall)) {
if (isFunctionCall(i.value)) return hasDollarVarArg(i.value);
if (isDollarVar(i.value)) return true;
}
return false;
}
const unsupportedFunctions = ["clamp", "min", "max", "env"];
const mathOperators = ["+", "/", "-", "*", "%"];

@@ -84,6 +98,27 @@ function rule(primary, secondaryOptions) {

const propertiesSyntax = {
// Take a shallow clone as this object will be appended to.
...(secondaryOptions?.propertiesSyntax ?? {})
overflow: "| overlay", // csstree/csstree#248
width:
"| min-intrinsic | -moz-min-content | -moz-available | -webkit-fill-available", // csstree/csstree#242
"anchor-name": "none | <custom-property-name>#",
"field-sizing": "content | fixed",
"text-box-edge":
"auto | [ text | cap | ex | ideographic | ideographic-ink ] [ text | alphabetic | ideographic | ideographic-ink ]?",
"text-box-trim": "none | trim-start | trim-end | trim-both",
"text-spacing-trim": "normal | space-all | space-first | trim-start",
"text-wrap-mode": "wrap | nowrap",
"text-wrap-style": "auto | balance | pretty | stable",
"text-wrap": "<'text-wrap-mode'> || <'text-wrap-style'>",
"view-timeline-axis": "[ block | inline | x | y ]#",
"view-timeline-inset": "[ [ auto | <length-percentage> ]{1,2} ]#",
"view-timeline-name": "[ none | <custom-property-name> ]#",
"view-timeline":
"[ <'view-timeline-name'> [ <'view-timeline-axis'> || <'view-timeline-inset'> ]? ]#",
// <custom-ident> represents any valid CSS identifier that would not be misinterpreted as a pre-defined keyword in that property’s value definition
// i.e. reserved keywords don't have to be excluded explicitly
// w3c/csswg-drafts#9895
"view-transition-name": "none | <custom-ident>",
"word-break": "| auto-phrase",
...secondaryOptions?.propertiesSyntax
};
const typesSyntax = secondaryOptions?.typesSyntax ?? {};
const typesSyntax = { ...secondaryOptions?.typesSyntax };

@@ -104,3 +139,6 @@ /** @type {Map<string, string>} */

for (const node of atRule.nodes) {
if (typeGuards.isDeclaration(node) && SYNTAX_PROPERTY.test(node.prop)) {
if (
typeGuards.isDeclaration(node) &&
SYNTAX_DESCRIPTOR.test(node.prop)
) {
const value = node.value.trim();

@@ -140,4 +178,4 @@ const unquoted = cssTree.string.decode(value);

//csstree/csstree#243
// NOTE: CSSTree's `fork()` doesn't support `-moz-initial`, but it may be possible in the future.
// See https://github.com/stylelint/stylelint/pull/6511#issuecomment-1412921062
if (/^-moz-initial$/i.test(value)) return;

@@ -157,4 +195,6 @@

if (value.split(" ").some(val => isDollarVar(val))) return;
if (value.split(" ").some(val => hasDollarVarArg(val))) return;
if (value.split(" ").some(val => containsCustomFunction(val))) return;
// https://github.com/mdn/data/pull/674
// mdn/data#674
// `initial-value` has an incorrect syntax definition.

@@ -185,3 +225,11 @@ // In reality everything is valid.

if (isIfStatement(value)) return;
if (hasDollarVarArg(value)) return;
const operators = findOperators({ string: value }).map(o => o.symbol);
for (const operator of operators) {
if (mathOperators.includes(operator)) {
return;
}
}
utils.report({

@@ -229,3 +277,10 @@ message: messages.rejectedParseError(prop, value),

const endIndex = index + mismatchLength;
const operators = findOperators({ string: value }).map(o => o.symbol);
for (const operator of operators) {
if (mathOperators.includes(operator)) {
return;
}
}
utils.report({

@@ -275,4 +330,2 @@ message: messages.rejected(prop, mismatchValue),

* @see csstree/csstree#245 env
* @see https://github.com/stylelint/stylelint/pull/6511#issuecomment-1412921062
* @see https://github.com/stylelint/stylelint/issues/6635#issuecomment-1425787649
*

@@ -279,0 +332,0 @@ * @param {import('css-tree').CssNode} cssTreeNode

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc