Skip to content

Command-Line Interface (CLI)

You can use HTMLHint on the command-line. For example:

Terminal window
npx htmlhint index.html

Use npx htmlhint --help to print the CLI documentation.

In addition to the standard options, the CLI accepts:

Force enabling/disabling of color.

Create a new HTMLHint configuration file (.htmlhintrc) in the current directory with default rules. If a configuration file already exists, this command will exit successfully without making changes.

Terminal window
npx htmlhint --init

Show all the rules available

Set all of the rules available

Load custom rules from file or folder. See the custom rules documentation for detailed information on creating and using custom rules.

Terminal window
# Load a single custom rule file
npx htmlhint --rulesdir ./my-custom-rule.js index.html
# Load all custom rules from a directory
npx htmlhint --rulesdir ./custom-rules/ index.html

Show the currently installed version of HTMLHint.