SimenB / stylint

Improve your Stylus code with Stylint
https://simenb.github.io/stylint/
GNU General Public License v2.0
348 stars 62 forks source link

How can I configure the BEM naming convention? #431

Closed Dzhakhar closed 6 years ago

Dzhakhar commented 6 years ago

Can I provide any customization for the namingConvention: "BEM" property?

SimenB commented 6 years ago

Just set it to something else.

https://github.com/SimenB/stylint/blob/23b92fc8a7699c05c0b7c0bbc63bb389bd4fb03f/src/core/config.js#L49-L52

PR welcome for other styles if you need it

Dzhakhar commented 6 years ago

@SimenB thank you for your quick response. Is false value set by default on namingConventionStrict ?

Dzhakhar commented 6 years ago

@SimenB is it possible to pass a BEM detecting regex (bemRe) as an option? To configure the BEM rules to my needs?

SimenB commented 6 years ago

PR welcome for that, yes.

I think it will have to be the path to a module then, as you can't pass functions directly

Dzhakhar commented 6 years ago

@SimenB can't I pass something like this "/^([$.#{:][${a-z]([-]?[${}a-z0-9]+)*(_{2}[${}a-z0-9]([-]?[${}a-z0-9]+)*)?((_[${}a-z0-9]([-]?[a-z0-9}]+)*){2})*)\b/m"?

SimenB commented 6 years ago

That works as well if a regexp is always enough

SimenB commented 6 years ago

Is false value set by default on namingConventionStrict ?

yes

SimenB commented 6 years ago

It doesn't work now though, PR is needed for it

Dzhakhar commented 6 years ago

@SimenB I'm gonna contribute. Could you please get back to me via email or via skype dzhakhar1209 to discuss it

SimenB commented 6 years ago

I'm on holidays, so not available.

I would add a new option called namingConventionRegexp or namingConventionPattern (and require namingConvention: "regexp" or namingConvention: "pattern" depending on which you land on)

Dzhakhar commented 6 years ago

Got it! But will you be able to review my PR in case it comes today? Have a nice holidays

SimenB commented 6 years ago

But will you be able to review my PR in case it comes today?

Yes