JavaScript coding standards and best practices for Drupal.

JavaScript coding standards

Use eslint for Drupal JS coding standards. See the eslint settings information.

JavaScript best practices

This page covers DOM and Drupal specific code styles.

ESLint settings

As of Drupal 8, we use ESLint to make sure our JavaScript code is consistent and free from syntax error and leaking variables and that it

JavaScript API documentation and comment standards

JavaScript code should be documented with documentation headers that are very similar to the PHP documentation headers, with modifications

jQuery coding standards

Prefix variables that point to jQuery objects with a dollar sign($)

Guide maintainers