Skip to content

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Feb 27, 2025

This change gives us the ability to pass in substitute values for variables when validating a property. The idea is that ESLint could keep track of the last value for any given custom property and pass that into lexer.matchProperty() so that we can actually validate property values containing var() (right now CSSTree just throws an error, which we swallow in the ESLint rule).

Ported from csstree#321
This pull request introduces changes to the lexer to support matching CSS properties that use the var() function. The changes include adding tests for var() handling and modifying the lexer to replace var() tokens with their corresponding values.

Enhancements to var() handling:

Lexer modifications:

  • lib/lexer/Lexer.js: Added the replaceVarTokens function to handle the replacement of var() tokens with their corresponding values. Modified matchSyntax, matchDeclaration, and matchProperty functions to support options for variable values. [1] [2] [3]

@nzakas nzakas marked this pull request as draft March 3, 2025 20:40
@nzakas
Copy link
Member Author

nzakas commented Mar 3, 2025

Can't quite figure out how to get the correct information into the match error. 🤔

Copy link

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Aug 13, 2025
Copy link

This pull request was auto-closed due to inactivity. While we wish we could keep working on every request, we unfortunately don't have the bandwidth to continue here and need to focus on other things. You can resubmit this pull request if you would like to continue working on it.

@github-actions github-actions bot closed this Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant