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

Ignore the case characters order #78

Open
evanre opened this issue Jan 12, 2019 · 3 comments
Open

Ignore the case characters order #78

evanre opened this issue Jan 12, 2019 · 3 comments

Comments

@evanre
Copy link

evanre commented Jan 12, 2019

Hi, I've got a specific problem.
I'm trying to implement stylelint into my environment (which is for development newsletters and based on Foundation for Emails). There is specific hacks for developing newsletters for legacy email clients. And one of them is margins support in Outlook. It requires to use a "margin" property with first capital letter.
For example - Margin: 0 auto;, so the total style block looks like this:

.publications {
        display: block;
        margin: 0 auto 5px 0;
        Margin: 0 auto 5px 0;
        width: auto;
}

It's necessary to capital "Margin" follows after lower one. But in this case I'm getting alphabetical error. I suppose there is a some regexp that looks like [A-Za-z]. Is there any chance to change this behavior?

Thanks

@hudochenkov
Copy link
Owner

I think this plugin should ignore property case when sorting. I haven't thought about this before, because lower cased properties are kind of default in our industry :)

Your case is totally valid, a plugin should ignore the case of properties.

@baradusov
Copy link

@hudochenkov If change this condition

if (firstPropData.unprefixedName === secondPropData.unprefixedName) {

to
firstPropData.unprefixedName.toLowerCase() === secondPropData.unprefixedName.toLowerCase()
is it will be enough to resolve issue?
I tested it and it seems ignoring case without breaking anything.

But if using default stylelint-config-standard, for example, then there are property-case and declaration-block-no-duplicate-properties rules violations.
Shoud we or user deal with it?

@hudochenkov
Copy link
Owner

@baradusov Thank you for looking into this!

It won't be enough, because later in this file also a check:

return firstPropData.unprefixedName < secondPropData.unprefixedName;

Both names should be lowercased before making comparison.

There is also a check for properties-order:

if (firstPropData.unprefixedName === secondPropData.unprefixedName) {

Astrael1 pushed a commit to Astrael1/stylelint-order that referenced this issue Oct 7, 2024
Astrael1 pushed a commit to Astrael1/stylelint-order that referenced this issue Oct 7, 2024
Astrael1 pushed a commit to Astrael1/stylelint-order that referenced this issue Oct 7, 2024
Astrael1 pushed a commit to Astrael1/stylelint-order that referenced this issue Oct 7, 2024
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