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

Add previous selector line number to message of no-duplicate-selectors #2415

Merged
merged 2 commits into from Mar 15, 2017

Conversation

2 participants
@hudochenkov
Member

hudochenkov commented Mar 7, 2017

Which issue, if any, is this issue related to?

#2303

Is there anything in the PR that needs further explanation?

Should I find a way to report precise line for duplication in multiline selector list? These tests. Rule itself reports selector position and not a precise position of duplicated selector within multiline selector list.

Warning will show the first occurrence of duplicated selector, rather previous one. This behavior is clearly visible in system test 005 behaviour.

@davidtheclark

Great idea! I think we should adjust the message's wording a little, then we should merge.

@@ -13,7 +13,7 @@ const resolvedNestedSelector = require("postcss-resolve-nested-selector")
const ruleName = "no-duplicate-selectors"
const messages = ruleMessages(ruleName, {
rejected: selector => `Unexpected duplicate selector "${selector}"`,
rejected: (selector, firstDuplicateLine) => `Unexpected duplicate selector "${selector}" is also at line ${firstDuplicateLine}`,

This comment has been minimized.

@davidtheclark

davidtheclark Mar 15, 2017

Contributor

Let's change this wording to Unexpected duplicate of selector "${selector}" at line ${firstDuplicateLine}.

This comment has been minimized.

@hudochenkov

hudochenkov Mar 15, 2017

Member

It's very confusing. User might understand, that duplicated selector at line firstDuplicateLine, rather at line stylelint reports for this message.

16:1 Unexpected duplicate of selector "a" at line 3

I would think duplicate selector is at line 3. And it'd take some time to understand that it's at line 16.

What about Unexpected duplicate selector "${selector}", first occurrence at line ${firstDuplicateLine}? Maybe “occurrence” could be replaced with other word.

This comment has been minimized.

@davidtheclark

davidtheclark Mar 15, 2017

Contributor

Good idea! How about "used" instead of "occurrence": Unexpected duplicate selector "${selector}", first used at line ${firstDuplicateLine}

This comment has been minimized.

@hudochenkov

hudochenkov Mar 15, 2017

Member

Like it! Changed it.

@davidtheclark

This comment has been minimized.

Contributor

davidtheclark commented Mar 15, 2017

Great @hudochenkov. Feel free to merge.

@hudochenkov hudochenkov merged commit 5269b15 into master Mar 15, 2017

4 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls First build on master at 95.005%
Details
@hudochenkov

This comment has been minimized.

Member

hudochenkov commented Mar 15, 2017

Added to changelog:

  • Added: duplicate selector first usage line to no-duplicate-selector message (#2415)

@hudochenkov hudochenkov deleted the no-duplicate-selectors-improvements branch Mar 15, 2017

evilebottnawi added a commit that referenced this pull request Mar 21, 2017

Add previous selector line number to message of no-duplicate-selectors (
#2415)

* Add previous selector line number to message of no-duplicate-selectors

* Change report message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment