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

added optional group name property and used it for error messages #73

Merged
merged 3 commits into from Nov 18, 2018

Conversation

mbrowne
Copy link
Contributor

@mbrowne mbrowne commented Oct 25, 2018

Resolves #72

Copy link
Owner

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!

As I said before, logic should be located in other place.

Inside this block you can add group name for every property, if grope name is present:

if (_.isString(item)) {
// In flexible groups, the expectedPosition does not ascend
// to make that flexibility work;
// otherwise, it will always ascend
if (!inFlexibleGroup) {
expectedPosition += 1;
}
order[item] = { separatedGroup, expectedPosition };
return;
}

Then pass groupName to:

message: sharedInfo.messages.expected(
checkedOrder.secondNode.name,
checkedOrder.firstNode.name
),

Please, add tests and documentation.

expected: (first, second, groupName) => `
Expected "${first}"${
groupName ? ` to be grouped with other "${groupName}" properties and` : ''
} to come before "${second}"`,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use @jeddy3's suggestion:

Expected "${first}" to come before "${second}" in group "${groupName}"

Conditionally add “in group...”.

mbrowne added a commit to mbrowne/stylelint-order that referenced this pull request Nov 14, 2018
mbrowne added a commit to mbrowne/stylelint-order that referenced this pull request Nov 14, 2018
@mbrowne mbrowne changed the title [WIP] added optional group name property and used it for error messages added optional group name property and used it for error messages Nov 14, 2018
@mbrowne
Copy link
Contributor Author

mbrowne commented Nov 14, 2018

I refactored the code and added tests and documentation. I thought it would be good for the readme to include at least one example of using groupName so I added it to the first config example using a group, but if you think that's distracting at all you can feel free to remove it. In any case I added groupName to the documentation for valid group config options.

@hudochenkov
Copy link
Owner

Looks good! Thanks!

@hudochenkov hudochenkov merged commit ae03df8 into hudochenkov:master Nov 18, 2018
@mbrowne
Copy link
Contributor Author

mbrowne commented Nov 19, 2018

Thanks for merging. Note that I didn't bump the version number—I was leaving it up to you to decide about that. Do you expect to publish a new version of the npm package sometime soon?

@hudochenkov
Copy link
Owner

I want to include a fix for #74 in the next version. I'll most likely do it during this week.

@hudochenkov
Copy link
Owner

Released in stylelint-order@2.0.0.

@mbrowne
Copy link
Contributor Author

mbrowne commented Nov 20, 2018

Great, thank you :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants