Make isSCSS* function stricter (#9093)

This commit is contained in:
fisker Cheung authored and GitHub committed 2020-09-01 16:58:35 +08:00
1 parent 7d69167786
commit 01f986bea9
16 files changed
+1306 -1135

No files matched your search

+4 -4
View File
@@ -6,7 +6,6 @@ const { hasPragma } = require("./pragma");
const {
hasSCSSInterpolation,
hasStringOrFunction,
isSCSS,
isSCSSNestedPropertyNode,
isSCSSVariable,
stringifyNode,
@@ -40,7 +39,7 @@ function parseValueNode(valueNode, options) {
const node = nodes[i];
if (
isSCSS(options.parser, node.value) &&
options.parser === "scss" &&
node.type === "number" &&
node.unit === ".." &&
node.value[node.value.length - 1] === "."
@@ -80,7 +79,8 @@ function parseValueNode(valueNode, options) {
// Stringify if the value parser can't handle the content.
if (
hasSCSSInterpolation(groupList) ||
(!hasStringOrFunction(groupList) && !isSCSSVariable(groupList[0]))
(!hasStringOrFunction(groupList) &&
!isSCSSVariable(groupList[0], options))
) {
const stringifiedContent = stringifyNode({
groups: node.group.groups,
@@ -370,7 +370,7 @@ function parseNestedCSS(node, options) {
}
// Check on SCSS nested property
if (isSCSSNestedPropertyNode(node)) {
if (isSCSSNestedPropertyNode(node, options)) {
node.isSCSSNesterProperty = true;
}