-
Notifications
You must be signed in to change notification settings - Fork 19
Make sure it checks for display-scale #619
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
f3c858d
55adaf5
e2ab653
1e3429d
6bd3013
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@primer/stylelint-config': minor | ||
--- | ||
|
||
Allowing to test background and border without color, failing on scale colors |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,8 @@ export const messages = ruleMessages(ruleName, { | |
let variables = primitivesVariables('colors') | ||
const validProps = { | ||
'^color$': ['fgColor', 'iconColor'], | ||
'^background(-color)?$': ['bgColor'], | ||
'^border(-top|-right|-bottom|-left|-inline|-block)*(-color)?$': ['borderColor'], | ||
'^background(-color|-image)?$': ['bgColor'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also test |
||
'^border(?:-top|-right|-bottom|-left|-inline|-block)?(?:-color)?$': ['borderColor'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enable testing for |
||
'^fill$': ['fgColor', 'iconColor', 'bgColor'], | ||
'^stroke$': ['fgColor', 'iconColor', 'bgColor', 'borderColor'], | ||
} | ||
|
@@ -46,9 +46,9 @@ const validValues = [ | |
const propType = prop => { | ||
if (/^color/.test(prop)) { | ||
return 'fg' | ||
} else if (/^background(-color)?$/.test(prop)) { | ||
} else if (/^background(-color|-image)?$/.test(prop)) { | ||
return 'bg' | ||
} else if (/^border(-top|-right|-bottom|-left|-inline|-block)*(-color)?$/.test(prop)) { | ||
} else if (/^border(?:-top|-right|-bottom|-left|-inline|-block)?(?:-color)?$/.test(prop)) { | ||
return 'border' | ||
} else if (/^fill$/.test(prop)) { | ||
return 'fg' | ||
|
@@ -137,15 +137,13 @@ const ruleFunction = primary => { | |
) { | ||
return | ||
} | ||
|
||
// Property is shortand and value doesn't include color | ||
if ( | ||
(/^border(-top|-right|-bottom|-left|-inline|-block)*$/.test(prop) || /^background$/.test(prop)) && | ||
!valueNode.value.toLowerCase().includes('color') | ||
(/^border(?:-top|-right|-bottom|-left|-inline|-block)?$/.test(prop) || /^background$/.test(prop)) && | ||
['color', 'scale'].every(word => !valueNode.value.toLowerCase().includes(word)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We now only return if neither If this is risky we could also consider changing the name of the token to |
||
) { | ||
return | ||
} | ||
|
||
report({ | ||
index: declarationValueIndex(declNode) + valueNode.sourceIndex, | ||
endIndex: declarationValueIndex(declNode) + valueNode.sourceEndIndex, | ||
|
Uh oh!
There was an error while loading. Please reload this page.