André Amorim

Crafting Web Experiences

//

Code Standards

Go back to /notes?

  • WordPress Block JS Code Standard (Prettier)

    Installation Install the module $ npm install @wordpress/prettier-config –save-dev Note: This package requires Node.js version with long-term support status (check Active LTS or Maintenance LTS releases). It is not compatible with older versions. Usage Add this to your package.json file: “prettier”: “@wordpress/prettier-config” Alternatively, add this to .prettierrc file: “@wordpress/prettier-config” Or add this to .prettierrc.js file: module.exports = require( ‘@wordpress/prettier-config’ );

  • Easier: WPCS Workspace Based

    1. composer.json (composer.lock must be exist) 2. Install the VS Code Extension PHP Sniffer & Beautifier: https://marketplace.visualstudio.com/items?itemName=ValeryanM.vscode-phpsab

  • GLOBAL: PHPCS, PHPCBF, and WPCS Coding Standards with VS Code

    # Download using curl # Give the execution permissions # Install WordPress Coding Standards # Apply the new coding standards # Update the default standard # Install the VS Code Extension PHP Sniffer & Beautifier: https://marketplace.visualstudio.com/items?itemName=ValeryanM.vscode-phpsab # Add these settings to the settings.json file of VS Code