Skip to content

fix: no-invalid-properties false positives for var() in functions #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thecalamiity
Copy link
Contributor

Prerequisites checklist

What is the purpose of this pull request?

This PR fixes a regression in the no-invalid-properties rule where it incorrectly reports for valid CSS properties containing var() usage within functions like calc().

What changes did you make? (Give an overview)

  • Updated the validation logic to properly handle CSS variables when they appear inside functions.
  • Added tests to verify correct behavior for variables in functions

Related Issues

Fixes #223

Is there anything you'd like reviewers to focus on?

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Aug 4, 2025
@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Aug 4, 2025
return null;
}
} else if (nestedChild.type === "Function") {
// Recursively process nested functions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we're doing a traversal on top of the traversal that is already happening in the rule, which is inefficient.

A more efficient approach would be to use the Function visitor method to do the traversal automatically. Can you take a look at that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into using the Function visitor method here, but I don’t see a straightforward way to apply it. The code at this point isn’t just traversing—it’s reconstructing the property value as a string, including nested function names and arguments. The visitor pattern alone doesn’t provide the context needed for this reconstruction, so a manual traversal seems necessary. If you know of a way to leverage the visitor pattern for this case, I’d appreciate your input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

Rule Change: no-invalid-properties incorrectly reports for valid CSS with var() in functions
2 participants