Skip to content

Conversation

@xbinaryx
Copy link
Contributor

@xbinaryx xbinaryx commented Oct 8, 2025

Prerequisites checklist

The rule assumed all Function nodes appear within a CSS declaration value. However, constructs such as @import ... layer(theme) or @supports (color: color(display-p3 1 1 1)) can include Function nodes outside of any declaration context. Since declStack is only populated when entering a Declaration node, it was undefined for these cases — leading to:

TypeError: Cannot read properties of undefined (reading 'functionPartsStack')

What is the purpose of this pull request?

This PR fixes a runtime error in the no-invalid-properties rule that occurred when the rule processed Function nodes outside of CSS declarations.

What changes did you make? (Give an overview)

  • Added safe-guard checks in the Function, Function > *:not(Function), and Function:exit visitors to ensure that a declaration state exists before accessing it.
  • Added tests

Related Issues

Fixes #289

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

@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Oct 8, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Oct 8, 2025
@Pixel998 Pixel998 added the accepted There is consensus among the team that this change meets the criteria for inclusion label Oct 8, 2025
@Pixel998 Pixel998 moved this from Needs Triage to Implementing in Triage Oct 8, 2025
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. Thanks.

@nzakas nzakas merged commit 4120774 into eslint:main Oct 10, 2025
22 checks passed
@github-project-automation github-project-automation bot moved this from Implementing to Complete in Triage Oct 10, 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.

Bug: css/no-invalid-properties throws TypeError with certain valid CSS

3 participants