Problem/Motivation

Standard check and linting tools are outdated.
And a new linting tool with yarn lint:yaml was added to Drupal core
#2591827: Add YAML linting to core coding standards checks

Very important to make sure that all .yml files are in the right format.
eslint-plugin-yml a good tool to lint with
Example: using not standard format
or check on any duplicate yaml elements

Proposed resolution

Add the yarn lint:yaml
and update all outdated check configs and the package.json file

Compiling Provided Component Styles

In case of wanting to add a new feature or fix a bug in styling for a selected Varbase component.

Get Needed Yarn Development Dependencies
yarn install


Initialize
Initialize the gulp SASS files styling method. Run this only ones for each newly cloned project.
yarn theme:init
Theme Build
Compile source .scss files to .css files. Needs to compile manually on demand.
yarn theme:build
Watch
Watch source .scss files and compile them on saving to .css files. Auto compiling on save of changes for the source.
yarn theme:watch

After any change of code please check the standards before uploading a patch or creating a MR.

Check Standards/Practice Coding And Linting

Check Drupal Standard And Practice Coding
Check Drupal standard and practice coding.
yarn phpcs


PHP Code Beautifier and Fixer
Fix many errors and warnings automatically.
yarn phpcbf
Linting YAML files
Check all .yml files with Drupal standard yaml format.
yarn lint:yaml
Linting JavaScript files
Check all JavaScript .js, .json files with Drupal standard scripting format.
yarn lint:js
Linting Styling
Check all styling .css files with Drupal standard styling format and order.
yarn lint:css
  "scripts": {
    "theme:init": "gulp",
    "theme:build": "gulp compile",
    "theme:watch": "gulp watch",
    "phpcs": "phpcs --standard=./.phpcs.xml .",
    "phpcbf": "phpcbf --standard=./.phpcs.xml .",
    "lint:yaml": "node ./node_modules/eslint/bin/eslint.js --config=.eslintrc.json --ext .yml .",
    "lint:js": "node ./node_modules/eslint/bin/eslint.js --config=.eslintrc.json --ext .js .",
    "lint:css": "npx stylelint --config=.stylelintrc.json ."
  },


Remaining tasks

  • ✅ File an issue about this project
  • ✅ Add lint:yaml and update packages in package.json
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ✅ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ✅ Code review from 1 Varbase core team member
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Release varbase-9.0.3 , varbase_media-9.0.4

User interface changes

  • None

API changes

  • None

Data model changes

  • None

Comments

RajabNatshah created an issue. See original summary.

Rajab Natshah’s picture

Project: Varbase Core » Varbase Media

  • RajabNatshah committed 7aaac88 on 9.0.x
    Issue #3233072: Add lint:yaml and update the package.json for Varbase...
Rajab Natshah’s picture

Assigned: Rajab Natshah » Mohammed J. Razem
Issue summary: View changes
Status: Active » Needs review
Issue tags: +varbase-9.0.2, +varbase_media-9.0.4

phpcs --standard=Drupal

rajab@vardot-dev:/var/www/html/products/varbase_media$ phpcs --standard=Drupal --extensions=php,module,inc,install,test,theme,scss,css,info,txt,md,yml /var/www/html/products/varbase_media/ --ignore=/var/www/html/products/varbase_media/node_modules/

phpcs --standard=DrupalPractice

rajab@vardot-dev:/var/www/html/products/varbase_media$ phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,theme,scss,css,info,txt,md,yml /var/www/html/products/varbase_media/ --ignore=/var/www/html/products/varbase_media/node_modules/

yarn phpcs

rajab@vardot-dev:/var/www/html/products/varbase_media$ yarn phpcs
yarn run v1.22.10
$ phpcs --standard=./.phpcs.xml .
Done in 1.74s.

yarn phpcbf

rajab@vardot-dev:/var/www/html/products/varbase_media$ yarn phpcbf
yarn run v1.22.10
$ phpcbf --standard=./.phpcs.xml .

No fixable errors were found

Time: 1.67 secs; Memory: 18MB

Done in 1.75s.

yarn lint:yaml

rajab@vardot-dev:/var/www/html/products/varbase_media$ yarn lint:yaml
yarn run v1.22.10
$ node ./node_modules/eslint/bin/eslint.js --config=.eslintrc.json --ext .yml .
Done in 10.36s.

yarn lint:js

rajab@vardot-dev:/var/www/html/products/varbase_media$ yarn lint:js
yarn run v1.22.10
$ node ./node_modules/eslint/bin/eslint.js --config=.eslintrc.json --ext .js .

/var/www/html/products/varbase_media/js/oembed-frame.varbase-media.youtube.js
  28:7  warning  'youtubePlayer' is assigned a value but never used  no-unused-vars

✖ 1 problem (0 errors, 1 warning)

Done in 1.69s.

yarn lint:css

rajab@vardot-dev:/var/www/html/products/varbase_media$ yarn lint:css
yarn run v1.22.10
$ npx stylelint --config=.stylelintrc.json .
Done in 2.99s.
Rajab Natshah’s picture

Assigned: Mohammed J. Razem » Unassigned
Rajab Natshah’s picture

Issue summary: View changes
Rajab Natshah’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

Rajab Natshah’s picture

Issue summary: View changes
Issue tags: -varbase-9.0.2 +varbase-9.0.3
Rajab Natshah’s picture

Issue summary: View changes
Rajab Natshah’s picture

Issue summary: View changes