Problem/Motivation

Saving time on checking standards and practice before committing any code.

#3113196: Drupal 9 Readiness for [Vartheme BS4 (Bootstrap 4 - SASS)] with Drupal coding standard and practice


Drupal coding standard and Drupal Practice check should pass

PHPCS, PHPCBF for both --standard=Drupal and --standard=DrupalPractice

Check Vartheme BS4 (Bootstrap 4 - SASS) Drupal coding standard

phpcbf --standard=Drupal --extensions=php,inc,install,test,profile,theme,scss,css,info,txt,md,yml /var/www/html/products/vartheme_bs4/ --ignore="/var/www/html/products/vartheme_bs4/node_modules/ , /var/www/html/products/vartheme_bs4/VARTHEME_BS4_SUBTHEME/node_modules/"

phpcs --standard=Drupal --extensions=php,inc,install,test,profile,theme,scss,css,info,txt,md,yml /var/www/html/products/vartheme_bs4/ --ignore="/var/www/html/products/vartheme_bs4/node_modules/ , /var/www/html/products/vartheme_bs4/VARTHEME_BS4_SUBTHEME/node_modules/"

Check Vartheme BS4 (Bootstrap 4 - SASS) Drupal Practice

phpcbf --standard=DrupalPractice --extensions=php,inc,install,test,profile,theme,scss,css,info,txt,md,yml /var/www/html/products/vartheme_bs4/ --ignore="/var/www/html/products/vartheme_bs4/node_modules/ , /var/www/html/products/vartheme_bs4/VARTHEME_BS4_SUBTHEME/node_modules/"

phpcs --standard=DrupalPractice --extensions=php,inc,install,test,profile,theme,scss,css,info,txt,md,yml /var/www/html/products/vartheme_bs4/ --ignore="/var/www/html/products/vartheme_bs4/node_modules/ , /var/www/html/products/vartheme_bs4/VARTHEME_BS4_SUBTHEME/node_modules/"

Proposed resolution

In Vartheme BS4 base theme
Having the following yarn script commands

yarn eslint
yarn stylelint
yarn phpcs
yarn phpcbf

as in the list of yarn scripts

  "scripts": {
    "theme:init": "gulp",
    "theme:build": "gulp compile",
    "theme:watch": "gulp watch",
    "theme:create-sub-theme": "bash ./scripts/create-new-vartheme-bs4.sh",
    "eslint": "node ./node_modules/eslint/bin/eslint.js --config=.eslintrc.json .",
    "stylelint": "npx stylelint --config=.stylelintrc.json .",
    "prettier": "prettier --write \"./js/**/*.es6.js\"",
    "phpcs": "phpcs --standard=./.phpcs.xml .",
    "phpcbf": "phpcbf --standard=./.phpcs.xml ."
  },

And for VARTHEM_BS4_SUBTHEME too to work in dev of Vartheme BS4 or in outer projects.

In VARTHEM_BS4_SUBTHEME
Have the following yarn script commands

yarn eslint
yarn stylelint
yarn phpcs
yarn phpcbf

as in the list of yarn scripts

  "scripts": {
    "theme:init": "gulp",
    "theme:build": "gulp compile",
    "theme:watch": "gulp watch",
    "eslint": "node ./node_modules/eslint/bin/eslint.js --config=.eslintrc.json .",
    "stylelint": "npx stylelint --config=.stylelintrc.json .",
    "prettier": "prettier --write \"./js/**/*.es6.js\"",
    "phpcs": "phpcs --standard=./.phpcs.xml .",
    "phpcbf": "phpcbf --standard=./.phpcs.xml ."
  },

Comments

RajabNatshah created an issue. See original summary.

rajab natshah’s picture

Title: Add pr-configured yarn script commands for Drupal coding standard and Drupal Practice for Vartheme BS4 and VARTHEME_BS4_SUBTHEME » Add yarn script commands for Drupal coding standard and Drupal Practice for Vartheme BS4 and VARTHEME_BS4_SUBTHEME
Issue summary: View changes

  • RajabNatshah committed 7dffea7 on 8.x-6.x
    Issue #3171126: Add yarn script commands for Drupal coding standard and...
rajab natshah’s picture

Assigned: rajab natshah » mohammed j. razem
Status: Active » Needs review
Issue tags: +varbase-8.8.7, +varbase-9.0.0

rajab natshah’s picture

rajab natshah’s picture

Assigned: mohammed j. razem » Unassigned
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes

Having the following yarn script commands

yarn phpcs:standard
yarn phpcbf:standard
yarn phpcs:practice

Two points

  • Do you like the name of the commands in package.json ? ( If I copied them to composer.json they will work too, but they may effect the root composer list of commands)
  • If @josebc could help .. as i'm using an inline command. we may want to have 2 phpcs.xml.dist files like phpcs.drupal_standard.xml and phpcs.drupal_practice.xml using "phpcs": "phpcs --standard=phpcs.xml.dist ." is working too but only for Drupal standard but not for Drupal practice.
rajab natshah’s picture

Assigned: Unassigned » mohammed j. razem
rajab natshah’s picture

Assigned: mohammed j. razem » rajab natshah
Status: Needs review » Active

  • RajabNatshah committed 224c7cc on 8.x-6.x authored by josebc
    Issue #3171126 by josebc: Add yarn script commands for Drupal coding...
rajab natshah’s picture

Changed after a discussion with Jose
on his work for https://github.com/Vardot/varbase-project

Vartheme BS4 base theme

  "scripts": {
    "theme:init": "gulp",
    "theme:build": "gulp compile",
    "theme:watch": "gulp watch",
    "theme:create-sub-theme": "bash ./scripts/create-new-vartheme-bs4.sh",
    "eslint": "node ./node_modules/eslint/bin/eslint.js --config=.eslintrc.json .",
    "stylelint": "npx stylelint --config=.stylelintrc.json .",
    "prettier": "prettier --write \"./js/**/*.es6.js\"",
    "phpcs": "phpcs --standard=./.phpcs.xml .",
    "phpcbf": "phpcbf --standard=./.phpcs.xml ."
  },

VARTHEME_BS4_SUBTHEME

  "scripts": {
    "theme:init": "gulp",
    "theme:build": "gulp compile",
    "theme:watch": "gulp watch",
    "eslint": "node ./node_modules/eslint/bin/eslint.js --config=.eslintrc.json .",
    "stylelint": "npx stylelint --config=.stylelintrc.json .",
    "prettier": "prettier --write \"./js/**/*.es6.js\"",
    "phpcs": "phpcs --standard=./.phpcs.xml .",
    "phpcbf": "phpcbf --standard=./.phpcs.xml ."
  },

  • RajabNatshah committed 23dbe2c on 8.x-6.x authored by josebc
    Issue #3171126 by josebc: Add yarn script commands for Drupal coding...
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

rajab natshah’s picture

Status: Active » Needs review
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Assigned: mohammed j. razem » Unassigned
rajab natshah’s picture

Status: Needs review » Fixed
rajab natshah’s picture

Issue summary: View changes

  • RajabNatshah committed 8cd6caf on 8.x-6.x
    Issue #3171126: Add yarn script commands for Drupal coding standard and...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.