diff --git a/lib/rules/declaration-property-value-no-unknown/index.js b/lib/rules/declaration-property-value-no-unknown/index.js index 97f8c9f80b..0ae887c33c 100644 --- a/lib/rules/declaration-property-value-no-unknown/index.js +++ b/lib/rules/declaration-property-value-no-unknown/index.js @@ -84,10 +84,12 @@ const rule = (primary, secondaryOptions) => { if (isPropIgnored(prop, value)) return; + let cssTreeValueNode; + try { - const valueNode = parse(value, { context: 'value' }); + cssTreeValueNode = parse(value, { context: 'value' }); - if (containsUnsupportedMathFunction(valueNode)) return; + if (containsUnsupportedMathFunction(cssTreeValueNode)) return; } catch (e) { result.warn(`Cannot parse property value "${value}"`, { node: decl, @@ -97,7 +99,7 @@ const rule = (primary, secondaryOptions) => { return; } - const { error } = forkedLexer.matchProperty(prop, value); + const { error } = forkedLexer.matchProperty(prop, cssTreeValueNode); if (!error) return; diff --git a/patches/@types+css-tree+2.0.1.patch b/patches/@types+css-tree+2.0.1.patch index 4c1fbcb5c7..7c7c0910ee 100644 --- a/patches/@types+css-tree+2.0.1.patch +++ b/patches/@types+css-tree+2.0.1.patch @@ -17,7 +17,7 @@ index 2e4ed18..7f096c6 100755 +}; + +declare class Lexer { -+ matchProperty(propertyName: string, value: string): MatchResult; ++ matchProperty(propertyName: string, value: CssNode | string): MatchResult; +} + +export function fork(extension: Record>): { lexer: Lexer };