Comply with Drupal coding standards (3) (Stylelint)

Created on 9 September 2023, over 1 year ago
Updated 23 September 2023, about 1 year ago

Problem/Motivation

Fix the following coding standard errors reported by https://git.drupalcode.org/project/rigel/-/jobs/79662

$ yarn --silent --cwd $_WEB_ROOT/core stylelint --formatter verbose --config ./.stylelintrc.json ../modules/custom/**/*.css --color || true
../modules/custom/rigel/assets/css/main.css
   49:9   ✖  Expected "url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500&display=swap")" to be ""https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500&display=swap""  import-notation
  284:1   ✖  Unexpected vendor-prefixed at-rule "@-webkit-keyframes"                                                                                                                                                                                                        at-rule-no-vendor-prefix
  291:1   ✖  Unexpected vendor-prefixed at-rule "@-moz-keyframes"                                                                                                                                                                                                           at-rule-no-vendor-prefix
  298:1   ✖  Unexpected vendor-prefixed at-rule "@-ms-keyframes"                                                                                                                                                                                                            at-rule-no-vendor-prefix
  305:1   ✖  Unexpected vendor-prefixed at-rule "@-o-keyframes"                                                                                                                                                                                                             at-rule-no-vendor-prefix
  504:21  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
  522:29  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
  556:51  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
  559:51  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
  563:63  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
  580:23  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
  581:23  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
  588:23  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
  595:23  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
  818:49  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
  863:62  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
  864:61  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
 1266:41  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
 1276:41  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
 1288:43  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
 1943:64  ✖  Expected double colon pseudo-element notation                                                                                                                                                                                                                  selector-pseudo-element-colon-notation
../modules/custom/rigel/css/glyphicons/css/glyphicons.css
  10:16  ✖  Unexpected missing generic font family              font-family-no-missing-generic-family-keyword
  12:3   ✖  Expected "font-weight" to come before "font-style"  order/properties-order

... (snip) ...
  
 798:21  ✖  Expected double colon pseudo-element notation       selector-pseudo-element-colon-notation
 801:19  ✖  Expected double colon pseudo-element notation       selector-pseudo-element-colon-notation
286 problems (286 errors, 0 warnings)
2 sources checked
 /builds/project/rigel/web/modules/custom/rigel/assets/css/main.css
 /builds/project/rigel/web/modules/custom/rigel/css/glyphicons/css/glyphicons.css
286 errors found
 import-notation: 1 (maybe fixable)
 at-rule-no-vendor-prefix: 4 (maybe fixable)
 selector-pseudo-element-colon-notation: 279 (maybe fixable)
 font-family-no-missing-generic-family-keyword: 1
 order/properties-order: 1
You may fix some problems with the "--fix" option.

Proposed resolution

We should exclude main.css since it is produced by SCSS.

📌 Task
Status

Fixed

Version

6.0

Component

Code

Created by

🇺🇸United States yas California 🇺🇸

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @yas
  • 🇺🇸United States yas California 🇺🇸
  • First commit to issue fork.
  • @shubham_jain opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India shubham_jain

    Hi @yas, I fixed the stylelint error according to the Stylelint and css standards.

    Please review and verify.

  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States yas California 🇺🇸

    @shubhanm_jain

    Thank you for fixing the coding standards. Unfortunately, main.css is automatically generated by SCSS tool so that we should take a look assets/scss directory. Probably we should exclude the main.css file from stylelint check from .gitlab-ci.yml at 💬 Add a .gitlab-ci.yml file Needs work .

    glyphicons.css should be fine.

    Thanks

  • 🇮🇳India shubham_jain

    Hi @yas, you are right you need to exclude the main.css file from stylelint check from .gitlab-ci.yml. And add scss stylelint check.

    I have corrected the scss according to the stylelint and created PR for it.

    Please review and verify.

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States yas California 🇺🇸

    @shubham_jain

    Thank you for the fixes. I ran d.o's GitLab CI w/ your patch and here is the result:

    https://git.drupalcode.org/project/rigel/-/jobs/87913

    $ yarn --silent --cwd $_WEB_ROOT/core stylelint --formatter verbose --config ./.stylelintrc.json ../modules/custom/**/*.css --color || true
    ../modules/custom/rigel/assets/css/main.css
      67:9  ✖  Expected "url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500&display=swap")" to be ""https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500&display=swap""  import-notation
     324:1  ✖  Unexpected vendor-prefixed at-rule "@-webkit-keyframes"                                                                                                                                                                                                        at-rule-no-vendor-prefix
     331:1  ✖  Unexpected vendor-prefixed at-rule "@-moz-keyframes"                                                                                                                                                                                                           at-rule-no-vendor-prefix
     338:1  ✖  Unexpected vendor-prefixed at-rule "@-ms-keyframes"                                                                                                                                                                                                            at-rule-no-vendor-prefix
     345:1  ✖  Unexpected vendor-prefixed at-rule "@-o-keyframes"                                                                                                                                                                                                             at-rule-no-vendor-prefix
    5 problems (5 errors, 0 warnings)

    There were no errors such as Unexpected unknown at-rule "@include" at-rule-no-unknown but there look the other errors that stylelint cannot recognize.

    If we ignore those errors, what about the first one:

    Expected "url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500&display=swap")" to be ""https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500&display=swap"" import-notation

    Can you figure it out?

    Thanks

  • 🇮🇳India shubham_jain

    Hi @yas,
    this error Unexpected vendor-prefixed at-rule "@-webkit-keyframes" is to be ignored and will see to it if can be resolved.

    Expected "url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500&display=swap")" to be ""https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500&display=swap"" import-notation

    I know what to do and will push updated code.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India shubham_jain

    Solved those error.

    @yas, those errors were not coming in my local setup so please test and verify.

  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States yas California 🇺🇸

    @shubham_jain

    Thank you for the update. I ran d.o's GitLab CI w/ your patch and here is the result:

    https://git.drupalcode.org/project/rigel/-/jobs/93411

    The following error wasn't fixed:

    Expected "url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500&display=swap")" to be ""https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500&display=swap"" import-notation

    So I posted my comments.

    Thanks

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India shubham_jain

    Hi @yas, thanks for the feedback. I have resolved all the threads and have made changes directly through git interface.
    So, please review and verify.

  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States yas California 🇺🇸

    @shubham_jain

    Thank for the update. Thank you for the fixes. I ran d.o's GitLab CI w/ your patch and here is the result:

    https://git.drupalcode.org/project/rigel/-/jobs/100137

    It looks url import notation was ignored but still the error Unexpected vendor-prefixed at-rule "@-webkit-keyframes" at-rule-no-vendor-prefix has not been fixed.

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India shubham_jain

    Hi @yas, please review updated MR.

  • 🇺🇸United States baldwinlouie

    @shubham_jain, Thanks for the work on this patch. I have a question about the last commit

    For this: https://git.drupalcode.org/project/rigel/-/merge_requests/42/diffs?commi..., did you make the corresponding SCSS change as well?

  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States yas California 🇺🇸

    @baldwinlouie

    Thank you for your review. Let us change the status to Needs work.

    @shubham_jain

    What do you think about @baldwinlouie's comment?

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India shubham_jain

    @baldwinlouie

    Thank you for your review. I forgot to do those changes but now I have fixed that. Please review.

  • 🇺🇸United States yas California 🇺🇸

    @shubham_jain

    Thank for the update. Thank you for the fixes. I ran d.o's GitLab CI w/ your patch and the stylelint test has been passed successfully at https://git.drupalcode.org/project/rigel/-/jobs/106707

    @baldwinlouie

    What do you think?

    Thanks

  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States baldwinlouie

    @shubham_jain Thanks for the great patch. It looks good to me now .

  • 🇺🇸United States yas California 🇺🇸

    @baldwinlouie

    Thank you for your review.

    @shubham_jain

    Thank you for your efforts. I'll merge the patch to 6.x, and close this issue as Fixed.

  • 🇺🇸United States yas California 🇺🇸
  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024