Skip to content

Change Request: Track variables on SourceCode #160

Open
@nzakas

Description

@nzakas

Environment

HEAD

What problem do you want to solve?

CSS variables are a significant part of modern CSS, and in order to accurately validate property values, each rule now has to track custom properties and see where they're applied in values.

What do you think is the correct solution?

Something similar to the functionality of eslint-scope for CSS. I'm not quite sure on the details as the custom property/var() usage is a different paradigm than variables in JS, but something along the lines of a sourceCode.customProperties map where the key is the custom property name and the value is an object that tracks both rules where the custom property is set and declarations where the custom property value is read. We may also want to make it easy to get the closest value for that custom property to aid in validation, similar to what I did in #148.

Participation

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

Additional comments

We'd need an RFC for this to ensure we're thinking through the complexities.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

RFC Opened

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions