Skip to content

Commit d4fd8c8

Browse files
mirkahbhalodia
andauthored
Stylelint: Add cursor pointer rule and block-library override (#77501)
* Stylelint: Add rule for cursor pointer * Add block-library stylelint override * Fix remaining violation Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: hbhalodia <hbhalodia@git.wordpress.org>
1 parent b7aa342 commit d4fd8c8

4 files changed

Lines changed: 27 additions & 21 deletions

File tree

.stylelintrc.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ module.exports = {
2121
'declaration-property-value-disallowed-list': [
2222
{
2323
'/.*/': [ '/--wp-components-color-/' ],
24+
cursor: [ 'pointer' ],
2425
},
2526
{
26-
message: ( property, value ) =>
27-
`Avoid using "${ value }" in "${ property }". --wp-components-color-* variables are not ready to be used outside of the components package.`,
27+
message: ( property, value ) => {
28+
if ( property === 'cursor' ) {
29+
return 'Use the `var( --wpds-cursor-control )` token for interactive non-link controls. If this is for a link, you can disable this rule.';
30+
}
31+
return `Avoid using "${ value }" in "${ property }". --wp-components-color-* variables are not ready to be used outside of the components package.`;
32+
},
2833
},
2934
],
3035
'font-weight-notation': null,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import baseConfig from '../../.stylelintrc.js';
2+
3+
const [ disallowedValues, disallowedValueMessages ] =
4+
baseConfig.rules[ 'declaration-property-value-disallowed-list' ];
5+
6+
// wp-block-library generally should not use theme tokens in most cases.
7+
const { cursor: _ignoredCursorRule, ...blockLibraryDisallowedValues } =
8+
disallowedValues;
9+
10+
/** @type {import('stylelint').Config} */
11+
export default {
12+
extends: '../../.stylelintrc.js',
13+
rules: {
14+
'declaration-property-value-disallowed-list': [
15+
blockLibraryDisallowedValues,
16+
disallowedValueMessages,
17+
],
18+
},
19+
};

packages/ui/.stylelintrc.mjs

Lines changed: 0 additions & 18 deletions
This file was deleted.

routes/guidelines/components/guideline-accordion.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
border: none;
1212
padding: 0;
1313
margin: 0;
14-
cursor: pointer;
14+
cursor: var(--wpds-cursor-control);
1515
text-align: left;
1616
height: auto;
1717

0 commit comments

Comments
 (0)