Skip to content

fix: treat at-rule names as case-insensitive across rules #233

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

Merged

Conversation

thecalamiity
Copy link
Contributor

Prerequisites checklist

What is the purpose of this pull request?

Ensure at-rule names are treated case-insensitively across rules, aligning with CSS syntax and preventing missed detections when authors use mixed-case at-rules.

What changes did you make? (Give an overview)

  • Updated rule listeners to use case-insensitive matching
  • Added mixed-case variants to tests to verify case-insensitive behavior

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 9, 2025
@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Aug 9, 2025
@@ -42,7 +42,7 @@ export default {
const imports = new Set();

return {
"Atrule[name=import]"(node) {
"Atrule[name=/^import$/i]"(node) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also share the official reference where it is mentioned these are case insensitive?

Copy link
Contributor Author

@thecalamiity thecalamiity Aug 11, 2025

Choose a reason for hiding this comment

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

The at-rules affected in this PR are defined across different specs, so I’ll need to track down the relevant references. In the meantime, here’s a StackBlitz reproduction for @import.

@nzakas
Copy link
Member

nzakas commented Aug 11, 2025

CSS at-rules are case sensitive, so closing.

@nzakas nzakas closed this Aug 11, 2025
@github-project-automation github-project-automation bot moved this from Needs Triage to Complete in Triage Aug 11, 2025
@thecalamiity
Copy link
Contributor Author

thecalamiity commented Aug 11, 2025

@nzakas CSS at-rule names are case-insensitive. I tested each at-rule changed in this PR to confirm this before opening it.

Here is a StackBlitz reproduction for @import

@nzakas nzakas reopened this Aug 13, 2025
@github-project-automation github-project-automation bot moved this from Complete to Evaluating in Triage Aug 13, 2025
@nzakas
Copy link
Member

nzakas commented Aug 13, 2025

@thecalamiity it appears you are correct. I had to dig deep into the spec to find this:

Tokens match if their value is a match for the value defined in the grammar. Unless otherwise specified, all matches are ASCII case-insensitive.

In the future, keep in mind that simple repros in a single browser don't mean much -- browsers can implement things different ways. What is more useful is finding the text in the specification that backs up your claim.

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM. Would like @snitin315 to review before merging.

@nzakas nzakas moved this from Evaluating to Second Review Needed in Triage Aug 13, 2025
@lumirlumir lumirlumir added the accepted There is consensus among the team that this change meets the criteria for inclusion label Aug 18, 2025
@snitin315 snitin315 merged commit 9765135 into eslint:main Aug 20, 2025
41 checks passed
@github-project-automation github-project-automation bot moved this from Second Review Needed to Complete in Triage Aug 20, 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: Complete
Development

Successfully merging this pull request may close these issues.

4 participants