Skip to content

Commit 6caf395

Browse files
committed
refactor: clarify postcss-value-parser quirk and simplify isDashedIdent
1 parent ca71174 commit 6caf395

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

lib/rules/custom-property-no-missing-var-function/index.cjs

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/rules/custom-property-no-missing-var-function/index.mjs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const rule = (primary) => {
114114

115115
if (!isDashedIdent(node)) return;
116116

117-
// Strip trailing semicolons for lookup and reporting
117+
// `postcss-value-parser` incorrectly includes semicolons in word tokens.
118118
const cleanValue = node.value.replace(/;+$/, '');
119119

120120
if (!knownCustomProperties.has(cleanValue)) return;
@@ -139,10 +139,7 @@ const rule = (primary) => {
139139
* @param {Node} node
140140
*/
141141
function isDashedIdent({ type, value }) {
142-
// Strip trailing semicolons that may be part of conditional syntax
143-
const cleanValue = value.replace(/;+$/, '');
144-
145-
return type === 'word' && cleanValue.startsWith('--');
142+
return type === 'word' && value.startsWith('--');
146143
}
147144

148145
rule.ruleName = ruleName;

0 commit comments

Comments
 (0)