Skip to content

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

@jgoz

Description

@jgoz

Environment

ESLint version: 9.37.0
@eslint/css version: 0.12.0
Node version: 22.18.0
npm version: N/A
Operating System: macOS

Which language are you using?

stylesheet

What did you do?

Configuration
// CSS rules
{
  files: ['**/*.css'],
  language: 'css/css',
  languageOptions: {
    tolerant: true,
  },
  plugins: { css },
  extends: [css.configs.recommended],
  rules: {
    'css/use-baseline': 'off',
    'css/no-invalid-properties': ['error', { allowUnknownVariables: true }],
  },
}
@supports (color: color(display-p3 1 1 1)) {
  @media (color-gamut: p3) {
    & .my-class {
      --my-color: oklch(73.5% 0.1192 254.8);
    }
  }
}
@import '@my/styles.css' layer(theme);

What did you expect to happen?

Does not crash

What actually happened?

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

Thrown from here:

declStack.at(-1).functionPartsStack.push([]);

Link to Minimal Reproducible Example

https://stackblitz.com/edit/vitejs-vite-scw1hdur?file=src%2Fone.css

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionbugSomething isn't working

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions