Skip to content
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

Rule idea selector-pseudo-class-no-empty-parentheses #2047

Closed
alexander-akait opened this issue Nov 8, 2016 · 4 comments
Closed

Rule idea selector-pseudo-class-no-empty-parentheses #2047

alexander-akait opened this issue Nov 8, 2016 · 4 comments
Labels
status: needs discussion triage needs further discussion

Comments

@alexander-akait
Copy link
Member

alexander-akait commented Nov 8, 2016

Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?

Maybe

Invalid

input:not() { }

:matches() { }

Valid

input:not([type="submit"]) { }

:matches(section, article, aside, nav) h1 { }

Include nth-child, nth-last-child and etc.

Which rule, if any, is this issue related to?

selector-pseudo-class-no-empty-selector

What CSS is needed to reproduce this issue?

no matter

What stylelint configuration is needed to reproduce this issue?

e.g.

{
  "rules": {
    "selector-pseudo-class-no-empty-selector": true
  }
}

Which version of stylelint are you using?

no matter

How are you running stylelint: CLI, PostCSS plugin, Node API?

no matter

Does your issue relate to non-standard syntax (e.g. SCSS, nesting, etc.)?

no matter

What did you expect to happen?

no matter

What actually happened (e.g. what warnings or errors you are getting)?

no matter

@alexander-akait alexander-akait added the status: needs discussion triage needs further discussion label Nov 8, 2016
@jeddy3
Copy link
Member

jeddy3 commented Nov 17, 2016

I think we might have taken a wrong turn when we started using these *-no-empty rules as proxies for testing the validity of things.

Previous *-no-empty rules (e.g. block-no-empty, no-empty-source and comment-no-empty) allowed a user to specify a preference i.e. an empty block, comment or source is still valid CSS. selector-no-empty was the first *-no-empty rule to break with this pattern.

I think we're creeping into spec parser territory here, which I think is better handled in projects like csstree and css-values and then wrapped as stylelint plugins. These plugins are only applicable to users who write spec-based CSS i.e. those who do not use language extensions introduced by PostCSS plugins or preprocessors. I think such plugins would be more powerful than these piecemeal attempts to check for validity.

So, my suggestion is we close this issue in favour of someone creating a selector validator.

I also suggest we undo our mistake with selector-no-empty and deprecate that rule in 8.0.0. Along with media-feature-no-missing-punctuation as that is a proxy for validity too. Arguably the
*-no-unknown rules belong in a plugin pack too.

Thoughts?

@ntwb
Copy link
Member

ntwb commented Nov 18, 2016

I think you're right @jeddy3, stylelint is not a CSS spec parser 👍

@alexander-akait
Copy link
Member Author

@jeddy3 agree, also i agree selector-no-empty should be deprecated.

@davidtheclark
Copy link
Contributor

👍 from me, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs discussion triage needs further discussion
Development

No branches or pull requests

4 participants