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

Add checkContextFunctionalPseudoClasses: [] to selector-max-id #7364

Closed
brigitamaria opened this issue Dec 1, 2023 · 5 comments · Fixed by #7380
Closed

Add checkContextFunctionalPseudoClasses: [] to selector-max-id #7364

brigitamaria opened this issue Dec 1, 2023 · 5 comments · Fixed by #7380
Labels
status: wip is being worked on by someone type: enhancement a new feature that isn't related to rules

Comments

@brigitamaria
Copy link
Contributor

What is the problem you're trying to solve?

I'm using selector-max-id: 0 on a project to disable ID selectors on the CSS files, but something like :global(#foo) is not throwing any errors.

What solution would you like to see?

Currently, :global and :local is not included on isContextFunctionalPseudoClass.
Including those scope selectors in that function will affect another rules which also use the same function, so what do you think about this use case?
I'd be happy to help so let me know about your opinion, thank you!

@jeddy3 jeddy3 changed the title Combining selector-max-id with :global and :local selectors Add includeContextFunctionalPseudoClasses: [] to selector-max-id Dec 2, 2023
@jeddy3 jeddy3 added the status: needs discussion triage needs further discussion label Dec 2, 2023
@jeddy3
Copy link
Member

jeddy3 commented Dec 2, 2023

@brigitamaria Thanks for the request and for using the template.

The built-in rules only support standard CSS syntax from the specifications. However, we can discuss adding a includeContextFunctionalPseudoClasses: [] option to the selector-max-* rules.

For example:

{
  "rules": {
    "selector-max-id": [0, {
      "includeContextFunctionalPseudoClasses": ["--custom-pseudo-class"]
    }]
  }
}

The new option would go alongside the existing ignoreContextFunctionalPseudoClasses one.

@Mouvedia
Copy link
Contributor

Mouvedia commented Dec 2, 2023

I found cases that warrants the addition of a new option: :-webkit-any(), :-moz-any().

@brigitamaria
Copy link
Contributor Author

I like the suggestion for adding a new option, but how should we treat the presedence if we pass the same elements to includeContextFunctionalPseudoClasses and ignoreContextFunctionalPseudoClasses?

@Mouvedia
Copy link
Contributor

Mouvedia commented Dec 4, 2023

but how should we treat the precedence if we pass the same elements to includeContextFunctionalPseudoClasses and ignoreContextFunctionalPseudoClasses?
["/regex/", /regex/, "non-regex"]

I advise against order because it wasn't consistent for objects in ES5.
It's easy to detect conflicts for non-regex and warn.

A simple solution would be to have one of the two have the priority.
e.g. anything set by ignoreContextFunctionalPseudoClasses can be overruled by includeContextFunctionalPseudoClasses

@Mouvedia
Copy link
Contributor

Mouvedia commented Dec 8, 2023

@jeddy3 @ybiquitous it looks warranted, but I may be biased; can we change the status?

@jeddy3 jeddy3 added status: wip is being worked on by someone type: enhancement a new feature that isn't related to rules and removed status: needs discussion triage needs further discussion labels Dec 8, 2023
@jeddy3 jeddy3 changed the title Add includeContextFunctionalPseudoClasses: [] to selector-max-id Add checkContextFunctionalPseudoClasses: [] to selector-max-id Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: wip is being worked on by someone type: enhancement a new feature that isn't related to rules
Development

Successfully merging a pull request may close this issue.

3 participants