projectwallace / projectwallace/css-analyzer

`analyzeAnimation` drops quoted animation names

Open Beginner friendly
#612 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛 defect
Dominant language
TypeScript
Stars
366
Forks
15
Avg merge
3h 23m
Merged PRs (30d)
3

Description

analyzeAnimation silently drops quoted animation names (<string> nodes)

@projectwallace/css-analyzer/valuesanalyzeAnimation

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)
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at analyzeAnimation in @projectwallace/css-analyzer/values and inspect how identifier, dimension, and function nodes are handled alongside string nodes. Confirm that quoted names in animation-name and animation shorthand invoke the name callback with the StringNode, and verify that quoted keyframes are no longer reported as unused in the full analyze() output.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.