[wp-trac] [WordPress Trac] #53866: Measurement in 'px' is unnecessary

WordPress Trac noreply at wordpress.org
Thu Aug 5 08:28:01 UTC 2021


#53866: Measurement in 'px' is unnecessary
----------------------------+------------------------------------
 Reporter:  ankitmaru       |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  5.9
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:  css, coding-standards
----------------------------+------------------------------------
Changes (by netweb):

 * keywords:  has-patch commit => has-patch


Comment:

 Going to remove the `commit` keyword from here for now pending the updated
 patch.

 To help with checking for all cases of the two stylelint rules, if you add
 the below code to a file named `.stylelintrc.js` to the root of the
 project, and after running `npm install`running this command will display
 all instances of the code these two rules affect:


 {{{
 #!js
 'use strict';

 module.exports = {
         rules: {
                 'length-zero-no-unit': true,
                 'shorthand-property-no-redundant-values': true,
         },
 };
 }}}

 Then run:

 > `./node_modules/.bin/stylelint "**/*.scss" --config=.stylelintrd.js`

 And you should see something like this:

 {{{
 src/wp-content/themes/twentynineteen/style-editor.scss
  794:26  ✖  Unexpected unit   length-zero-no-unit
  795:25  ✖  Unexpected unit   length-zero-no-unit

 src/wp-content/themes/twentytwentyone/assets/sass/01-settings/global.scss
  230:32  ✖  Unexpected unit   length-zero-no-unit

 src/wp-
 content/themes/twentytwentyone/assets/sass/06-components/comments.scss
  130:3  ✖  Unexpected longhand value '8px 0 9px 0' instead of '8px 0 9px'
 shorthand-property-no-redundant-values

 src/wp-
 content/themes/twentytwentyone/assets/sass/06-components/navigation.scss
  301:6  ✖  Unexpected longhand value '0 7px 10px 7px' instead of '0 7px
 10px'   shorthand-property-no-redundant-values

 src/wp-
 content/themes/twentytwentyone/assets/sass/05-blocks/navigation/_style.scss
  84:6  ✖  Unexpected longhand value '0 7px 10px 7px' instead of '0 7px
 10px'   shorthand-property-no-redundant-values
 }}}

 The above is for SCSS files, for CSS run:

 > `./node_modules/.bin/stylelint "**/*.css" --config=.stylelintrd.js`

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53866#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list