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

Is it possible to prohibit use of different nesting in selectors / class name unions? #818

Open
silentmantra opened this issue May 23, 2023 · 1 comment

Comments

@silentmantra
Copy link

Aiming to avoid unnecessary code reviews. So I have a case when someone added rules without reusing the previous selector:

.games-lib-table {
  // ...
  &__info {
    // ...
  }
}
// later in the file someone added
.games-lib-table__info_filters {
  // ...
}

My first idea was to use stylint-scss: enforce selector-nest-combinators then somehow to prohibit duplication. But that's not nesting combinators rather a union of a class name.

Anyone has an idea how to enforce reusing existing class name unions like I've described?

Maybe there's some other linter besides Stylelint/stylelint-scss that could do that?

@kristerkari
Copy link
Collaborator

Sorry for not commeting on this earlier.

I think it's a nice idea, but I think that in order for the suggestion to work, the user would need to define in the rule options what are the characters to separate the different parts of the class selector. Without that the rule would not know what is part of the name and what is a separator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants