-
-
Notifications
You must be signed in to change notification settings - Fork 942
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change this wording to Unexpected duplicate of selector "${selector}" at line ${firstDuplicateLine}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! How about "used" instead of "occurrence": Unexpected duplicate selector "${selector}", first used at line ${firstDuplicateLine}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like it! Changed it.
Great @hudochenkov. Feel free to merge. |
Added to changelog:
|
#2415) * Add previous selector line number to message of no-duplicate-selectors * Change report message
#2303
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.