Skip to content

fix: make no-invalid-properties var() case-insensitive #232

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 3 commits 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 bug in the no-invalid-properties rule where var() was matched case-sensitively, causing mixed/uppercase usages like VAR() or Var() to be missed. CSS function names are ASCII case-insensitive, so these should be treated equivalently.

What changes did you make? (Give an overview)

  • Made var() detection and fallback parsing case-insensitive
  • Added tests for mixed/uppercase var() and nested fallbacks

Related Issues

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 8, 2025
@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Aug 8, 2025
@@ -592,5 +618,134 @@ ruleTester.run("no-invalid-properties", rule, {
},
],
},
{
Copy link
Contributor

Choose a reason for hiding this comment

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

CSS variables --my-color is not case sensitive, can we please add a few cases to verify the rule is working as expected for them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are case-sensitive. From MDN:

Note: Custom property names are case sensitive — --my-color will be treated as a separate custom property to --My-color.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah sorry! I meant case sensitive only, just add a case where it is working as expected

@snitin315 snitin315 moved this from Needs Triage to Implementing in Triage Aug 9, 2025
@snitin315 snitin315 added accepted There is consensus among the team that this change meets the criteria for inclusion contributor pool labels Aug 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion bug Something isn't working contributor pool
Projects
Status: Implementing
Development

Successfully merging this pull request may close these issues.

2 participants