analyzeAnimation silently drops quoted animation names (<string> nodes)
@projectwallace/css-analyzer/values — analyzeAnimation
The CSS Animations spec defines <keyframes-name> as <custom-ident> | <string>, meaning quoted strings are valid animation names in both animation-name and the animation shorthand:
@keyframes "slide in" { from { opacity: 0 } to { opacity: 1 } }
a { animation-name: "slide in"; } /* valid */
a { animation: "slide in" 1s ease; } /* valid */
analyzeAnimation only processes is_identifier, is_dimension, and is_function nodes. is_string nodes are silently skipped, so quoted animation names produce no callback at all — they're invisible to callers.
Expected: analyzeAnimation calls the callback with { type: 'name', value: <StringNode> } for string nodes that appear in the name position.
Actual: the callback is never invoked; the quoted name is dropped entirely.
This also means atrules.keyframes in the full analyze() output will show quoted keyframe names as unused even when they are referenced by a quoted animation-name value.
Workaround we're currently using in stylelint-plugin:
analyzeAnimation(ast, ({ type, value }) => {
if (type === 'name') tracker.use(value.text)
})
// analyzeAnimation doesn't handle <string> nodes — work around until fixed
for (const node of ast) {
if (node.type === STRING) tracker.use(node.text)
}
analyzeAnimationsilently drops quoted animation names (<string>nodes)@projectwallace/css-analyzer/values—analyzeAnimationThe CSS Animations spec defines
<keyframes-name>as<custom-ident> | <string>, meaning quoted strings are valid animation names in bothanimation-nameand theanimationshorthand:analyzeAnimationonly processesis_identifier,is_dimension, andis_functionnodes.is_stringnodes are silently skipped, so quoted animation names produce no callback at all — they're invisible to callers.Expected:
analyzeAnimationcalls the callback with{ type: 'name', value: <StringNode> }for string nodes that appear in the name position.Actual: the callback is never invoked; the quoted name is dropped entirely.
This also means
atrules.keyframesin the fullanalyze()output will show quoted keyframe names asunusedeven when they are referenced by a quotedanimation-namevalue.Workaround we're currently using in
stylelint-plugin: