JavaScript coding guidelines

The rules suggested in the Airbnb JavaScript Style Guide should be used throughout the TYPO3 Core for JavaScript files.

Note that the TYPO3 Core typically uses TypeScript now and automatically converts it to JavaScript.

Directories and filenames

  • JavaScript files should have the file ending .js
  • JavaScript files are located under <extension>/Resources/Public/JavaScript/

Format

  • Use spaces, not TABs.
  • Indent with 2 spaces.
  • Use single quotes ('') for strings.
  • Prefix jQuery object variables with a $.

More information