Skip to content

Commit

Permalink
Merge pull request #481 from ybiquitous/issue-480
Browse files Browse the repository at this point in the history
Fix duplicate rule names in `at-rule-no-unknown` message
  • Loading branch information
kristerkari authored Jul 19, 2021
2 parents c95aa67 + e3e44c4 commit 9c43853
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/rules/at-rule-no-unknown/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,9 @@ test("One warning for each unknown at rule", done => {
})
.catch(logError);
});

test("messages", () => {
expect(messages.rejected("@foo")).toBe(
'Unexpected unknown at-rule "@foo" (scss/at-rule-no-unknown)'
);
});
6 changes: 5 additions & 1 deletion src/rules/at-rule-no-unknown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ const ruleToCheckAgainst = "at-rule-no-unknown";
export const ruleName = namespace(ruleToCheckAgainst);

export const messages = utils.ruleMessages(ruleName, {
rejected: rules[ruleToCheckAgainst].messages.rejected
rejected: (...args) => {
return rules[ruleToCheckAgainst].messages
.rejected(...args)
.replace(` (${ruleToCheckAgainst})`, "");
}
});

export default function(primaryOption, secondaryOptions) {
Expand Down

0 comments on commit 9c43853

Please sign in to comment.