ESLint, JSLint, JSHint, JSCS

For testing JavaScript code, you can use linters. Linters are tools that analyze your code and help you debug any errors that may pop up in your code.

ESLint and JSLint are some of the most popular JavaScript linters.

  1. ESLint: It is easily extensible, comes with a large number of custom rules, has the best ES6 support and the only tool to support JSX. It is the most recent out of the four.
  2. JSLint: It is the oldest of the four and was created by Douglas Crockford in 2002 to enforce the good parts of JavaScript. Unlike ESlint, JSLint is not configurable.
  3. JSHint: It is the configurable version of JSLint and has basic ES6 support. But the downsides of using JSHint are that it is difficult to know which rule is causing an error and it has no custom rule support.
  4. JSCS: It is a code style checker. It only catches issues related to code formatting, and not potential bugs or errors.

Learn how to Install and use the WordPress ESLint plugin.