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

Custom Stylelint rule to ban BEM convention in CSS modules #131

Open
valerybugakov opened this issue Sep 22, 2021 · 1 comment
Open

Custom Stylelint rule to ban BEM convention in CSS modules #131

valerybugakov opened this issue Sep 22, 2021 · 1 comment
Assignees
Labels
good first issue Good for newcomers

Comments

@valerybugakov
Copy link
Member

Problem statement

This summer we started the migration to CSS modules in the main Sourcegraph monorepo. We decided not to use the BEM convention in CSS modules apart from modifier selectors:

// Global CSS
.repo-header {
  &--active  { ... }
  &__button { ... }
}

// CSS module
.repo-header {
  &--active  { ... }
}

.button { ... }

Notice how we keep a nested modifier selector &--active. But the &__button selector is bubbled to the top level.
To stick to this convention, we need a Stylelint rule to ban usage on &__* selectors in CSS modules.

Success criteria

  1. A custom Stylelint rule is created that warns if the &__* selector is used.
  2. It's added to our Stylelint config as a glob-based rule to apply it only to *.module.scss files.

Things to learn/practice during the implementation

Writing custom Stylelint rules to keep the codebase consistent.

Estimated amount of work

T-shirt size estimate: M.

@valerybugakov valerybugakov added the good first issue Good for newcomers label Sep 22, 2021
@valerybugakov valerybugakov added this to To do [Experienced] in Good first issues Sep 22, 2021
@oleggromov
Copy link

I absolutely love the title. Will work on it! 😍

@oleggromov oleggromov self-assigned this Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Good first issues
To do [Experienced] 🏋🏻
Status: Backlog
Development

No branches or pull requests

2 participants