Skip to content

Validating selectors and a plugin pack #13

Description

@jeddy3

Firstly, thanks again for this plugin. It's great!

Now, how stylelint validates CSS is currently influx:

Invalid code is best handled by emerging dedicated tools e.g. csstree - a language parser with syntax validation. As a stop-gap, while these tools mature, provide invalid code rules for the simplest of cases. (In the future, these tools can be wrapped as plugins to make use of features such as /* stylelint-* */ command comments, severity levels, and options validator.)

At stylelint, we currently direct users to this plugin when they request a rule to validate their declarations e.g. stylelint/stylelint#2816 & stylelint/stylelint#2777.

This plugin validates the property and value pairs of declarations, but I believe csstree can also validate selector lists (and at-rule validation is in the works). What do you think about creating a plugin pack, like stylelint-order and stylelint-scss, to house plugins for declaration and selector list (and at-rule in the future) validation?

In stylelint rules target things (rules, at-rules, selector lists, value lists etc...). We did this to help users find and locate only the rules they need. I think having a validation plugin pack that follows this convention would be beneficial to users. What do you think?

The plugin pack could keep the same name as this plugin (stylelint-csstree-validator) and it could, to be begin with, contain two plugins:

  • csstree-validator/declaration-no-invalid (what this plugin currently does)
  • csstree-validator/selector-list-no-invalid

(As an aside, there was a selector-no-empty rule in stylelint but it was removed in 8.0.0. as it was acting as a proxy for validation rather than preference).

I'd be eager to hear your thoughts on whether you think this is a good idea and whether it's aligned how you originally thought csstree and stylelint could work together.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions