Contents
Introduction
Linting is the practice of using tools that analyze the code in your project for programming errors, stylistic inconsistencies, and other issues that can make code difficult to read, debug, or maintain over time. Linting is an important part of ensuring quality in a codebase because code that is written inconsistently or which uses suboptimal approaches may still execute flawlessly.
The following linting tools are commonly used by developers in the WooCommerce community and are the tools we recommend if you’re developing products for the WooCommerce Marketplace. To use these tools, please also see our guide to learn how to set up Linting for a WooCommerce project.
PHP_CodeSniffer
PHP_CodeSniffer is a set of command-line scripts that will tokenize the PHP, JavaScript, and CSS files in a project and analyze them to detect violations of a pre-defined set of coding standards. It supports custom rules, called sniffs, and can even automatically correct violations in your code. WooCommerce has a dedicated set of sniffs that WooCommerce core and all Marketplace extensions are evaluated against.
https://github.com/squizlabs/PHP_CodeSniffer
ESLint
ESLint is a tool for analyzing the JavaScript code and identifying problematic patterns. Like other linting tools, it can also automatically fix many of the problems it discovers. Projects like WooCommerce core, WooCommerce Admin, and WooCommerce Blocks all have tailored ESLint configurations that help maintain quality and consistency across the JavaScript files that power these plugins.
https://eslint.org/
→
Next: Debugging Tools