DEV Community

Raquel Gonzalez
Raquel Gonzalez

Posted on

Adhere to H5P code style with ESLint

Overview

The H5P GitHub contains a Dev Tools repo containing PHP and ESLint config files. There is also a H5P boilerplate code template with a slightly different .eslintrc.json config file.

This guide is for anyone using the above resources to create their own H5P content types while following the H5P specified coding style, and for people that may be unfamiliar with ESLint.

Process: MacOS and VSCode

I'm using the ESLint CLI and the VSCode extension. Navigate to the root of your content type and run npx eslint -h to see a list of available commands. To use the config included in any boilerplate code linked above, run eslint -c myconfig.json myfiletotest.js the proper names of your files. Reference the docs Using Configuration Files for more information. You should then see your linting errors in the terminal.

Top comments (0)