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

Linter to avoid using html elements as selectors #931

Open
mkronenfeld opened this issue Dec 6, 2017 · 2 comments
Open

Linter to avoid using html elements as selectors #931

mkronenfeld opened this issue Dec 6, 2017 · 2 comments

Comments

@mkronenfeld
Copy link

Hey there,

is there an option to avoid using html elements as selectors?

We are using the hyphenated_BEM convention and facing the following problem very often:

.button {
    // Okay
    &__label {
        color: $white;
    }

    // Wrong
    span {
        color: $white;
    }
}

However it is totally okay for us to style on elements f.e. in a reset file:

// scss-lint:disable AvoidElements
span {
    color: $white;
}
// scss-lint:enable AvoidElements

Do you have any solution for this? Perhaps I have overlooked something.

Best regards
Marvin

@sds sds added the enhancement label Jan 9, 2018
@sds
Copy link
Owner

sds commented Jan 9, 2018

If you want to write a linter ElementSelector which forbids any references to elements, this would be pretty easy. See IdSelector as an example. Would essentially need to rename visit_id to visit_element.

Happy to accept a pull request (but this linter should be disabled by default).

@osartun
Copy link

osartun commented May 14, 2019

Was this ever done?

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

No branches or pull requests

3 participants