Skip to content

Commit

Permalink
Fixing issue in utilities plugin (#274)
Browse files Browse the repository at this point in the history
* Fixing issue in utilities plugin

* Create large-lemons-arrive.md
  • Loading branch information
jonrohan committed May 27, 2022
1 parent 3aeb950 commit 4ba7018
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/large-lemons-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/stylelint-config": patch
---

Fixing issue in utilities plugin that missed certain classes
8 changes: 8 additions & 0 deletions __tests__/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ testRule({
column: 1,
description: 'Errors on spacer utility.'
},
{
code: '.x { padding: 1px; &:hover { padding:2px; } } .x { padding: $spacer-4; }',
message:
"Consider using the Primer utility '.p-4' instead of the selector '.x' in your html. https://primer.style/css/utilities (primer/utilities)",
line: 1,
column: 47,
description: 'Errors on spacer utility with hover ampersand.'
},
{
code: '.x { padding: $spacer-4 !important; }',
message:
Expand Down
2 changes: 1 addition & 1 deletion plugins/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}, contex
const lintResult = (root, result) => {
root.walkRules(rule => {
if (!/^\.[\w\-_]+$/.exec(rule.selector)) {
return false
return
}
const decls = rule.nodes.filter(decl => decl.type === 'decl')

Expand Down

0 comments on commit 4ba7018

Please sign in to comment.